summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webplugin_delegate_proxy.cc
diff options
context:
space:
mode:
authorstuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 19:30:32 +0000
committerstuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 19:30:32 +0000
commit4be98628a79d54152176eaf829916a4eb5e6777c (patch)
treeb36c0db6734482cb1247d85da9c8a74afa044b71 /chrome/renderer/webplugin_delegate_proxy.cc
parent9abc1b14a6042d4575d2817b275acb6c241ec543 (diff)
downloadchromium_src-4be98628a79d54152176eaf829916a4eb5e6777c.zip
chromium_src-4be98628a79d54152176eaf829916a4eb5e6777c.tar.gz
chromium_src-4be98628a79d54152176eaf829916a4eb5e6777c.tar.bz2
Fix partial plugin invalidate repainting on Mac.
The transport canvas and the backing store canvas are upside down relative to eachother, so the rects need some massaging. BUG=none TEST=YouTube videos should play without sections drawing in the wrong place, and plugins scrolled partially offscreen should draw the right section. Review URL: http://codereview.chromium.org/159423 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 03b2b57..b6ea8dd 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -498,6 +498,14 @@ bool WebPluginDelegateProxy::CreateBitmap(
return true;
}
+#if defined(OS_MACOSX)
+// Flips |rect| vertically within an enclosing rect with height |height|.
+// Intended for converting rects between flipped and non-flipped contexts.
+static void FlipRectVerticallyWithHeight(gfx::Rect* rect, int height) {
+ rect->set_y(height - rect->y() - rect->height());
+}
+#endif
+
void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context,
const gfx::Rect& damaged_rect) {
// If the plugin is no longer connected (channel crashed) draw a crashed
@@ -535,6 +543,9 @@ void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context,
CopyFromTransportToBacking(offset_rect);
}
+#if defined(OS_MACOSX)
+ FlipRectVerticallyWithHeight(&offset_rect, plugin_rect_.height());
+#endif
BlitCanvasToContext(context, rect, backing_store_canvas_.get(),
offset_rect.origin());
@@ -906,7 +917,11 @@ void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) {
}
// Copy the damaged rect from the transport bitmap to the backing store.
- BlitCanvasToCanvas(backing_store_canvas_.get(), rect,
+ gfx::Rect dest_rect = rect;
+#if defined(OS_MACOSX)
+ FlipRectVerticallyWithHeight(&dest_rect, plugin_rect_.height());
+#endif
+ BlitCanvasToCanvas(backing_store_canvas_.get(), dest_rect,
transport_store_canvas_.get(), rect.origin());
backing_store_painted_ = backing_store_painted_.Union(rect);
}