From ca4847f0a19f9565b6ca19fa47729bb746f5f736 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Fri, 24 Sep 2010 05:39:15 +0000 Subject: Add some optimizations to plugin painting. The simplest one is to disable blending when the plugin is opaque. The more complicated one is to bypass webkit painting the background of plugins when we know the plugin to be always on top and also opaque. The always on top flag is currently set by a new "Private2" API. Bypassing WebKit makes animations faster. This is a re-land of the previous patch with a trivial compilation fix. This also adds a clip rect to the GetBitmap... function so we can properly handle plugins in nested iframes with proper clipping. BUG=none TEST=none Original review URL: http://codereview.chromium.org/3421030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60426 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/pepper_plugin_delegate_impl.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'chrome/renderer/pepper_plugin_delegate_impl.cc') diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc index 7ca9d4e..31b89ff 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.cc +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc @@ -53,6 +53,10 @@ class PlatformImage2DImpl : public pepper::PluginDelegate::PlatformImage2D { return reinterpret_cast(dib_.get()); } + virtual TransportDIB* GetTransportDIB() const { + return dib_.get(); + } + private: int width_; int height_; @@ -520,6 +524,22 @@ void PepperPluginDelegateImpl::ViewFlushedPaint() { } } +bool PepperPluginDelegateImpl::GetBitmapForOptimizedPluginPaint( + const gfx::Rect& paint_bounds, + TransportDIB** dib, + gfx::Rect* location, + gfx::Rect* clip) { + for (std::set::iterator i = + active_instances_.begin(); + i != active_instances_.end(); ++i) { + pepper::PluginInstance* instance = *i; + if (instance->GetBitmapForOptimizedPluginPaint( + paint_bounds, dib, location, clip)) + return true; + } + return false; +} + void PepperPluginDelegateImpl::InstanceCreated( pepper::PluginInstance* instance) { active_instances_.insert(instance); -- cgit v1.1