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

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

Issue 159190: Refactor blits (Closed)
Patch Set: remove ScopedNativeDrawingContext Created 11 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 | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index 265551a5aae1683c136b7ec84b291f1d51fce33f..d107a6d4b977da0c64ed6bf81cf41950183c6aa2 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/gfx/blit.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/stats_counters.h"
@@ -516,24 +517,19 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
DCHECK_EQ(err, NPERR_NO_ERROR);
}
+ gfx::Rect pixmap_draw_rect = draw_rect;
+ pixmap_draw_rect.Offset(offset_x, offset_y);
+
gfx::Rect pixmap_rect(0, 0,
- draw_rect.x() + offset_x + draw_rect.width(),
- draw_rect.y() + offset_y + draw_rect.height());
+ pixmap_draw_rect.right(),
+ pixmap_draw_rect.bottom());
EnsurePixmapAtLeastSize(pixmap_rect.width(), pixmap_rect.height());
// Copy the current image into the pixmap, so the plugin can draw over
// this background.
cairo_t* cairo = gdk_cairo_create(pixmap_);
- double surface_x = -offset_x;
- double surface_y = -offset_y;
- cairo_user_to_device(context, &surface_x, &surface_y);
- cairo_set_source_surface(cairo, cairo_get_target(context),
- -surface_x, -surface_y);
- cairo_rectangle(cairo, draw_rect.x() + offset_x, draw_rect.y() + offset_y,
- draw_rect.width(), draw_rect.height());
- cairo_clip(cairo);
- cairo_paint(cairo);
+ BlitContextToContext(cairo, pixmap_draw_rect, context, draw_rect.origin());
cairo_destroy(cairo);
// Construct the paint message, targeting the pixmap.
@@ -542,10 +538,10 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
event.type = GraphicsExpose;
event.display = GDK_DISPLAY();
event.drawable = GDK_PIXMAP_XID(pixmap_);
- event.x = draw_rect.x() + offset_x;
- event.y = draw_rect.y() + offset_y;
- event.width = draw_rect.width();
- event.height = draw_rect.height();
+ event.x = pixmap_draw_rect.x();
+ event.y = pixmap_draw_rect.y();
+ event.width = pixmap_draw_rect.width();
+ event.height = pixmap_draw_rect.height();
// Tell the plugin to paint into the pixmap.
static StatsRate plugin_paint("Plugin.Paint");
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698