diff options
author | stuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 20:13:50 +0000 |
---|---|---|
committer | stuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 20:13:50 +0000 |
commit | cb69ca0e206805c4a4a4cdef2db44fb196820c2a (patch) | |
tree | 7408cefacdb5680e52171391bc35362469eb99b1 | |
parent | de54ce65bf92ad88e54d2a1ad4a1960c86a46d29 (diff) | |
download | chromium_src-cb69ca0e206805c4a4a4cdef2db44fb196820c2a.zip chromium_src-cb69ca0e206805c4a4a4cdef2db44fb196820c2a.tar.gz chromium_src-cb69ca0e206805c4a4a4cdef2db44fb196820c2a.tar.bz2 |
Fix Mac plugin background snapshots
BUG=none
TEST=Compose an email in Gmail with plugins enabled; scroll around and mouse over the "Add attachment" link; it should always draw correctly instead of sometimes showing another part of the page.
Review URL: http://codereview.chromium.org/159712
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22178 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/gfx/blit.cc | 14 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/base/gfx/blit.cc b/base/gfx/blit.cc index 2965c4c..4b94255 100644 --- a/base/gfx/blit.cc +++ b/base/gfx/blit.cc @@ -27,13 +27,27 @@ void BlitContextToContext(NativeDrawingContext dst_context, dst_rect.width(), dst_rect.height(), src_context, src_origin.x(), src_origin.y(), SRCCOPY); #elif defined(OS_MACOSX) + // Only translations and/or vertical flips in the source context are + // supported; more complex source context transforms will be ignored. + + // If there is a translation on the source context, we need to account for + // it ourselves since CGBitmapContextCreateImage will bypass it. Rect src_rect(src_origin, dst_rect.size()); + CGAffineTransform transform = CGContextGetCTM(src_context); + bool flipped = fabs(transform.d + 1) < 0.0001; + CGFloat delta_y = flipped ? CGBitmapContextGetHeight(src_context) - + transform.ty + : transform.ty; + src_rect.Offset(transform.tx, delta_y); + scoped_cftyperef<CGImageRef> src_image(CGBitmapContextCreateImage(src_context)); scoped_cftyperef<CGImageRef> src_sub_image( CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect())); CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image); #elif defined(OS_LINUX) + // Only translations in the source context are supported; more complex + // source context transforms will be ignored. cairo_save(dst_context); double surface_x = src_origin.x(); double surface_y = src_origin.y(); diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 3d05a4b..a2ffeb4 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -603,6 +603,11 @@ bool WebPluginDelegateProxy::BackgroundChanged( } return false; #else + // Mac implementation note: |rect| is in content-area-relative coordinates, + // but we may be given a context that is a subset of the content area + // with a transform that makes the coordinates work out. We will likely + // need to do fixup work like that done in BlitContextToContext when we + // implement this. NOTIMPLEMENTED(); return true; #endif |