summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 23:04:23 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 23:04:23 +0000
commit3024338797b31cd0e0357878bcd5b084e4a8af69 (patch)
treecf20d1d15f3907bb625a7cd1e465bbc47118821e /views/controls
parent218f45da1c19e775cf72f46cc72f1c624927fd93 (diff)
downloadchromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.zip
chromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.tar.gz
chromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.tar.bz2
Canvas refactoring part 2.
- Rename Canvas to CanvasSkia. - Create a subclass Canvas that inherits from CanvasSkia for compatibility. BUG=none TEST=none Review URL: http://codereview.chromium.org/2862025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/menu/menu_controller.cc1
-rw-r--r--views/controls/menu/menu_win.cc4
-rw-r--r--views/controls/menu/native_menu_win.cc4
-rw-r--r--views/controls/table/native_table_win.cc8
-rw-r--r--views/controls/table/table_view.cc8
-rw-r--r--views/controls/textfield/gtk_views_entry.cc4
-rw-r--r--views/controls/textfield/gtk_views_textview.cc4
-rw-r--r--views/controls/tree/tree_view.cc16
8 files changed, 25 insertions, 24 deletions
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index d0adb838..de31f02 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -469,6 +469,7 @@ void MenuController::OnMouseDragged(SubmenuView* source,
gfx::Point press_loc(press_pt_);
View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc);
View::ConvertPointToView(NULL, item, &press_loc);
+ // TODO(beng): Convert to CanvasSkia
gfx::Canvas canvas(item->width(), item->height(), false);
item->Paint(&canvas, true);
diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc
index b941788..5c976d5 100644
--- a/views/controls/menu/menu_win.cc
+++ b/views/controls/menu/menu_win.cc
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "gfx/rect.h"
#include "views/accelerator.h"
@@ -184,7 +184,7 @@ class MenuHostWindow : public app::WindowImpl {
// Draw the icon after the label, otherwise it would be covered
// by the label.
if (data->icon.width() != 0 && data->icon.height() != 0) {
- gfx::Canvas canvas(data->icon.width(), data->icon.height(), false);
+ gfx::CanvasSkia canvas(data->icon.width(), data->icon.height(), false);
canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
canvas.DrawBitmapInt(data->icon, 0, 0);
canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left +
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index 0881ab5..cc528e3 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -9,7 +9,7 @@
#include "base/keyboard_codes.h"
#include "base/logging.h"
#include "base/stl_util-inl.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "views/accelerator.h"
@@ -223,7 +223,7 @@ class NativeMenuWin::MenuHostWindow {
// by the label.
SkBitmap icon;
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
- gfx::Canvas canvas(icon.width(), icon.height(), false);
+ gfx::CanvasSkia canvas(icon.width(), icon.height(), false);
canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
canvas.DrawBitmapInt(icon, 0, 0);
canvas.getTopPlatformDevice().drawToHDC(dc,
diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc
index d34856f..f0b0659 100644
--- a/views/controls/table/native_table_win.cc
+++ b/views/controls/table/native_table_win.cc
@@ -12,7 +12,7 @@
#include "app/table_model.h"
#include "base/logging.h"
#include "base/win_util.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/favicon_size.h"
#include "gfx/icon_util.h"
#include "skia/ext/skia_utils_win.h"
@@ -389,7 +389,7 @@ void NativeTableWin::CreateNativeControl() {
// We create 2 phony images because we are going to switch images at every
// refresh in order to force a refresh of the icon area (somehow the clip
// rect does not include the icon).
- gfx::Canvas canvas(kImageSize, kImageSize, false);
+ gfx::CanvasSkia canvas(kImageSize, kImageSize, false);
// Make the background completely transparent.
canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
HICON empty_icon =
@@ -508,8 +508,8 @@ LRESULT NativeTableWin::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) {
client_rect.top += content_offset_;
// Make sure the region need to paint is visible.
if (IntersectRect(&intersection, &icon_rect, &client_rect)) {
- gfx::Canvas canvas(icon_rect.right - icon_rect.left,
- icon_rect.bottom - icon_rect.top, false);
+ gfx::CanvasSkia canvas(icon_rect.right - icon_rect.left,
+ icon_rect.bottom - icon_rect.top, false);
// It seems the state in nmcd.uItemState is not correct.
// We'll retrieve it explicitly.
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index 2363985..75425c2 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -834,7 +834,7 @@ HWND TableView::CreateNativeControl(HWND parent_container) {
// We create 2 phony images because we are going to switch images at every
// refresh in order to force a refresh of the icon area (somehow the clip
// rect does not include the icon).
- gfx::Canvas canvas(kImageSize, kImageSize, false);
+ gfx::CanvasSkia canvas(kImageSize, kImageSize, false);
// Make the background completely transparent.
canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
HICON empty_icon =
@@ -1153,7 +1153,7 @@ void TableView::PaintAltText() {
HDC dc = GetDC(GetNativeControlHWND());
gfx::Font font = GetAltTextFont();
gfx::Rect bounds = GetAltTextBounds();
- gfx::Canvas canvas(bounds.width(), bounds.height(), false);
+ gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false);
// Pad by 1 for halo.
canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1,
1, bounds.width() - 2, bounds.height() - 2,
@@ -1236,8 +1236,8 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) {
client_rect.top += content_offset_;
// Make sure the region need to paint is visible.
if (IntersectRect(&intersection, &icon_rect, &client_rect)) {
- gfx::Canvas canvas(icon_rect.right - icon_rect.left,
- icon_rect.bottom - icon_rect.top, false);
+ gfx::CanvasSkia canvas(icon_rect.right - icon_rect.left,
+ icon_rect.bottom - icon_rect.top, false);
// It seems the state in nmcd.uItemState is not correct.
// We'll retrieve it explicitly.
diff --git a/views/controls/textfield/gtk_views_entry.cc b/views/controls/textfield/gtk_views_entry.cc
index 037e902d..a068009 100644
--- a/views/controls/textfield/gtk_views_entry.cc
+++ b/views/controls/textfield/gtk_views_entry.cc
@@ -5,7 +5,7 @@
#include "views/controls/textfield/gtk_views_entry.h"
#include "base/utf_string_conversions.h"
-#include "gfx/canvas_paint.h"
+#include "gfx/canvas_skia_paint.h"
#include "gfx/insets.h"
#include "gfx/skia_utils_gtk.h"
#include "views/controls/textfield/native_textfield_gtk.h"
@@ -28,7 +28,7 @@ static gint gtk_views_entry_expose_event(GtkWidget *widget,
if (host && event->window == entry->text_area &&
!host->textfield()->text_to_display_when_empty().empty() &&
g_utf8_strlen(gtk_entry_get_text(entry), -1) == 0) {
- gfx::CanvasPaint canvas(event);
+ gfx::CanvasSkiaPaint canvas(event);
if (!canvas.is_empty()) {
gfx::Insets insets =
views::NativeTextfieldGtk::GetEntryInnerBorder(entry);
diff --git a/views/controls/textfield/gtk_views_textview.cc b/views/controls/textfield/gtk_views_textview.cc
index e285ad9..da43d93 100644
--- a/views/controls/textfield/gtk_views_textview.cc
+++ b/views/controls/textfield/gtk_views_textview.cc
@@ -5,7 +5,7 @@
#include "views/controls/textfield/gtk_views_textview.h"
#include "base/utf_string_conversions.h"
-#include "gfx/canvas_paint.h"
+#include "gfx/canvas_skia_paint.h"
#include "gfx/insets.h"
#include "gfx/skia_utils_gtk.h"
#include "views/controls/textfield/native_textfield_gtk.h"
@@ -43,7 +43,7 @@ static gint gtk_views_textview_expose_event(GtkWidget *widget,
if (host && event->window == text_window &&
!host->textfield()->text_to_display_when_empty().empty() &&
gtk_text_iter_equal(&start, &end)) {
- gfx::CanvasPaint canvas(event);
+ gfx::CanvasSkiaPaint canvas(event);
if (!canvas.is_empty()) {
gfx::Insets insets =
views::NativeTextfieldGtk::GetTextViewInnerBorder(text_view);
diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc
index b544abc..799d89a 100644
--- a/views/controls/tree/tree_view.cc
+++ b/views/controls/tree/tree_view.cc
@@ -13,8 +13,8 @@
#include "base/keyboard_codes.h"
#include "base/stl_util-inl.h"
#include "base/win_util.h"
-#include "gfx/canvas.h"
-#include "gfx/canvas_paint.h"
+#include "gfx/canvas_skia.h"
+#include "gfx/canvas_skia_paint.h"
#include "gfx/favicon_size.h"
#include "gfx/icon_util.h"
#include "gfx/point.h"
@@ -688,7 +688,7 @@ HIMAGELIST TreeView::CreateImageList() {
// IDR_FOLDER_CLOSED if they aren't already.
if (model_images[i].width() != width ||
model_images[i].height() != height) {
- gfx::Canvas canvas(width, height, false);
+ gfx::CanvasSkia canvas(width, height, false);
// Make the background completely transparent.
canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
@@ -739,16 +739,16 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window,
return 1;
case WM_PAINT: {
- gfx::CanvasPaint canvas(window);
+ gfx::CanvasSkiaPaint canvas(window);
if (canvas.isEmpty())
return 0;
HDC dc = canvas.beginPlatformPaint();
if (base::i18n::IsRTL()) {
- // gfx::Canvas ends up configuring the DC with a mode of GM_ADVANCED.
- // For some reason a graphics mode of ADVANCED triggers all the text
- // to be mirrored when RTL. Set the mode back to COMPATIBLE and
- // explicitly set the layout. Additionally SetWorldTransform and
+ // gfx::CanvasSkia ends up configuring the DC with a mode of
+ // GM_ADVANCED. For some reason a graphics mode of ADVANCED triggers
+ // all the text to be mirrored when RTL. Set the mode back to COMPATIBLE
+ // and explicitly set the layout. Additionally SetWorldTransform and
// COMPATIBLE don't play nicely together. We need to use
// SetViewportOrgEx when using a mode of COMPATIBLE.
//