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

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

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments; sync up Created 7 years, 9 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_gtk.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc
index b4fd47aff2e213e4174644a6858f689767705448..b277b0f712e9742bc50be7bcb8f1f71026354d06 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -1045,53 +1045,11 @@ BackingStore* RenderWidgetHostViewGtk::AllocBackingStore(
depth);
}
-// NOTE: |output| is initialized with the size of |src_subrect|, and |dst_size|
mazda 2013/03/22 00:51:29 Can you keep the part that says |dst_size| is igno
justinlin 2013/03/22 00:57:22 Done. Yes, sorry this code has changed a few times
-// is ignored on GTK.
void RenderWidgetHostViewGtk::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
- const gfx::Size& /* dst_size */,
+ const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback) {
- base::ScopedClosureRunner scoped_callback_runner(
- base::Bind(callback, false, SkBitmap()));
-
- XID parent_window = ui::GetParentWindow(compositing_surface_);
- if (parent_window == None)
- return;
-
- // Get the window offset with respect to its parent.
- XWindowAttributes attr;
- if (!XGetWindowAttributes(ui::GetXDisplay(), compositing_surface_, &attr))
- return;
-
- gfx::Rect src_subrect_in_parent(src_subrect);
- src_subrect_in_parent.Offset(attr.x, attr.y);
-
- ui::XScopedImage image(XGetImage(ui::GetXDisplay(), parent_window,
- src_subrect_in_parent.x(),
- src_subrect_in_parent.y(),
- src_subrect_in_parent.width(),
- src_subrect_in_parent.height(),
- AllPlanes, ZPixmap));
- if (!image.get())
- return;
-
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- image->width,
- image->height,
- image->bytes_per_line);
- if (!bitmap.allocPixels())
- return;
- bitmap.setIsOpaque(true);
-
- const size_t bitmap_size = bitmap.getSize();
- DCHECK_EQ(bitmap_size,
- static_cast<size_t>(image->height * image->bytes_per_line));
- unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels());
- memcpy(pixels, image->data, bitmap_size);
-
- scoped_callback_runner.Release();
- callback.Run(true, bitmap);
+ GetRenderWidgetHost()->GetSnapshotFromRenderer(src_subrect, callback);
}
void RenderWidgetHostViewGtk::CopyFromCompositingSurfaceToVideoFrame(
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698