Commit fb10ec5b authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

[Aura] Support transparent webkit.

Support turning on webkit transparency by setting a background image.
- Update RenderWidget::PaintRect to handle background transparency;
- Update BackingStoreSkia::PaintToBackingStore to handle webkit transparency;
- Turn on compositing of RenderWidgetHostViewAura's layer when we set a background with transparency;

BUG=98311
TEST=Verify when applist change (chromium:98308) is in.


Review URL: http://codereview.chromium.org/8369006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106943 0039d316-1c4b-4281-b951-d872f2087c98
parent b4e98965
......@@ -60,6 +60,9 @@ void BackingStoreSkia::PaintToBackingStore(
if (!dib)
return;
SkPaint copy_paint;
copy_paint.setXfermodeMode(SkXfermode::kSrc_Mode);
SkBitmap sk_bitmap;
sk_bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
sk_bitmap.setPixels(dib->memory());
......@@ -73,7 +76,7 @@ void BackingStoreSkia::PaintToBackingStore(
SkRect dstrect = SkRect::MakeXYWH(
SkIntToScalar(copy_rect.x()), SkIntToScalar(copy_rect.y()),
SkIntToScalar(w), SkIntToScalar(h));
canvas_.get()->drawBitmapRect(sk_bitmap, &srcrect, dstrect);
canvas_.get()->drawBitmapRect(sk_bitmap, &srcrect, dstrect, &copy_paint);
}
}
......
......@@ -15,13 +15,13 @@
#include "ui/aura/hit_test.h"
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/compositor/layer.h"
#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
#include "base/bind.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/renderer_host/accelerated_surface_container_linux.h"
#include "content/common/gpu/gpu_messages.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/gl/gl_bindings.h"
#endif
......@@ -237,6 +237,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) {
void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
RenderWidgetHostView::SetBackground(background);
host_->SetBackground(background);
window_->layer()->SetFillsBoundsOpaquely(background.isOpaque());
}
#if defined(OS_POSIX)
......
......@@ -534,8 +534,19 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
paint.setShader(shader)->unref();
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
// Use kSrc_Mode to handle background_ transparency properly.
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
// Canvas could contain multiple update rects. Clip to given rect so that
// we don't accidentally clear other update rects.
canvas->save();
SkRect clip;
clip.set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y()),
SkIntToScalar(rect.right()), SkIntToScalar(rect.bottom()));
canvas->clipRect(clip);
canvas->drawPaint(paint);
canvas->restore();
}
// First see if this rect is a plugin that can paint itself faster.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment