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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 21777003: DevTools: [Android] implement RenderWidgetHostViewAndroid::CopyFromCompositingSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang bots. Created 7 years, 4 months 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/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 3282ca90a83396f4a3ba30abcba21f6c6c902c56..490f856875a9c4171030d3b7b0b0c8c4ff69064b 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -271,6 +271,35 @@ bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(jobject jbitmap) {
return true;
}
+bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(
no sievers 2013/08/05 21:46:44 Oh no... we are trying to deprecate any readbacks
+ const gfx::Size& size, SkBitmap* bitmap) {
+ if (!CompositorImpl::IsInitialized() ||
+ texture_id_in_layer_ == 0 ||
+ texture_size_in_layer_.IsEmpty())
+ return false;
+
+ GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
+
+ WebKit::WebGLId texture = helper->CopyAndScaleTexture(
+ texture_id_in_layer_,
+ texture_size_in_layer_,
+ size,
+ true,
+ GLHelper::SCALER_QUALITY_FAST);
+ if (texture == 0)
+ return false;
+
+ helper->ReadbackTextureSync(texture,
+ gfx::Rect(size),
+ static_cast<unsigned char*> (bitmap->getPixels()));
+
+ WebKit::WebGraphicsContext3D* context =
+ ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
+ context->deleteTexture(texture);
+
+ return true;
+}
+
bool RenderWidgetHostViewAndroid::HasValidFrame() const {
return texture_id_in_layer_ != 0 &&
content_view_core_ &&

Powered by Google App Engine
This is Rietveld 408576698