diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 03:47:11 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 03:47:11 +0000 |
commit | 51780eba10f8100475f0983e7b465b6b0211b1d9 (patch) | |
tree | 793cacb92a887bb44b673482bd4de35cd58ebd81 | |
parent | 3abd6bbdfb0a6d8367a2c56d4846e3d70d9da660 (diff) | |
download | chromium_src-51780eba10f8100475f0983e7b465b6b0211b1d9.zip chromium_src-51780eba10f8100475f0983e7b465b6b0211b1d9.tar.gz chromium_src-51780eba10f8100475f0983e7b465b6b0211b1d9.tar.bz2 |
Fix the painting problem with Stree View and Flash 10. After the size of the plugin changes, we generate a new backing store. Flash 9 invalidates the rectangle, but Flash 10 doesn't. As a result we paint from a blank backing store.
The fix is to keep track of which part of the backing store has been painted into by the plugin, and if the renderer tries to paint an area that falls outside of it, do a synchronous paint.
Also get rid of first_paint_, as it was introduced during a failed attempt to make plugin loading asynchronous.
Review URL: http://codereview.chromium.org/10792
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6128 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 20 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.h | 3 |
2 files changed, 9 insertions, 14 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 13b06a3..c688817 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -138,7 +138,6 @@ WebPluginDelegateProxy::WebPluginDelegateProxy(const std::string& mime_type, clsid_(clsid), plugin_(NULL), windowless_(false), - first_paint_(true), npobject_(NULL), send_deferred_update_geometry_(false), visible_(false), @@ -394,6 +393,7 @@ void WebPluginDelegateProxy::ResetWindowlessBitmaps() { transport_store_canvas_.reset(); background_store_.reset(); background_store_canvas_.release(); + backing_store_painted_ = gfx::Rect(); } bool WebPluginDelegateProxy::CreateBitmap( @@ -423,14 +423,9 @@ void WebPluginDelegateProxy::Paint(HDC hdc, const gfx::Rect& damaged_rect) { return; } - // No paint events for windowed plugins. However, if it is the first paint - // we don't know yet whether the plugin is windowless or not, so we have to - // send the event. - if (!windowless_ && !first_paint_) { - // TODO(maruel): That's not true for printing and thumbnail capture. - // We shall use PrintWindow() to draw the window. + // No paint events for windowed plugins. + if (!windowless_) return; - } // We got a paint before the plugin's coordinates, so there's no buffer to // copy from. @@ -450,14 +445,13 @@ void WebPluginDelegateProxy::Paint(HDC hdc, const gfx::Rect& damaged_rect) { rect.width(), rect.height(), hdc, rect.x(), rect.y(), SRCCOPY); } - if (first_paint_ || background_changed) { - gfx::Rect offset_rect = rect; - offset_rect.Offset(-plugin_rect_.x(), -plugin_rect_.y()); + gfx::Rect offset_rect = rect; + offset_rect.Offset(-plugin_rect_.x(), -plugin_rect_.y()); + if (background_changed || !backing_store_painted_.Contains(offset_rect)) { Send(new PluginMsg_Paint(instance_id_, offset_rect)); CopyFromTransportToBacking(offset_rect); } - first_paint_ = false; HDC backing_hdc = backing_store_canvas_->getTopPlatformDevice().getBitmapDC(); BitBlt(hdc, rect.x(), rect.y(), rect.width(), rect.height(), backing_hdc, rect.x()-plugin_rect_.x(), rect.y()-plugin_rect_.y(), SRCCOPY); @@ -702,9 +696,9 @@ void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) { // Copy the damaged rect from the transport bitmap to the backing store. HDC backing = backing_store_canvas_->getTopPlatformDevice().getBitmapDC(); HDC transport = transport_store_canvas_->getTopPlatformDevice().getBitmapDC(); - BitBlt(backing, rect.x(), rect.y(), rect.width(), rect.height(), transport, rect.x(), rect.y(), SRCCOPY); + backing_store_painted_ = backing_store_painted_.Union(rect); } void WebPluginDelegateProxy::OnHandleURLRequest( diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index a11d083..392682c 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -150,7 +150,6 @@ class WebPluginDelegateProxy : public WebPluginDelegate, RenderView* render_view_; WebPlugin* plugin_; bool windowless_; - bool first_paint_; scoped_refptr<PluginChannelHost> channel_host_; std::string mime_type_; std::string clsid_; @@ -188,6 +187,8 @@ class WebPluginDelegateProxy : public WebPluginDelegate, scoped_ptr<gfx::PlatformCanvasWin> transport_store_canvas_; scoped_ptr<base::SharedMemory> background_store_; scoped_ptr<gfx::PlatformCanvasWin> background_store_canvas_; + // This lets us know which portion of the backing store has been painted into. + gfx::Rect backing_store_painted_; DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); }; |