From 24e863243cc6e12da33425f8401f0920170d7062 Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Fri, 27 Mar 2009 16:21:25 +0000 Subject: We need to set the clipping region of the HDC passed in to a windowless flash plugin instance in NPP_HandleEvent for WM_PAINT. The windowless flash plugin instance queries the clipping region of the DC and on not finding it proceeds to paint the plugin window rect, which causes unnecessary CPU spikes. This fixes bug http://code.google.com/p/chromium/issues/detail?id=8835, where the plugin process would consume CPU even when we scrolled down to the static video images. With this fix the CPU usage for windowless flash plugins is on par with Firefox. Added a uitest which validates whether the hdc passed in to HandleEvent for WM_PAINT has a valid clipping region. Bug=8835 Review URL: http://codereview.chromium.org/53106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12651 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/plugin/webplugin_proxy.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'chrome') diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 38310fb..34bdb92 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -322,9 +322,16 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { rect.x(), rect.y(), SRCCOPY); } + RECT clip_rect = rect.ToRECT(); + HRGN clip_region = CreateRectRgnIndirect(&clip_rect); + SelectClipRgn(windowless_hdc_, clip_region); + // Before we send the invalidate, paint so that renderer uses the updated // bitmap. delegate_->Paint(windowless_hdc_, offset_rect); + + SelectClipRgn(windowless_hdc_, NULL); + DeleteObject(clip_region); } void WebPluginProxy::UpdateGeometry( -- cgit v1.1