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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index a4b9534c77eb6788f477c6c27eb294fc013c3369..a89c2e740a0437126a0996942074e7e05dbe181d 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -272,12 +272,23 @@ void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) {
DCHECK(context->getError() == GL_NO_ERROR);
}
-void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
+bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
gfx::JavaBitmap& bitmap) {
+ return CopyTextureToBitmap(texture_id, gfx::Rect(bitmap.size()), bitmap);
+}
+
+bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
+ const gfx::Rect& sub_rect,
+ gfx::JavaBitmap& bitmap) {
+ // The sub_rect should match the bitmap size.
+ DCHECK(bitmap.size() == sub_rect.size());
+ if (bitmap.size() != sub_rect.size() || texture_id == 0) return false;
+
GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
helper->ReadbackTextureSync(texture_id,
- bitmap.size(),
+ sub_rect,
static_cast<unsigned char*> (bitmap.pixels()));
+ return true;
}
void CompositorImpl::animate(double monotonicFrameBeginTime) {

Powered by Google App Engine
This is Rietveld 408576698