summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/text_button.cc23
-rw-r--r--views/controls/label.cc6
-rw-r--r--views/controls/menu/menu_controller.cc4
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc15
-rw-r--r--views/controls/menu/menu_item_view_win.cc14
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc13
-rw-r--r--views/controls/menu/menu_separator_win.cc6
-rw-r--r--views/controls/progress_bar.cc6
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc6
-rw-r--r--views/controls/table/table_view.cc4
10 files changed, 47 insertions, 50 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index f2b7613..98c69fe 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -8,7 +8,7 @@
#include "app/throb_animation.h"
#include "app/resource_bundle.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "views/controls/button/button.h"
#include "views/event.h"
#include "grit/app_resources.h"
@@ -256,13 +256,12 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
if (show_highlighted_ && hover_animation_->is_animating()) {
// Draw the hover bitmap into an offscreen buffer, then blend it
// back into the current canvas.
- canvas->AsCanvasSkia()->saveLayerAlpha(NULL,
+ canvas->saveLayerAlpha(NULL,
static_cast<int>(hover_animation_->GetCurrentValue() * 255),
SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255,
- SkXfermode::kClear_Mode);
+ canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
PaintBorder(canvas);
- canvas->AsCanvasSkia()->restore();
+ canvas->restore();
} else if ((show_highlighted_ &&
(state_ == BS_HOT || state_ == BS_PUSHED)) ||
(state_ == BS_NORMAL && normal_has_border_)) {
@@ -331,17 +330,19 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
else
text_color = color_;
- int draw_string_flags = gfx::CanvasSkia::DefaultCanvasTextAlignment() |
+ int draw_string_flags = gfx::Canvas::DefaultCanvasTextAlignment() |
PrefixTypeToCanvasType(prefix_type_);
if (for_drag) {
#if defined(OS_WIN)
// TODO(erg): Either port DrawStringWithHalo to linux or find an
// alternative here.
- canvas->AsCanvasSkia()->DrawStringWithHalo(
- text_, font_, text_color, color_highlight_, text_bounds.x(),
- text_bounds.y(), text_bounds.width(), text_bounds.height(),
- draw_string_flags);
+ canvas->DrawStringWithHalo(text_, font_, text_color, color_highlight_,
+ text_bounds.x(),
+ text_bounds.y(),
+ text_bounds.width(),
+ text_bounds.height(),
+ draw_string_flags);
#else
canvas->DrawStringInt(text_,
font_,
@@ -380,7 +381,7 @@ void TextButton::UpdateColor() {
void TextButton::UpdateTextSize() {
int width = 0, height = 0;
- gfx::CanvasSkia::SizeStringInt(
+ gfx::Canvas::SizeStringInt(
text_, font_, &width, &height,
gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_));
text_size_.SetSize(width, font_.height());
diff --git a/views/controls/label.cc b/views/controls/label.cc
index d30a62b..88a755d 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -13,7 +13,7 @@
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "gfx/font.h"
#include "gfx/insets.h"
@@ -67,7 +67,7 @@ int Label::GetHeightForWidth(int w) {
w = std::max(0, w - GetInsets().width());
int h = font_.height();
- gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags());
+ gfx::Canvas::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags());
return h + GetInsets().height();
}
@@ -388,7 +388,7 @@ gfx::Size Label::GetTextSize() const {
int flags = ComputeMultiLineFlags();
if (!is_multi_line_)
flags |= gfx::Canvas::NO_ELLIPSIS;
- gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, flags);
+ gfx::Canvas::SizeStringInt(text_, font_, &w, &h, flags);
text_size_.SetSize(w, h);
text_size_valid_ = true;
}
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index 955451a..de31f02 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -9,7 +9,7 @@
#include "base/i18n/rtl.h"
#include "base/keyboard_codes.h"
#include "base/time.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu_scroll_view_container.h"
#include "views/controls/menu/submenu_view.h"
@@ -470,7 +470,7 @@ void MenuController::OnMouseDragged(SubmenuView* source,
View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc);
View::ConvertPointToView(NULL, item, &press_loc);
// TODO(beng): Convert to CanvasSkia
- gfx::CanvasSkia canvas(item->width(), item->height(), false);
+ gfx::Canvas canvas(item->width(), item->height(), false);
item->Paint(&canvas, true);
OSExchangeData data;
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index db21e01..f3e7556 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -5,7 +5,7 @@
#include "views/controls/menu/menu_item_view.h"
#include "app/resource_bundle.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/favicon_size.h"
#include "grit/app_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
@@ -70,8 +70,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
// only need the background when we want it to look different, as when we're
// selected.
if (render_selection)
- canvas->AsCanvasSkia()->drawColor(kSelectedBackgroundColor,
- SkXfermode::kSrc_Mode);
+ canvas->drawColor(kSelectedBackgroundColor, SkXfermode::kSrc_Mode);
// Render the check.
if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
@@ -104,13 +103,13 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
paint.setShader(shader);
shader->unref();
int radius = kIndicatorSize / 2;
- canvas->AsCanvasSkia()->drawCircle(radius, radius, radius, paint);
+ canvas->drawCircle(radius, radius, radius, paint);
paint.setStrokeWidth(SkIntToScalar(0));
paint.setShader(NULL);
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(kBaseStroke);
- canvas->AsCanvasSkia()->drawCircle(radius, radius, radius, paint);
+ canvas->drawCircle(radius, radius, radius, paint);
if (GetDelegate()->IsItemChecked(GetCommand())) {
SkPoint selected_gradient_points[2];
@@ -126,15 +125,13 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
paint.setShader(shader);
shader->unref();
paint.setStyle(SkPaint::kFill_Style);
- canvas->AsCanvasSkia()->drawCircle(radius, radius,
- kSelectedIndicatorSize / 2, paint);
+ canvas->drawCircle(radius, radius, kSelectedIndicatorSize / 2, paint);
paint.setStrokeWidth(SkIntToScalar(0));
paint.setShader(NULL);
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(kIndicatorStroke);
- canvas->AsCanvasSkia()->drawCircle(radius, radius,
- kSelectedIndicatorSize / 2, paint);
+ canvas->drawCircle(radius, radius, kSelectedIndicatorSize / 2, paint);
}
canvas->TranslateInt(
diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc
index b491092..2ac0921 100644
--- a/views/controls/menu/menu_item_view_win.cc
+++ b/views/controls/menu/menu_item_view_win.cc
@@ -8,7 +8,7 @@
#include <Vssym32.h>
#include "app/l10n_util.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/native_theme_win.h"
#include "grit/app_strings.h"
#include "views/controls/menu/menu_config.h"
@@ -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) {
@@ -87,10 +87,10 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
// foreground and background colors are for the text to draw the correct
// halo. Instead, just draw black on white, which will look good in most
// cases.
- canvas->AsCanvasSkia()->DrawStringWithHalo(
- GetTitle(), font, 0x00000000, 0xFFFFFFFF, text_bounds.x(),
- text_bounds.y(), text_bounds.width(), text_bounds.height(),
- GetRootMenuItem()->GetDrawStringFlags());
+ canvas->DrawStringWithHalo(GetTitle(), font, 0x00000000, 0xFFFFFFFF,
+ text_bounds.x(), text_bounds.y(),
+ text_bounds.width(), text_bounds.height(),
+ GetRootMenuItem()->GetDrawStringFlags());
} else {
canvas->DrawStringInt(GetTitle(), font, fg_color,
text_bounds.x(), text_bounds.y(), text_bounds.width(),
@@ -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..b538f5b 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -10,7 +10,7 @@
#include <Vssym32.h>
#endif
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "views/border.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
@@ -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,
@@ -220,8 +220,7 @@ void MenuScrollViewContainer::PaintBackground(gfx::Canvas* canvas) {
canvas->FillRectInt(0, 0, width(), height(), paint);
#else
// This is the same as COLOR_TOOLBAR.
- canvas->AsCanvasSkia()->drawColor(SkColorSetRGB(210, 225, 246),
- SkXfermode::kSrc_Mode);
+ canvas->drawColor(SkColorSetRGB(210, 225, 246), SkXfermode::kSrc_Mode);
#endif
}
diff --git a/views/controls/menu/menu_separator_win.cc b/views/controls/menu/menu_separator_win.cc
index ed3f34f..58e2bb4 100644
--- a/views/controls/menu/menu_separator_win.cc
+++ b/views/controls/menu/menu_separator_win.cc
@@ -8,7 +8,7 @@
#include <uxtheme.h>
#include <Vssym32.h>
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/native_theme_win.h"
#include "views/controls/menu/menu_config.h"
#include "views/controls/menu/menu_item_view.h"
@@ -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/progress_bar.cc b/views/controls/progress_bar.cc
index 1006acd..19f10c5 100644
--- a/views/controls/progress_bar.cc
+++ b/views/controls/progress_bar.cc
@@ -10,7 +10,7 @@
#include "app/resource_bundle.h"
#include "base/logging.h"
#include "base/string_util.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "gfx/font.h"
#include "gfx/insets.h"
@@ -75,7 +75,7 @@ static void FillRoundRect(gfx::Canvas* canvas,
} else {
paint.setColor(gradient_start_color);
}
- canvas->AsCanvasSkia()->drawPath(path, paint);
+ canvas->drawPath(path, paint);
}
static void StrokeRoundRect(gfx::Canvas* canvas,
@@ -92,7 +92,7 @@ static void StrokeRoundRect(gfx::Canvas* canvas,
paint.setStyle(SkPaint::kStroke_Style);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setStrokeWidth(SkIntToScalar(stroke_width));
- canvas->AsCanvasSkia()->drawPath(path, paint);
+ canvas->drawPath(path, paint);
}
} // anonymous namespace
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index 832d4a2..87f2ebb 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -10,7 +10,7 @@
#include "app/resource_bundle.h"
#include "base/logging.h"
#include "base/stl_util-inl.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/font.h"
#include "gfx/native_theme_win.h"
#include "views/controls/tabbed_pane/tabbed_pane.h"
@@ -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/controls/table/table_view.cc b/views/controls/table/table_view.cc
index 8b86a6e..75425c2 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -16,7 +16,7 @@
#include "base/i18n/rtl.h"
#include "base/string_util.h"
#include "base/win_util.h"
-#include "gfx/canvas_skia.h"
+#include "gfx/canvas.h"
#include "gfx/favicon_size.h"
#include "gfx/font.h"
#include "gfx/icon_util.h"
@@ -1157,7 +1157,7 @@ void TableView::PaintAltText() {
// Pad by 1 for halo.
canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1,
1, bounds.width() - 2, bounds.height() - 2,
- gfx::CanvasSkia::DefaultCanvasTextAlignment());
+ gfx::Canvas::DefaultCanvasTextAlignment());
canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL);
ReleaseDC(GetNativeControlHWND(), dc);
}