Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1679)

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 7215030: Don't copy the Graphics2D when binding a new one. This brings the (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (revision 89742)
+++ webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (working copy)
@@ -474,19 +474,42 @@
CGContextDrawImage(canvas, bitmap_rect, image);
CGContextRestoreGState(canvas);
#else
+ SkRect sk_plugin_rect = SkRect::MakeXYWH(
+ SkIntToScalar(plugin_rect.origin().x()),
+ SkIntToScalar(plugin_rect.origin().y()),
+ SkIntToScalar(plugin_rect.width()),
+ SkIntToScalar(plugin_rect.height()));
+ canvas->save();
+ canvas->clipRect(sk_plugin_rect);
+
+ if (instance()->IsFullPagePlugin()) {
+ // When we're resizing a window with a full-frame plugin, the plugin may
+ // not yet have bound a new device, which will leave parts of the
+ // background exposed if the window is getting larger. We want this to
+ // show white (typically less jarring) rather than black or uninitialized.
+ // We don't do this for non-full-frame plugins since we specifically want
+ // the page background to show through.
+ canvas->save();
+ SkRect image_data_rect = SkRect::MakeXYWH(
+ SkIntToScalar(plugin_rect.origin().x()),
+ SkIntToScalar(plugin_rect.origin().y()),
+ SkIntToScalar(image_data_->width()),
+ SkIntToScalar(image_data_->height()));
+ canvas->clipRect(image_data_rect, SkRegion::kDifference_Op);
+
+ SkPaint paint;
+ paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ paint.setColor(SK_ColorWHITE);
+ canvas->drawRect(sk_plugin_rect, paint);
+ canvas->restore();
+ }
+
SkPaint paint;
if (is_always_opaque_) {
// When we know the device is opaque, we can disable blending for slightly
// more optimized painting.
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
}
-
- canvas->save();
- SkRect clip_rect = SkRect::MakeXYWH(SkIntToScalar(plugin_rect.origin().x()),
- SkIntToScalar(plugin_rect.origin().y()),
- SkIntToScalar(plugin_rect.width()),
- SkIntToScalar(plugin_rect.height()));
- canvas->clipRect(clip_rect);
canvas->drawBitmap(backing_bitmap,
SkIntToScalar(plugin_rect.x()),
SkIntToScalar(plugin_rect.y()),
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698