diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 00:46:22 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 00:46:22 +0000 |
commit | e82fafcd66be3f5c0cef28ee0c08ae4f9e0338b4 (patch) | |
tree | fa45c0c69e9e28524867e4c93d65d323dcf9c14a /chrome/plugin/webplugin_proxy.cc | |
parent | 4dc3cca352f08bfe126bb83c5a7030965538b7a0 (diff) | |
download | chromium_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 'chrome/plugin/webplugin_proxy.cc')
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 94f2b2f..1356c61 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -372,6 +372,9 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { #elif defined(OS_MACOSX) if (!windowless_context_.get()) return; +#elif defined(OS_LINUX) + if (!windowless_canvas_.get()) + return; #endif // Clear the damaged area so that if the plugin doesn't paint there we won't @@ -415,8 +418,20 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { delegate_->Paint(windowless_context_, rect); CGContextRestoreGState(windowless_context_); #else - // TODO(port): windowless painting. - NOTIMPLEMENTED(); + cairo_t* cairo = + windowless_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_save(cairo); + cairo_rectangle(cairo, rect.x(), rect.y(), rect.width(), rect.height()); + cairo_clip(cairo); + if (background_canvas_.get()) { + cairo_t *background = + background_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_set_source_surface(cairo, cairo_get_target(background), 0, 0); + cairo_paint(cairo); + } + cairo_translate(cairo, -delegate_->GetRect().x(), -delegate_->GetRect().y()); + delegate_->Paint(cairo, offset_rect); + cairo_restore(cairo); #endif } @@ -558,13 +573,21 @@ void WebPluginProxy::SetWindowlessBuffer( } #elif defined (OS_LINUX) void WebPluginProxy::UpdateTransform() { - NOTIMPLEMENTED(); } void WebPluginProxy::SetWindowlessBuffer( const TransportDIB::Handle& windowless_buffer, const TransportDIB::Handle& background_buffer) { - NOTIMPLEMENTED(); + int width = delegate_->GetRect().width(); + int height = delegate_->GetRect().height(); + windowless_dib_.reset(TransportDIB::Map(windowless_buffer)); + windowless_canvas_.reset(windowless_dib_->GetPlatformCanvas(width, height)); + background_dib_.reset(TransportDIB::Map(background_buffer)); + if (background_dib_.get()) { + background_canvas_.reset(background_dib_->GetPlatformCanvas(width, height)); + } else { + background_canvas_.reset(); + } } #endif |