summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/plugin/webplugin_proxy.cc8
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc12
2 files changed, 13 insertions, 7 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 273cd95..ac04589 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -366,11 +366,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
// sense, so this should only be used for pointer comparisons.
CGContextRef saved_context_weak = windowless_context_.get();
- if (!background_context_.get()) {
- CGContextSetFillColorWithColor(windowless_context_,
- CGColorGetConstantColor(kCGColorBlack));
- CGContextFillRect(windowless_context_, rect.ToCGRect());
- } else {
+ if (background_context_.get()) {
scoped_cftyperef<CGImageRef> image(
CGBitmapContextCreateImage(background_context_));
CGRect source_rect = rect.ToCGRect();
@@ -379,6 +375,8 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
scoped_cftyperef<CGImageRef> sub_image(
CGImageCreateWithImageInRect(image, source_rect));
CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
+ } else {
+ CGContextClearRect(windowless_context_, rect.ToCGRect());
}
CGContextClipToRect(windowless_context_, rect.ToCGRect());
delegate_->Paint(windowless_context_, rect);
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 2d27522..e11c848 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -493,10 +493,15 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
if (!backing_store_canvas_.get() ||
(window_rect.width() != backing_store_canvas_->getDevice()->width() ||
window_rect.height() != backing_store_canvas_->getDevice()->height()))
- {
+ {
bitmaps_changed = true;
+ bool needs_background_store = transparent_;
#if defined(OS_MACOSX)
+ // We don't support transparency under QuickDraw, and CoreGraphics
+ // preserves transparency information (and does the compositing itself)
+ // so plugins don't need access to the page background.
+ needs_background_store = false;
if (backing_store_.get()) {
// ResetWindowlessBitmaps inserts the old TransportDIBs into
// old_transport_dibs_ using the backing store's file descriptor as
@@ -514,7 +519,7 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
if (!window_rect.IsEmpty()) {
if (!CreateBitmap(&backing_store_, &backing_store_canvas_) ||
!CreateBitmap(&transport_store_, &transport_store_canvas_) ||
- (transparent_ &&
+ (needs_background_store &&
!CreateBitmap(&background_store_, &background_store_canvas_))) {
DCHECK(false);
ResetWindowlessBitmaps();
@@ -1239,6 +1244,9 @@ void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) {
gfx::Rect dest_rect = rect;
#if defined(OS_MACOSX)
FlipRectVerticallyWithHeight(&dest_rect, plugin_rect_.height());
+ gfx::NativeDrawingContext backing_context =
+ backing_store_canvas_.get()->getTopPlatformDevice().GetBitmapContext();
+ CGContextClearRect(backing_context, dest_rect.ToCGRect());
#endif
BlitCanvasToCanvas(backing_store_canvas_.get(), dest_rect,
transport_store_canvas_.get(), rect.origin());