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

Unified Diff: chrome/plugin/webplugin_proxy.cc

Issue 159128: linux: add windowless plugin plumbing (Closed)
Patch Set: address review comments 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/plugin/webplugin_proxy.h ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/webplugin_proxy.cc
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 94f2b2f05b35b845fc36be356b8b64a977d4f873..1356c61e530385d4c3fa87731065ede4af94942a 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
« no previous file with comments | « chrome/plugin/webplugin_proxy.h ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698