summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 00:46:22 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 00:46:22 +0000
commite82fafcd66be3f5c0cef28ee0c08ae4f9e0338b4 (patch)
treefa45c0c69e9e28524867e4c93d65d323dcf9c14a /webkit
parent4dc3cca352f08bfe126bb83c5a7030965538b7a0 (diff)
downloadchromium_src-e82fafcd66be3f5c0cef28ee0c08ae4f9e0338b4.zip
chromium_src-e82fafcd66be3f5c0cef28ee0c08ae4f9e0338b4.tar.gz
chromium_src-e82fafcd66be3f5c0cef28ee0c08ae4f9e0338b4.tar.bz2
linux: add windowless plugin plumbing
Review URL: http://codereview.chromium.org/159128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/plugin_host.cc2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_gtk.cc16
2 files changed, 10 insertions, 8 deletions
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index 40b2e1e..90ffd51 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -610,8 +610,6 @@ void NPN_InvalidateRect(NPP id, NPRect *invalidRect) {
::InvalidateRect(plugin->window_handle(), &rect, FALSE);
return;
}
-#elif defined(OS_LINUX)
- NOTIMPLEMENTED();
#endif
gfx::Rect rect(invalidRect->left,
invalidRect->top,
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index 5afa911..265551a 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
@@ -374,7 +374,8 @@ void WebPluginDelegateImpl::EnsurePixmapAtLeastSize(int width, int height) {
// |sys_visual| is owned by gdk; we shouldn't free it.
GdkVisual* sys_visual = gdk_visual_get_system();
pixmap_ = gdk_pixmap_new(NULL, // use width/height/depth params
- width, height, sys_visual->depth);
+ std::max(1, width), std::max(1, height),
+ sys_visual->depth);
GdkColormap* colormap = gdk_colormap_new(gdk_visual_get_system(),
FALSE);
gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap_), colormap);
@@ -383,17 +384,15 @@ void WebPluginDelegateImpl::EnsurePixmapAtLeastSize(int width, int height) {
#ifdef DEBUG_RECTANGLES
namespace {
-// Draw a rectangle on a Cairo surface.
+// Draw a rectangle on a Cairo context.
// Useful for debugging various rectangles involved in drawing plugins.
-void DrawDebugRectangle(cairo_surface_t* surface,
+void DrawDebugRectangle(cairo_t* cairo,
const gfx::Rect& rect,
float r, float g, float b) {
- cairo_t* cairo = cairo_create(surface);
cairo_set_source_rgba(cairo, r, g, b, 0.5);
cairo_rectangle(cairo, rect.x(), rect.y(),
rect.width(), rect.height());
cairo_stroke(cairo);
- cairo_destroy(cairo);
}
} // namespace
@@ -526,8 +525,11 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
// 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),
- offset_x, offset_y);
+ -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);
@@ -551,6 +553,7 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
NPError err = instance()->NPP_HandleEvent(&np_event);
DCHECK_EQ(err, NPERR_NO_ERROR);
+ cairo_save(context);
// Now copy the rendered image pixmap back into the drawing buffer.
gdk_cairo_set_source_pixmap(context, pixmap_, -offset_x, -offset_y);
cairo_rectangle(context, draw_rect.x(), draw_rect.y(),
@@ -565,6 +568,7 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
// Drawing rect = red.
DrawDebugRectangle(context, draw_rect, 1, 0, 0);
#endif
+ cairo_restore(context);
}
void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) {