summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 17:17:08 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 17:17:08 +0000
commit49d198eaf7bd7b118fb46b97cc790fdc7b380eee (patch)
treefb0012720373f1e286e06f8cd0595d44c3452d30 /ui
parent83da5db25bfd45670eca38f0eb9d6a780090447b (diff)
downloadchromium_src-49d198eaf7bd7b118fb46b97cc790fdc7b380eee.zip
chromium_src-49d198eaf7bd7b118fb46b97cc790fdc7b380eee.tar.gz
chromium_src-49d198eaf7bd7b118fb46b97cc790fdc7b380eee.tar.bz2
rename getBitmapDC to beginPlatformPaint and add calls to endPlatformPaint
This takes a step toward unifying the platform device interface between Windows and Linux and helps to make VectorPlatformDeviceSkia have less ifdefs. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6677142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/blit.cc26
-rw-r--r--ui/views/widget/native_widget_win.cc3
2 files changed, 11 insertions, 18 deletions
diff --git a/ui/gfx/blit.cc b/ui/gfx/blit.cc
index 9f57e68..76411a3 100644
--- a/ui/gfx/blit.cc
+++ b/ui/gfx/blit.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -91,24 +91,13 @@ void BlitContextToContext(NativeDrawingContext dst_context,
#endif
}
-static NativeDrawingContext GetContextFromCanvas(
- skia::PlatformCanvas *canvas) {
- skia::PlatformDevice& device = canvas->getTopPlatformDevice();
-#if defined(OS_WIN)
- return device.getBitmapDC();
-#elif defined(OS_MACOSX)
- return device.GetBitmapContext();
-#else // Linux, BSD, others
- return device.beginPlatformPaint();
-#endif
-}
-
void BlitContextToCanvas(skia::PlatformCanvas *dst_canvas,
const Rect& dst_rect,
NativeDrawingContext src_context,
const Point& src_origin) {
- BlitContextToContext(GetContextFromCanvas(dst_canvas), dst_rect,
+ BlitContextToContext(dst_canvas->beginPlatformPaint(), dst_rect,
src_context, src_origin);
+ dst_canvas->endPlatformPaint();
}
void BlitCanvasToContext(NativeDrawingContext dst_context,
@@ -116,15 +105,18 @@ void BlitCanvasToContext(NativeDrawingContext dst_context,
skia::PlatformCanvas *src_canvas,
const Point& src_origin) {
BlitContextToContext(dst_context, dst_rect,
- GetContextFromCanvas(src_canvas), src_origin);
+ src_canvas->beginPlatformPaint(), src_origin);
+ src_canvas->endPlatformPaint();
}
void BlitCanvasToCanvas(skia::PlatformCanvas *dst_canvas,
const Rect& dst_rect,
skia::PlatformCanvas *src_canvas,
const Point& src_origin) {
- BlitContextToContext(GetContextFromCanvas(dst_canvas), dst_rect,
- GetContextFromCanvas(src_canvas), src_origin);
+ BlitContextToContext(dst_canvas->beginPlatformPaint(), dst_rect,
+ src_canvas->beginPlatformPaint(), src_origin);
+ src_canvas->endPlatformPaint();
+ dst_canvas->endPlatformPaint();
}
#if defined(OS_WIN)
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index 0d2d998..e9c2d2f 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -460,11 +460,12 @@ void NativeWidgetWin::OnPaint(HDC dc) {
GetWindowRect(hwnd(), &wr);
SIZE size = {wr.right - wr.left, wr.bottom - wr.top};
POINT position = {wr.left, wr.top};
- HDC dib_dc = window_contents_->getTopPlatformDevice().getBitmapDC();
+ HDC dib_dc = window_contents_->beginPlatformPaint();
POINT zero = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0, 125, AC_SRC_ALPHA};
UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero,
RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
+ window_contents_->endPlatformPaint();
} else {
scoped_ptr<gfx::CanvasPaint> canvas(
gfx::CanvasPaint::CreateCanvasPaint(hwnd()));