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

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: 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
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..bd6cbbf412e48f6138d79dece4ef58c4ff553b73 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_size_in_pixel = dst_size.Scale(scale);
+ if (!output->initialize(
+ dst_size_in_pixel.width(), dst_size_in_pixel.height(), true))
return;
+ gfx::Rect src_subrect_in_pixel(src_subrect.origin().Scale(scale),
Nico 2012/07/26 23:45:48 src_pixel_subrect is more consistent with the rest
mazda 2012/07/27 00:00:35 Done.
+ src_subrect.size().Scale(scale));
const bool result = compositing_iosurface_->CopyTo(
- dst_size, output->getTopDevice()->accessBitmap(true).getPixels());
+ src_subrect_in_pixel,
+ dst_size_in_pixel,
+ output->getTopDevice()->accessBitmap(true).getPixels());
scoped_callback_runner.Release();
callback.Run(result);
}

Powered by Google App Engine
This is Rietveld 408576698