summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/views/list_background.h4
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc4
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc4
-rw-r--r--chrome/browser/views/tabs/native_view_photobooth_win.cc4
-rw-r--r--gfx/canvas.h8
-rw-r--r--gfx/canvas_skia.cc8
-rw-r--r--gfx/canvas_skia.h2
-rw-r--r--views/controls/menu/menu_item_view_win.cc4
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc8
-rw-r--r--views/controls/menu/menu_separator_win.cc4
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc4
-rw-r--r--views/window/dialog_client_view.cc4
12 files changed, 38 insertions, 20 deletions
diff --git a/chrome/browser/views/list_background.h b/chrome/browser/views/list_background.h
index fb10067..5c54f6e 100644
--- a/chrome/browser/views/list_background.h
+++ b/chrome/browser/views/list_background.h
@@ -22,10 +22,10 @@ class ListBackground : public views::Background {
virtual ~ListBackground() {}
virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
RECT native_lb = view->GetLocalBounds(true).ToRECT();
gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
private:
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index d23a19f..9ee6485e 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -135,12 +135,12 @@ void FileDisplayArea::SetFile(const FilePath& file_path) {
}
void FileDisplayArea::Paint(gfx::Canvas* canvas) {
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
RECT rect = { 0, 0, width(), height() };
gfx::NativeTheme::instance()->PaintTextField(
dc, EP_EDITTEXT, ETS_READONLY, 0, &rect,
skia::SkColorToCOLORREF(text_field_background_color_), true, true);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
// Mirror left point for icon_bounds_ to draw icon in RTL locales correctly.
canvas->DrawBitmapInt(default_folder_icon_,
MirroredLeftPointForRect(icon_bounds_),
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc
index d120354..0b1ab97 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -96,12 +96,12 @@ void FontDisplayView::SetFontType(const std::wstring& font_name,
}
void FontDisplayView::Paint(gfx::Canvas* canvas) {
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
RECT rect = { 0, 0, width(), height() };
gfx::NativeTheme::instance()->PaintTextField(
dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE),
true, true);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
void FontDisplayView::Layout() {
diff --git a/chrome/browser/views/tabs/native_view_photobooth_win.cc b/chrome/browser/views/tabs/native_view_photobooth_win.cc
index 1eb3125..d749ea0 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_win.cc
+++ b/chrome/browser/views/tabs/native_view_photobooth_win.cc
@@ -100,7 +100,7 @@ void NativeViewPhotoboothWin::PaintScreenshotIntoCanvas(
// Transfer the contents of the layered capture window to the screen-shot
// canvas' DIB.
- HDC target_dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC target_dc = canvas->BeginPlatformPaint();
HDC source_dc = GetDC(current_hwnd_);
RECT window_rect = {0};
GetWindowRect(current_hwnd_, &window_rect);
@@ -113,7 +113,7 @@ void NativeViewPhotoboothWin::PaintScreenshotIntoCanvas(
target_bounds.x(), target_bounds.y(), target_bounds.width(),
target_bounds.height());
ReleaseDC(current_hwnd_, source_dc);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/gfx/canvas.h b/gfx/canvas.h
index 90495cd..430a88f 100644
--- a/gfx/canvas.h
+++ b/gfx/canvas.h
@@ -184,6 +184,14 @@ class Canvas {
virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y,
int dest_x, int dest_y, int w, int h) = 0;
+ // Returns a native drawing context for platform specific drawing routines to
+ // use. Must be balanced by a call to EndPlatformPaint().
+ virtual gfx::NativeDrawingContext BeginPlatformPaint() = 0;
+
+ // Signifies the end of platform drawing using the native drawing context
+ // returned by BeginPlatformPaint().
+ virtual void EndPlatformPaint() = 0;
+
// TODO(beng): remove this once we don't need to use any skia-specific methods
// through this interface.
// A quick and dirty way to obtain the underlying SkCanvas.
diff --git a/gfx/canvas_skia.cc b/gfx/canvas_skia.cc
index 28a3596..fbf26c9 100644
--- a/gfx/canvas_skia.cc
+++ b/gfx/canvas_skia.cc
@@ -298,6 +298,14 @@ void CanvasSkia::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y,
restore();
}
+gfx::NativeDrawingContext CanvasSkia::BeginPlatformPaint() {
+ return beginPlatformPaint();
+}
+
+void CanvasSkia::EndPlatformPaint() {
+ endPlatformPaint();
+}
+
CanvasSkia* CanvasSkia::AsCanvasSkia() {
return this;
}
diff --git a/gfx/canvas_skia.h b/gfx/canvas_skia.h
index 1648cbe..e3633a5 100644
--- a/gfx/canvas_skia.h
+++ b/gfx/canvas_skia.h
@@ -122,6 +122,8 @@ class CanvasSkia : public skia::PlatformCanvas,
virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h);
virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y,
int dest_x, int dest_y, int w, int h);
+ virtual gfx::NativeDrawingContext BeginPlatformPaint();
+ virtual void EndPlatformPaint();
virtual CanvasSkia* AsCanvasSkia();
virtual const CanvasSkia* AsCanvasSkia() const;
diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc
index b491092..30a8982e 100644
--- a/views/controls/menu/menu_item_view_win.cc
+++ b/views/controls/menu/menu_item_view_win.cc
@@ -34,7 +34,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
GetChildViewCount() == 0);
int state = render_selection ? MPI_HOT :
(IsEnabled() ? MPI_NORMAL : MPI_DISABLED);
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
// The gutter is rendered before the background.
if (config.render_gutter && !for_drag) {
@@ -131,7 +131,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
NativeTheme::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect,
arrow_direction, render_selection);
}
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
void MenuItemView::PaintCheck(HDC dc,
int state_id,
diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc
index d3a7ae8..cb92284 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -83,14 +83,14 @@ class MenuScrollButton : public View {
const MenuConfig& config = MenuConfig::instance();
#if defined(OS_WIN)
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
// The background.
RECT item_bounds = { 0, 0, width(), height() };
NativeTheme::instance()->PaintMenuItemBackground(
NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false,
&item_bounds);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
SkColor arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT);
#else
@@ -185,11 +185,11 @@ void MenuScrollViewContainer::PaintBackground(gfx::Canvas* canvas) {
}
#if defined(OS_WIN)
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
RECT bounds = {0, 0, width(), height()};
NativeTheme::instance()->PaintMenuBackground(
NativeTheme::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
#elif defined(OS_CHROMEOS)
static const SkColor kGradientColors[2] = {
SK_ColorWHITE,
diff --git a/views/controls/menu/menu_separator_win.cc b/views/controls/menu/menu_separator_win.cc
index ed3f34f..78331bb 100644
--- a/views/controls/menu/menu_separator_win.cc
+++ b/views/controls/menu/menu_separator_win.cc
@@ -20,7 +20,7 @@ void MenuSeparator::Paint(gfx::Canvas* canvas) {
// The gutter is rendered before the background.
int start_x = 0;
int start_y = height() / 3;
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
if (config.render_gutter) {
// If render_gutter is true, we're on Vista and need to render the
// gutter, then indent the separator from the gutter.
@@ -36,7 +36,7 @@ void MenuSeparator::Paint(gfx::Canvas* canvas) {
RECT separator_bounds = { start_x, start_y, width(), height() };
gfx::NativeTheme::instance()->PaintMenuSeparator(
dc, MENU_POPUPSEPARATOR, MPI_NORMAL, &separator_bounds);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
gfx::Size MenuSeparator::GetPreferredSize() {
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index 8687325..388cb56 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -36,10 +36,10 @@ class TabBackground : public Background {
virtual ~TabBackground() {}
virtual void Paint(gfx::Canvas* canvas, View* view) const {
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
RECT r = {0, 0, view->width(), view->height()};
gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
}
private:
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index 4f40987..bbc7672 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -418,7 +418,7 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) {
if (window()->GetDelegate()->CanResize() ||
window()->GetDelegate()->CanMaximize()) {
#if defined(OS_WIN)
- HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
+ HDC dc = canvas->BeginPlatformPaint();
SIZE gripper_size = { 0, 0 };
gfx::NativeTheme::instance()->GetThemePartSize(
gfx::NativeTheme::STATUS, dc, SP_GRIPPER, 1, NULL, TS_TRUE,
@@ -434,7 +434,7 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) {
RECT native_bounds = size_box_bounds_.ToRECT();
gfx::NativeTheme::instance()->PaintStatusGripper(
dc, SP_PANE, 1, 0, &native_bounds);
- canvas->AsCanvasSkia()->endPlatformPaint();
+ canvas->EndPlatformPaint();
#else
NOTIMPLEMENTED();
// TODO(port): paint size box