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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 10835014: Support copying a partial rectangle region from the compositing surface on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 5 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index f546d4e1d630f91be8a9c76389a918e710686c21..cb3ecf5cb2e6e14f873954cf6c5ea4f0da88b82e 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -822,22 +822,22 @@ void RenderWidgetHostViewMac::CopyFromCompositingSurface(
const base::Callback<void(bool)>& callback,
skia::PlatformCanvas* output) {
base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
- // TODO(mazda): Support copying a partial rectangle from the compositing
- // surface with |src_subrect| (http://crbug.com/118571).
- if (!src_subrect.IsEmpty()) {
- NOTIMPLEMENTED();
- return;
- }
-
if (!compositing_iosurface_.get() ||
!compositing_iosurface_->HasIOSurface())
return;
- if (!output->initialize(dst_size.width(), dst_size.height(), true))
+ float scale = ScaleFactor(cocoa_view_);
+ gfx::Size dst_pixel_size = dst_size.Scale(scale);
+ if (!output->initialize(
+ dst_pixel_size.width(), dst_pixel_size.height(), true))
return;
+ gfx::Rect src_pixel_subrect(src_subrect.origin().Scale(scale),
+ src_subrect.size().Scale(scale));
const bool result = compositing_iosurface_->CopyTo(
- dst_size, output->getTopDevice()->accessBitmap(true).getPixels());
+ src_pixel_subrect,
+ dst_pixel_size,
+ output->getTopDevice()->accessBitmap(true).getPixels());
scoped_callback_runner.Release();
callback.Run(result);
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698