diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:18:04 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:18:04 +0000 |
commit | 850dc30e30f7166990835195f594556b1de3716b (patch) | |
tree | 1d01e5f899bed779963dac5ac08a4ee77116ae2e /chrome/renderer/webplugin_delegate_proxy.cc | |
parent | 2227422a7ddc1bdd9d6f37644a4d3da8fcea087c (diff) | |
download | chromium_src-850dc30e30f7166990835195f594556b1de3716b.zip chromium_src-850dc30e30f7166990835195f594556b1de3716b.tar.gz chromium_src-850dc30e30f7166990835195f594556b1de3716b.tar.bz2 |
linux: implement the sad plugin
This required moving the sad plugin resource out of the Windows-specific code.
Note that it doesn't display right yet, since the place to display is covered
by the GtkSocket that used to host the plugin. But that is a separate issue.
(I had it draw to the side to verify the image was correctly getting loaded.)
BUG=16158
Review URL: http://codereview.chromium.org/155262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 8314b71..d2b7906 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -18,7 +18,6 @@ #include "base/string_util.h" #include "base/gfx/size.h" #include "base/gfx/native_widget_types.h" -#include "chrome/app/chrome_dll_resource.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" @@ -28,6 +27,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "grit/generated_resources.h" +#include "grit/renderer_resources.h" #include "net/base/mime_util.h" #include "printing/native_metafile.h" #include "webkit/api/public/WebCursorInfo.h" @@ -855,7 +855,6 @@ void WebPluginDelegateProxy::OnGetCPBrowsingContext(uint32* context) { void WebPluginDelegateProxy::PaintSadPlugin(gfx::NativeDrawingContext hdc, const gfx::Rect& rect) { -#if defined(OS_WIN) const int width = plugin_rect_.width(); const int height = plugin_rect_.height(); @@ -878,11 +877,25 @@ void WebPluginDelegateProxy::PaintSadPlugin(gfx::NativeDrawingContext hdc, std::max(0, (height - sad_plugin_->height())/2)); } - canvas.getTopPlatformDevice().drawToHDC( - hdc, plugin_rect_.x(), plugin_rect_.y(), NULL); + skia::PlatformDevice& device = canvas.getTopPlatformDevice(); + +#if defined(OS_WIN) + device.drawToHDC(hdc, plugin_rect_.x(), plugin_rect_.y(), NULL); +#elif defined(OS_LINUX) + // Though conceptually we've been handed a cairo_surface_t* and we + // could've just hooked up the canvas to draw directly onto it, our + // canvas implementation currently uses cairo as a dumb pixel buffer + // and would have done the following copy anyway. + // TODO(evanm): revisit when we have printing hooked up, as that might + // change our usage of cairo. + cairo_t* cairo = cairo_create(hdc); + cairo_surface_t* source_surface = device.beginPlatformPaint(); + cairo_set_source_surface(cairo, source_surface, plugin_rect_.x(), plugin_rect_.y()); + cairo_paint(cairo); + cairo_destroy(cairo); + // We have no endPlatformPaint() on the Linux PlatformDevice. + // The surface is owned by the device. #else - // TODO(port): it ought to be possible to refactor this to be shared between - // platforms. It's just the final drawToHDC that kills us. NOTIMPLEMENTED(); #endif } |