Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 11558039: Subrect snapshot support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix WebView build Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) { 265 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) {
266 WebKit::WebGraphicsContext3D* context = 266 WebKit::WebGraphicsContext3D* context =
267 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 267 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
268 if (context->isContextLost() || !context->makeContextCurrent()) 268 if (context->isContextLost() || !context->makeContextCurrent())
269 return; 269 return;
270 context->deleteTexture(texture_id); 270 context->deleteTexture(texture_id);
271 context->shallowFlushCHROMIUM(); 271 context->shallowFlushCHROMIUM();
272 DCHECK(context->getError() == GL_NO_ERROR); 272 DCHECK(context->getError() == GL_NO_ERROR);
273 } 273 }
274 274
275 void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id, 275 bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
276 gfx::JavaBitmap& bitmap) { 276 gfx::JavaBitmap& bitmap) {
277 return CopyTextureToBitmap(texture_id, gfx::Rect(bitmap.size()), bitmap);
278 }
279
280 bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
281 const gfx::Rect& sub_rect,
282 gfx::JavaBitmap& bitmap) {
283 // The sub_rect should match the bitmap size.
284 DCHECK(bitmap.size() == sub_rect.size());
285 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false;
286
277 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); 287 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
278 helper->ReadbackTextureSync(texture_id, 288 helper->ReadbackTextureSync(texture_id,
279 bitmap.size(), 289 sub_rect,
280 static_cast<unsigned char*> (bitmap.pixels())); 290 static_cast<unsigned char*> (bitmap.pixels()));
291 return true;
281 } 292 }
282 293
283 void CompositorImpl::animate(double monotonicFrameBeginTime) { 294 void CompositorImpl::animate(double monotonicFrameBeginTime) {
284 } 295 }
285 296
286 void CompositorImpl::layout() { 297 void CompositorImpl::layout() {
287 } 298 }
288 299
289 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta, 300 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta,
290 float pageScale) { 301 float pageScale) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 case ANDROID_BITMAP_FORMAT_RGBA_8888: 421 case ANDROID_BITMAP_FORMAT_RGBA_8888:
411 return GL_UNSIGNED_BYTE; 422 return GL_UNSIGNED_BYTE;
412 break; 423 break;
413 case ANDROID_BITMAP_FORMAT_RGB_565: 424 case ANDROID_BITMAP_FORMAT_RGB_565:
414 default: 425 default:
415 return GL_UNSIGNED_SHORT_5_6_5; 426 return GL_UNSIGNED_SHORT_5_6_5;
416 } 427 }
417 } 428 }
418 429
419 } // namespace content 430 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698