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/renderer | |
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/renderer')
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 45a98bf..524b908 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -476,13 +476,8 @@ bool WebPluginDelegateProxy::CreateBitmap( const size_t stride = skia::PlatformCanvas::StrideForWidth(width); const size_t size = stride * height; #if defined(OS_LINUX) - static unsigned long max_size = 0; - if (max_size == 0) { - std::string contents; - file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); - max_size = strtoul(contents.c_str(), NULL, 0); - } - if (size > max_size) + memory->reset(TransportDIB::Create(size, 0)); + if (!memory->get()) return false; #endif #if defined(OS_MACOSX) @@ -543,7 +538,19 @@ void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context, CGImageCreateWithImageInRect(background_image, offset_rect.ToCGRect())); CGContextDrawImage(context, rect.ToCGRect(), sub_image); #else - NOTIMPLEMENTED(); + cairo_t *cairo = + background_store_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_save(cairo); + double surface_x = plugin_rect_.x(); + double surface_y = plugin_rect_.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, offset_rect.x(), offset_rect.y(), + offset_rect.width(), offset_rect.height()); + cairo_clip(cairo); + cairo_paint(cairo); + cairo_restore(cairo); #endif } @@ -565,7 +572,15 @@ void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context, CGImageCreateWithImageInRect(backing_image, offset_rect.ToCGRect())); CGContextDrawImage(context, rect.ToCGRect(), sub_image); #else - NOTIMPLEMENTED(); + cairo_save(context); + cairo_t *cairo = + backing_store_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_set_source_surface(context, cairo_get_target(cairo), + plugin_rect_.x(), plugin_rect_.y()); + cairo_rectangle(context, rect.x(), rect.y(), rect.width(), rect.height()); + cairo_paint(context); + cairo_clip(context); + cairo_restore(context); #endif if (invalidate_pending_) { @@ -619,11 +634,11 @@ bool WebPluginDelegateProxy::BackgroundChanged( if (memcmp(hdc_row_start, canvas_row_start, row_byte_size) != 0) return true; } - + return false; #else NOTIMPLEMENTED(); + return true; #endif - return false; } void WebPluginDelegateProxy::Print(gfx::NativeDrawingContext context) { @@ -932,10 +947,14 @@ void WebPluginDelegateProxy::PaintSadPlugin(gfx::NativeDrawingContext context, skia::PlatformDevice& device = canvas.getTopPlatformDevice(); device.drawToHDC(context, plugin_rect_.x(), plugin_rect_.y(), NULL); #elif defined(OS_LINUX) + cairo_save(context); cairo_t* cairo = canvas.getTopPlatformDevice().beginPlatformPaint(); - cairo_set_source_surface(cairo, cairo_get_target(context), + cairo_set_source_surface(context, cairo_get_target(cairo), plugin_rect_.x(), plugin_rect_.y()); - cairo_paint(cairo); + cairo_rectangle(context, rect.x(), rect.y(), rect.width(), rect.height()); + cairo_clip(context); + cairo_paint(context); + cairo_restore(context); // We have no endPlatformPaint() on the Linux PlatformDevice. // The cairo_t* is owned by the device. #elif defined(OS_MACOSX) @@ -967,8 +986,16 @@ void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) { CGImageCreateWithImageInRect(image, rect.ToCGRect())); CGContextDrawImage(backing, rect.ToCGRect(), sub_image); #else - // TODO(port): probably some new code in TransportDIB should go here. - NOTIMPLEMENTED(); + cairo_t *cairo = + backing_store_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_save(cairo); + cairo_t *transport = + transport_store_canvas_->getTopPlatformDevice().beginPlatformPaint(); + cairo_set_source_surface(cairo, cairo_get_target(transport), 0, 0); + cairo_rectangle(cairo, rect.x(), rect.y(), rect.width(), rect.height()); + cairo_clip(cairo); + cairo_paint(cairo); + cairo_restore(cairo); #endif backing_store_painted_ = backing_store_painted_.Union(rect); } |