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

Unified Diff: webkit/glue/plugins/pepper_plugin_instance.cc

Issue 2834052: Avoid flashing when resizing plugins that use PaintManager. Copy the bitmap ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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/glue/plugins/pepper_device_context_2d.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/pepper_plugin_instance.cc
===================================================================
--- webkit/glue/plugins/pepper_plugin_instance.cc (revision 52764)
+++ webkit/glue/plugins/pepper_plugin_instance.cc (working copy)
@@ -314,6 +314,24 @@
if (device_2d) {
if (!device_2d->BindToInstance(this))
return false; // Can't bind to more than one instance.
+
+ if (device_context_2d_.get()) {
+ // Start the new image with the content of the old image until the plugin
+ // repaints.
+ const SkBitmap* old_backing_bitmap =
+ device_context_2d_->image_data()->GetMappedBitmap();
+ SkRect old_size = SkRect::MakeWH(
+ SkScalar(static_cast<float>(old_backing_bitmap->width())),
+ SkScalar(static_cast<float>(old_backing_bitmap->height())));
+
+ SkCanvas canvas(*device_2d->image_data()->GetMappedBitmap());
+ canvas.drawBitmap(*old_backing_bitmap, 0, 0);
+
+ // Fill in any extra space with white.
+ canvas.clipRect(old_size, SkRegion::kDifference_Op);
+ canvas.drawARGB(255, 255, 255, 255);
+ }
+
device_context_2d_ = device_2d;
// BindToInstance will have invalidated the plugin if necessary.
}
« no previous file with comments | « webkit/glue/plugins/pepper_device_context_2d.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698