diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 16:16:02 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 16:16:02 +0000 |
commit | f2d4c672b6d6b80e376cff979b1ec28864b73fb6 (patch) | |
tree | 679a4a8178438947f2775a6d1ba5540be99ce00c /views | |
parent | 49578ea329dae7f711ca1cde1ecade01e19a4f1b (diff) | |
download | chromium_src-f2d4c672b6d6b80e376cff979b1ec28864b73fb6.zip chromium_src-f2d4c672b6d6b80e376cff979b1ec28864b73fb6.tar.gz chromium_src-f2d4c672b6d6b80e376cff979b1ec28864b73fb6.tar.bz2 |
Revert 86625 - This change implements a first pass in the effort to remove the dependency of PlatformDevice within Chrome. The Skia library now provides multiple back-ends for the SkDevice class, so PlatformDevice's inheritance of SkDevice, and the assumption of instances of PlatformDevice limits the use of these new back-ends.
A new set of helper functions is provided for the PlatformDevice entry points. Upon construction of a PlatformDevice, a pointer to the interface is cached in the parent SkDevice's SkMetaData. The new helper functions forward calls to the interface cached in the metadata.
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/7019013
TBR=twiz@chromium.org
Review URL: http://codereview.chromium.org/6987019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/menu_win.cc | 7 | ||||
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 6 | ||||
-rw-r--r-- | views/controls/table/native_table_win.cc | 7 | ||||
-rw-r--r-- | views/controls/table/table_view.cc | 9 | ||||
-rw-r--r-- | views/controls/tree/tree_view.cc | 4 | ||||
-rw-r--r-- | views/widget/native_widget_win.cc | 4 |
6 files changed, 19 insertions, 18 deletions
diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc index c4b6635..bf5cd4a 100644 --- a/views/controls/menu/menu_win.cc +++ b/views/controls/menu/menu_win.cc @@ -188,10 +188,9 @@ class MenuHostWindow : public ui::WindowImpl { gfx::CanvasSkia canvas(data->icon.width(), data->icon.height(), false); canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); canvas.DrawBitmapInt(data->icon, 0, 0); - skia::DrawToNativeContext( - &canvas, hDC, lpdis->rcItem.left + kItemLeftMargin, - lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - - data->icon.height()) / 2, NULL); + canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left + + kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom - + lpdis->rcItem.top - data->icon.height()) / 2, NULL); } } else { diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index 6724891..0913a5f 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -250,8 +250,8 @@ class NativeMenuWin::MenuHostWindow { gfx::CanvasSkia canvas(icon.width(), icon.height(), false); canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); canvas.DrawBitmapInt(icon, 0, 0); - skia::DrawToNativeContext( - &canvas, dc, draw_item_struct->rcItem.left + kItemLeftMargin, + canvas.getTopPlatformDevice().drawToHDC(dc, + draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top - icon.height()) / 2, NULL); } else if (type == ui::MenuModel::TYPE_CHECK && @@ -283,7 +283,7 @@ class NativeMenuWin::MenuHostWindow { &canvas, NativeTheme::kMenuCheck, state, bounds, extra); // Draw checkbox to menu. - skia::DrawToNativeContext(&canvas, dc, + canvas.getTopPlatformDevice().drawToHDC(dc, draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top - config.check_height) / 2, NULL); diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc index 25ae1db..56b0c71 100644 --- a/views/controls/table/native_table_win.cc +++ b/views/controls/table/native_table_win.cc @@ -548,9 +548,10 @@ LRESULT NativeTableWin::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { (intersection.right - intersection.left); to_draw.bottom = to_draw.top + (intersection.bottom - intersection.top); - skia::DrawToNativeContext(&canvas, draw_info->nmcd.hdc, - intersection.left, intersection.top, - &to_draw); + canvas.getTopPlatformDevice().drawToHDC(draw_info->nmcd.hdc, + intersection.left, + intersection.top, + &to_draw); r = CDRF_SKIPDEFAULT; } } diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 3a6aea6..4a3b1cb6 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -1158,7 +1158,7 @@ void TableView::PaintAltText() { canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, 1, bounds.width() - 2, bounds.height() - 2, gfx::CanvasSkia::DefaultCanvasTextAlignment()); - skia::DrawToNativeContext(&canvas, dc, bounds.x(), bounds.y(), NULL); + canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); ReleaseDC(GetNativeControlHWND(), dc); } @@ -1273,9 +1273,10 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { (intersection.right - intersection.left); to_draw.bottom = to_draw.top + (intersection.bottom - intersection.top); - skia::DrawToNativeContext(&canvas, draw_info->nmcd.hdc, - intersection.left, intersection.top, - &to_draw); + canvas.getTopPlatformDevice().drawToHDC(draw_info->nmcd.hdc, + intersection.left, + intersection.top, + &to_draw); r = CDRF_SKIPDEFAULT; } } diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index c084803..db75226 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -755,7 +755,7 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, if (canvas.isEmpty()) return 0; - HDC dc = skia::BeginPlatformPaint(&canvas); + HDC dc = canvas.beginPlatformPaint(); if (base::i18n::IsRTL()) { // gfx::CanvasSkia ends up configuring the DC with a mode of // GM_ADVANCED. For some reason a graphics mode of ADVANCED triggers @@ -789,7 +789,7 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, // over we copy the right bits. SetViewportOrgEx(dc, 0, 0, NULL); } - skia::EndPlatformPaint(&canvas); + canvas.endPlatformPaint(); return 0; } diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc index f84bc97..6ca61bc 100644 --- a/views/widget/native_widget_win.cc +++ b/views/widget/native_widget_win.cc @@ -1120,13 +1120,13 @@ void NativeWidgetWin::RedrawLayeredWindowContents() { GetWindowRect(&wr); SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; POINT position = {wr.left, wr.top}; - HDC dib_dc = skia::BeginPlatformPaint(layered_window_contents_.get()); + HDC dib_dc = layered_window_contents_->beginPlatformPaint(); POINT zero = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); invalid_rect_.SetRect(0, 0, 0, 0); - skia::EndPlatformPaint(layered_window_contents_.get()); + layered_window_contents_->endPlatformPaint(); } void NativeWidgetWin::ClientAreaSizeChanged() { |