diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-28 04:04:17 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-28 04:04:17 +0000 |
commit | 3d257761303b779a805400a676a86625f170b7bf (patch) | |
tree | bae833f2db5e50750b5e2a0173dd0db96d65c07c /content | |
parent | 90b769dff7d9176887414cb4d7399344c49f5821 (diff) | |
download | chromium_src-3d257761303b779a805400a676a86625f170b7bf.zip chromium_src-3d257761303b779a805400a676a86625f170b7bf.tar.gz chromium_src-3d257761303b779a805400a676a86625f170b7bf.tar.bz2 |
Convert the sub-rectangle for GL functions from the views coordinate to the OpenGL coordinate.
BUG=118571
Review URL: https://chromiumcodereview.appspot.com/10826054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 8 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_mac.mm | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 335829a..6d14ad4 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -510,7 +510,13 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( AsWeakPtr(), callback); pending_thumbnail_tasks_.push_back(callback); - gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect); + + // Convert |src_subrect| from the views coordinate (upper-left origin) into + // the OpenGL coordinate (lower-left origin). + gfx::Rect src_subrect_in_gl = src_subrect; + src_subrect_in_gl.set_y(GetViewBounds().height() - src_subrect.bottom()); + + gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect_in_gl); gl_helper->CopyTextureTo(container->texture_id(), container->size(), src_subrect_in_pixel, 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 7f3c8d9..ac79894 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -832,10 +832,14 @@ void RenderWidgetHostViewMac::CopyFromCompositingSurface( 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)); + // Convert |src_subrect| from the views coordinate (upper-left origin) into + // the OpenGL coordinate (lower-left origin). + gfx::Rect src_gl_subrect = src_subrect; + src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); + + gfx::Rect src_pixel_gl_subrect = src_gl_subrect.Scale(scale); const bool result = compositing_iosurface_->CopyTo( - src_pixel_subrect, + src_pixel_gl_subrect, dst_pixel_size, output->getTopDevice()->accessBitmap(true).getPixels()); scoped_callback_runner.Release(); |