summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc13
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc6
-rw-r--r--chrome/browser/views/browser_actions_container.cc4
-rw-r--r--chrome/browser/views/bubble_border.cc6
-rw-r--r--chrome/browser/views/create_application_shortcut_view.cc10
-rw-r--r--chrome/browser/views/detachable_toolbar_view.cc14
-rw-r--r--chrome/browser/views/download_item_view.cc24
-rw-r--r--chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc6
-rw-r--r--chrome/browser/views/extensions/extension_shelf.cc7
-rw-r--r--chrome/browser/views/frame/browser_view.cc6
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.cc14
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc12
-rw-r--r--chrome/browser/views/fullscreen_exit_bubble.cc4
-rw-r--r--chrome/browser/views/info_bubble.cc4
-rw-r--r--chrome/browser/views/infobars/translate_infobar_base.cc11
-rw-r--r--chrome/browser/views/infobars/translate_infobars.cc9
-rw-r--r--chrome/browser/views/list_background.h6
-rw-r--r--chrome/browser/views/location_bar/location_bar_view.cc5
-rw-r--r--chrome/browser/views/notifications/balloon_view.cc4
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc6
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc6
-rw-r--r--chrome/browser/views/sad_tab_view.cc5
-rw-r--r--chrome/browser/views/status_bubble_views.cc6
-rw-r--r--chrome/browser/views/tabs/base_tab.cc6
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc11
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.cc6
-rw-r--r--chrome/browser/views/tabs/native_view_photobooth_win.cc13
-rw-r--r--chrome/browser/views/tabs/side_tab.cc14
-rw-r--r--chrome/browser/views/tabs/tab.cc19
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc22
-rw-r--r--chrome/browser/views/theme_install_bubble_view.cc3
31 files changed, 144 insertions, 138 deletions
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index df9565c..17d243c 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
#include "chrome/browser/views/bubble_border.h"
#include "chrome/browser/views/location_bar/location_bar_view.h"
-#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
#include "gfx/color_utils.h"
#include "gfx/insets.h"
@@ -273,7 +272,7 @@ AutocompleteResultView::~AutocompleteResultView() {
void AutocompleteResultView::Paint(gfx::Canvas* canvas) {
const ResultViewState state = GetState();
if (state != NORMAL)
- canvas->drawColor(GetColor(state, BACKGROUND));
+ canvas->AsCanvasSkia()->drawColor(GetColor(state, BACKGROUND));
// Paint the icon.
canvas->DrawBitmapInt(*GetIcon(), MirroredLeftPointForRect(icon_bounds_),
@@ -765,8 +764,7 @@ void AutocompletePopupContentsView::Paint(gfx::Canvas* canvas) {
// Instead, we paint all our children into a second canvas and use that as a
// shader to fill a path representing the round-rect clipping region. This
// yields a nice anti-aliased edge.
- // TODO(beng): Convert to CanvasSkia
- gfx::Canvas contents_canvas(width(), height(), true);
+ gfx::CanvasSkia contents_canvas(width(), height(), true);
contents_canvas.drawColor(GetColor(NORMAL, BACKGROUND));
View::PaintChildren(&contents_canvas);
// We want the contents background to be slightly transparent so we can see
@@ -788,7 +786,7 @@ void AutocompletePopupContentsView::Paint(gfx::Canvas* canvas) {
gfx::Path path;
MakeContentsPath(&path, GetLocalBounds(false));
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
// Now we paint the border, so it will be alpha-blended atop the contents.
// This looks slightly better in the corners than drawing the contents atop
@@ -935,8 +933,9 @@ void AutocompletePopupContentsView::MakeCanvasTransparent(
// Allow the window blur effect to show through the popup background.
SkAlpha alpha = GetThemeProvider()->ShouldUseNativeFrame() ?
kGlassPopupAlpha : kOpaquePopupAlpha;
- canvas->drawColor(SkColorSetA(GetColor(NORMAL, BACKGROUND), alpha),
- SkXfermode::kDstIn_Mode);
+ canvas->AsCanvasSkia()->drawColor(
+ SkColorSetA(GetColor(NORMAL, BACKGROUND), alpha),
+ SkXfermode::kDstIn_Mode);
}
void AutocompletePopupContentsView::OpenIndex(
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 0b97017..e595529 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -37,7 +37,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
@@ -243,7 +242,7 @@ class BookmarkFolderButton : public views::MenuButton {
return disposition != CURRENT_TAB;
}
- virtual void Paint(gfx::Canvas *canvas) {
+ virtual void Paint(gfx::Canvas* canvas) {
views::MenuButton::Paint(canvas, false);
}
@@ -1111,8 +1110,7 @@ void BookmarkBarView::WriteDragData(View* sender,
for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
if (sender == GetBookmarkButton(i)) {
views::TextButton* button = GetBookmarkButton(i);
- // TODO(beng): convert to CanvasSkia
- gfx::Canvas canvas(button->width(), button->height(), false);
+ gfx::CanvasSkia canvas(button->width(), button->height(), false);
button->Paint(&canvas, true);
drag_utils::SetDragImageOnDataObject(canvas, button->size(),
press_pt, data);
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
index e472de6..78cf623 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/views/browser_actions_container.cc
@@ -323,8 +323,8 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() {
if (icon.isNull())
icon = button_->default_icon();
- // TODO(beng): Convert to CanvasSkia
- gfx::Canvas* canvas = new gfx::Canvas(icon.width(), icon.height(), false);
+ gfx::Canvas* canvas =
+ new gfx::CanvasSkia(icon.width(), icon.height(), false);
canvas->DrawBitmapInt(icon, 0, 0);
if (tab_id >= 0) {
diff --git a/chrome/browser/views/bubble_border.cc b/chrome/browser/views/bubble_border.cc
index 49c53b6..e37f5fe 100644
--- a/chrome/browser/views/bubble_border.cc
+++ b/chrome/browser/views/bubble_border.cc
@@ -6,7 +6,7 @@
#include "app/resource_bundle.h"
#include "base/logging.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/path.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -418,7 +418,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas,
else
path.lineTo(SkIntToScalar(tip_x + shift_x), SkIntToScalar(tip_y - shift_y));
path.close();
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
}
/////////////////////////
@@ -439,5 +439,5 @@ void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom()));
SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius());
path.addRoundRect(rect, radius, radius);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
}
diff --git a/chrome/browser/views/create_application_shortcut_view.cc b/chrome/browser/views/create_application_shortcut_view.cc
index 0d3f6e2..b0a66b3 100644
--- a/chrome/browser/views/create_application_shortcut_view.cc
+++ b/chrome/browser/views/create_application_shortcut_view.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/codec/png_codec.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -169,8 +169,8 @@ void AppInfoView::Paint(gfx::Canvas* canvas) {
border_paint.setAntiAlias(true);
border_paint.setARGB(0xFF, 0xC8, 0xC8, 0xC8);
- canvas->drawRoundRect(border_rect, SkIntToScalar(2), SkIntToScalar(2),
- border_paint);
+ canvas->AsCanvasSkia()->drawRoundRect(
+ border_rect, SkIntToScalar(2), SkIntToScalar(2), border_paint);
SkRect inner_rect = {
border_rect.fLeft + SkDoubleToScalar(0.5),
@@ -182,8 +182,8 @@ void AppInfoView::Paint(gfx::Canvas* canvas) {
SkPaint inner_paint;
inner_paint.setAntiAlias(true);
inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8);
- canvas->drawRoundRect(inner_rect, SkIntToScalar(1.5), SkIntToScalar(1.5),
- inner_paint);
+ canvas->AsCanvasSkia()->drawRoundRect(
+ inner_rect, SkIntToScalar(1.5), SkIntToScalar(1.5), inner_paint);
}
}; // namespace
diff --git a/chrome/browser/views/detachable_toolbar_view.cc b/chrome/browser/views/detachable_toolbar_view.cc
index 2e3e457..ba44f3d 100644
--- a/chrome/browser/views/detachable_toolbar_view.cc
+++ b/chrome/browser/views/detachable_toolbar_view.cc
@@ -6,7 +6,7 @@
#include "app/resource_bundle.h"
#include "chrome/browser/browser_theme_provider.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/skia_util.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -70,7 +70,7 @@ void DetachableToolbarView::PaintContentAreaBackground(
paint.setAntiAlias(true);
paint.setColor(theme_provider->GetColor(BrowserThemeProvider::COLOR_TOOLBAR));
- canvas->drawRoundRect(
+ canvas->AsCanvasSkia()->drawRoundRect(
rect, SkDoubleToScalar(roundness), SkDoubleToScalar(roundness), paint);
}
@@ -85,9 +85,9 @@ void DetachableToolbarView::PaintContentAreaBorder(
border_paint.setAlpha(96);
border_paint.setAntiAlias(true);
- canvas->drawRoundRect(rect,
- SkDoubleToScalar(roundness),
- SkDoubleToScalar(roundness), border_paint);
+ canvas->AsCanvasSkia()->drawRoundRect(
+ rect, SkDoubleToScalar(roundness), SkDoubleToScalar(roundness),
+ border_paint);
}
// static
@@ -106,7 +106,7 @@ void DetachableToolbarView::PaintVerticalDivider(
SkIntToScalar(vertical_padding + 1),
SkIntToScalar(x + 1),
SkIntToScalar(height / 2) };
- canvas->drawRect(rc, paint);
+ canvas->AsCanvasSkia()->drawRect(rc, paint);
// Draw the lower half of the divider.
SkPaint paint_down;
@@ -118,5 +118,5 @@ void DetachableToolbarView::PaintVerticalDivider(
SkIntToScalar(height / 2),
SkIntToScalar(x + 1),
SkIntToScalar(height - vertical_padding) };
- canvas->drawRect(rc_down, paint_down);
+ canvas->AsCanvasSkia()->drawRect(rc_down, paint_down);
}
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index d519783..edab6a5 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/views/download_shelf_view.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/color_utils.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -515,7 +515,7 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
// (hot_)body_image_set->bottom_left, and drop_down_image_set,
// for RTL UI, we flip the canvas to draw those images mirrored.
// Consequently, we do not need to mirror the x-axis of those images.
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->TranslateInt(width(), 0);
canvas->ScaleInt(-1, 1);
}
@@ -536,10 +536,10 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
// Overlay our body hot state.
if (body_hover_animation_->GetCurrentValue() > 0) {
- canvas->saveLayerAlpha(NULL,
+ canvas->AsCanvasSkia()->saveLayerAlpha(NULL,
static_cast<int>(body_hover_animation_->GetCurrentValue() * 255),
SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
int x = kLeftPadding;
PaintBitmaps(canvas,
@@ -557,10 +557,10 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
hot_body_image_set_.bottom_right,
x, box_y_, box_height_,
hot_body_image_set_.top_right->width());
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
if (rtl_ui) {
- canvas->restore();
- canvas->save();
+ canvas->AsCanvasSkia()->restore();
+ canvas->AsCanvasSkia()->save();
// Flip it for drawing drop-down images for RTL locales.
canvas->TranslateInt(width(), 0);
canvas->ScaleInt(-1, 1);
@@ -578,17 +578,19 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
// Overlay our drop-down hot state.
if (drop_hover_animation_->GetCurrentValue() > 0) {
- canvas->saveLayerAlpha(NULL,
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ NULL,
static_cast<int>(drop_hover_animation_->GetCurrentValue() * 255),
SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255,
+ SkXfermode::kClear_Mode);
PaintBitmaps(canvas,
drop_down_image_set->top, drop_down_image_set->center,
drop_down_image_set->bottom,
x, box_y_, box_height_, drop_down_image_set->top->width());
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
}
@@ -596,7 +598,7 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
// Restore the canvas to avoid file name etc. text are drawn flipped.
// Consequently, the x-axis of following canvas->DrawXXX() method should be
// mirrored so the text and images are down in the right positions.
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
// Print the text, left aligned and always print the file extension.
diff --git a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
index 0b66c13..aa072f6 100644
--- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/views/extensions/browser_action_drag_data.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_2.h"
@@ -34,11 +34,11 @@ BrowserActionOverflowMenuController::BrowserActionOverflowMenuController(
size_t command_id = 1; // Menu id 0 is reserved, start with 1.
for (size_t i = start_index; i < views_->size(); ++i) {
BrowserActionView* view = (*views_)[i];
- scoped_ptr<gfx::CanvasSkia> canvas(view->GetIconWithBadge());
+ scoped_ptr<gfx::Canvas> canvas(view->GetIconWithBadge());
menu_->AppendMenuItemWithIcon(
command_id,
UTF8ToWide(view->button()->extension()->name()),
- canvas->ExtractBitmap());
+ canvas->AsCanvasSkia()->ExtractBitmap());
// Set the tooltip for this item.
std::wstring tooltip = UTF8ToWide(
diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc
index e06b494..7bb5391 100644
--- a/chrome/browser/views/extensions/extension_shelf.cc
+++ b/chrome/browser/views/extensions/extension_shelf.cc
@@ -24,6 +24,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
+#include "gfx/canvas_skia.h"
#include "views/controls/label.h"
#include "views/screen.h"
#include "views/widget/root_view.h"
@@ -942,13 +943,15 @@ void ExtensionShelf::InitBackground(gfx::Canvas* canvas) {
for (int i = 0; i < count; ++i) {
ExtensionView* view = ToolstripAtIndex(i)->view();
- const SkBitmap& background = canvas->getDevice()->accessBitmap(false);
+ const SkBitmap& background =
+ canvas->AsCanvasSkia()->getDevice()->accessBitmap(false);
SkRect mapped_subset = background_rect;
gfx::Rect view_bounds = view->bounds();
mapped_subset.offset(SkIntToScalar(view_bounds.x()),
SkIntToScalar(view_bounds.y()));
- bool result = canvas->getTotalMatrix().mapRect(&mapped_subset);
+ bool result =
+ canvas->AsCanvasSkia()->getTotalMatrix().mapRect(&mapped_subset);
DCHECK(result);
SkIRect isubset;
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 343519e..caca13a 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -49,7 +49,7 @@
#include "chrome/common/native_window_notification_source.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -221,12 +221,12 @@ class ResizeCorner : public views::View {
if (rtl_dir) {
canvas->TranslateInt(width(), 0);
canvas->ScaleInt(-1, 1);
- canvas->save();
+ canvas->AsCanvasSkia()->save();
}
canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(),
height() - bitmap->height());
if (rtl_dir)
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
static gfx::Size GetSize() {
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc
index d65cbc3..b37552e 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/views/frame/glass_browser_frame_view.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/views/tabs/side_tab_strip.h"
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_strip.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/icon_util.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
@@ -264,14 +264,14 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
// Draw left edge. We explicitly set a clip as the image is bigger than just
// the corner.
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(x - kNonClientBorderThickness,
y - kNonClientBorderThickness,
kNonClientBorderThickness,
kNonClientBorderThickness);
canvas->DrawBitmapInt(*toolbar_left, x - kNonClientBorderThickness,
y - kNonClientBorderThickness);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
// Draw center edge. We need to draw a while line above the toolbar for the
// image to overlay nicely.
@@ -279,14 +279,14 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
canvas->TileImageInt(*toolbar_center, x, y - kNonClientBorderThickness, w,
toolbar_center->height());
// Right edge. Again, we have to clip because of image size.
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(x + w - kNonClientBorderThickness,
y - kNonClientBorderThickness,
kNonClientBorderThickness,
kNonClientBorderThickness);
canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER),
x + w, y);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else {
// Draw the toolbar background, setting src_y of the paint to the tab
// strip height as the toolbar background begins at the top of the tabs.
@@ -356,11 +356,11 @@ void GlassBrowserFrameView::PaintOTRAvatar(gfx::Canvas* canvas) {
gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin());
View::ConvertPointToView(frame_->GetWindow()->GetClientView(), this,
&tabstrip_origin);
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(dst_x, 2, w, tabstrip_origin.y() - 4);
canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y,
w, h, false);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else {
canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y,
w, h, false);
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index d18375a..227205f 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/browser/views/toolbar_view.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "gfx/path.h"
#include "grit/app_resources.h"
@@ -382,10 +382,10 @@ void OpaqueBrowserFrameView::PaintChildren(gfx::Canvas* canvas) {
continue;
}
if (child == otr_avatar_icon_) {
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(0, 2, width(), otr_avatar_icon_->height() - 10);
child->ProcessPaint(canvas);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else {
child->ProcessPaint(canvas);
}
@@ -785,8 +785,8 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
bounds.set(SkIntToScalar(x - kClientEdgeThickness), SkIntToScalar(y),
SkIntToScalar(x + w + kClientEdgeThickness * 2),
SkIntToScalar(y + h));
- canvas->saveLayerAlpha(&bounds, 255);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->saveLayerAlpha(&bounds, 255);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
SkColor theme_toolbar_color =
tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR);
@@ -836,7 +836,7 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
toolbar_right_mask->height() - bottom_edge_height,
toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y,
toolbar_right_mask->width(), bottom_edge_height, false, paint);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point,
left_x, y,
diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc
index c12326a..e216bd2 100644
--- a/chrome/browser/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/views/fullscreen_exit_bubble.cc
@@ -8,7 +8,7 @@
#include "app/resource_bundle.h"
#include "base/keyboard_codes.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/generated_resources.h"
#include "views/screen.h"
#include "views/widget/root_view.h"
@@ -92,7 +92,7 @@ void FullscreenExitBubble::FullscreenExitView::Paint(gfx::Canvas* canvas) {
paint.setStyle(SkPaint::kFill_Style);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setColor(SK_ColorBLACK);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
}
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 7f1b4f2..34645a0 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -7,7 +7,7 @@
#include "base/keyboard_codes.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/notification_service.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/color_utils.h"
#include "gfx/path.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -114,7 +114,7 @@ void BorderContents::Paint(gfx::Canvas* canvas) {
SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom()));
SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius());
path.addRoundRect(rect, radius, radius);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
// Now we paint the border, so it will be alpha-blended atop the contents.
// This looks slightly better in the corners than drawing the contents atop
diff --git a/chrome/browser/views/infobars/translate_infobar_base.cc b/chrome/browser/views/infobars/translate_infobar_base.cc
index aa89609..d344b88 100644
--- a/chrome/browser/views/infobars/translate_infobar_base.cc
+++ b/chrome/browser/views/infobars/translate_infobar_base.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/views/infobars/before_translate_infobar.h"
#include "chrome/browser/views/infobars/translate_message_infobar.h"
#include "chrome/browser/views/infobars/infobar_button_border.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/app_resources.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/image_view.h"
@@ -148,11 +148,12 @@ void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas,
const InfoBarBackground& background) {
// Draw the background into an offscreen buffer with alpha value per animation
// value, then blend it back into the current canvas.
- canvas->saveLayerAlpha(NULL, static_cast<int>(animation_value * 255),
- SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ NULL, static_cast<int>(animation_value * 255),
+ SkCanvas::kARGB_NoClipLayer_SaveFlag);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
background.Paint(canvas, this);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
// TranslateInfoBarDelegate views specific method:
diff --git a/chrome/browser/views/infobars/translate_infobars.cc b/chrome/browser/views/infobars/translate_infobars.cc
index 08d4a0f..e395c39 100644
--- a/chrome/browser/views/infobars/translate_infobars.cc
+++ b/chrome/browser/views/infobars/translate_infobars.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/translate/page_translated_details.h"
#include "chrome/browser/views/infobars/infobar_button_border.h"
#include "chrome/browser/views/infobars/infobar_text_button.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -757,11 +757,12 @@ void TranslateInfoBar::FadeBackground(gfx::Canvas* canvas,
double animation_value, TranslateInfoBarDelegate::TranslateState state) {
// Draw background into an offscreen buffer with alpha value per animation
// value, then blend it back into the current canvas.
- canvas->saveLayerAlpha(NULL, static_cast<int>(animation_value * 255),
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ NULL, static_cast<int>(animation_value * 255),
SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
GetBackground(state)->Paint(canvas, this);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
inline TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() const {
diff --git a/chrome/browser/views/list_background.h b/chrome/browser/views/list_background.h
index ba8317a..fb10067 100644
--- a/chrome/browser/views/list_background.h
+++ b/chrome/browser/views/list_background.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VIEWS_LIST_BACKGROUND_H_
#define CHROME_BROWSER_VIEWS_LIST_BACKGROUND_H_
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/native_theme_win.h"
#include "views/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->beginPlatformPaint();
+ HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
RECT native_lb = view->GetLocalBounds(true).ToRECT();
gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb);
- canvas->endPlatformPaint();
+ canvas->AsCanvasSkia()->endPlatformPaint();
}
private:
diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc
index 77a459f..09c1007 100644
--- a/chrome/browser/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/views/location_bar/location_bar_view.cc
@@ -27,7 +27,7 @@
#include "chrome/browser/views/location_bar/page_action_with_badge_view.h"
#include "chrome/browser/views/location_bar/selected_keyword_view.h"
#include "chrome/browser/views/location_bar/star_view.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/color_utils.h"
#include "gfx/skia_util.h"
#include "grit/generated_resources.h"
@@ -556,7 +556,8 @@ void LocationBarView::Paint(gfx::Canvas* canvas) {
// below, and all our other bubbles.
const SkScalar radius(SkIntToScalar(BubbleBorder::GetCornerRadius()));
bounds.Inset(kEdgeThickness, 0);
- canvas->drawRoundRect(gfx::RectToSkRect(bounds), radius, radius, paint);
+ canvas->AsCanvasSkia()->drawRoundRect(gfx::RectToSkRect(bounds), radius,
+ radius, paint);
} else {
canvas->FillRectInt(color, bounds.x(), bounds.y(), bounds.width(),
bounds.height());
diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/views/notifications/balloon_view.cc
index 2c362d0..68c6570 100644
--- a/chrome/browser/views/notifications/balloon_view.cc
+++ b/chrome/browser/views/notifications/balloon_view.cc
@@ -22,7 +22,7 @@
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/insets.h"
#include "gfx/native_widget_types.h"
#include "grit/generated_resources.h"
@@ -466,7 +466,7 @@ void BalloonViewImpl::Paint(gfx::Canvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(kControlBarBackgroundColor);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
// Draw a 1-pixel gray line between the content and the menu bar.
int line_width = GetTotalWidth() - kLeftMargin - kRightMargin;
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 53e057c..b93cd6f 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -40,7 +40,7 @@
#include "chrome/browser/views/options/fonts_languages_window_view.h"
#include "chrome/browser/views/restart_message_box.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/native_theme_win.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
@@ -135,12 +135,12 @@ void FileDisplayArea::SetFile(const FilePath& file_path) {
}
void FileDisplayArea::Paint(gfx::Canvas* canvas) {
- HDC dc = canvas->beginPlatformPaint();
+ HDC dc = canvas->AsCanvasSkia()->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->endPlatformPaint();
+ canvas->AsCanvasSkia()->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 4fd923e..df5b832 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "gfx/native_theme_win.h"
#include "grit/generated_resources.h"
@@ -96,12 +96,12 @@ void FontDisplayView::SetFontType(const std::wstring& font_name,
}
void FontDisplayView::Paint(gfx::Canvas* canvas) {
- HDC dc = canvas->beginPlatformPaint();
+ HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
RECT rect = { 0, 0, width(), height() };
gfx::NativeTheme::instance()->PaintTextField(
dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE),
true, true);
- canvas->endPlatformPaint();
+ canvas->AsCanvasSkia()->endPlatformPaint();
}
void FontDisplayView::Layout() {
diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc
index fbaa37d5..e02d975 100644
--- a/chrome/browser/views/sad_tab_view.cc
+++ b/chrome/browser/views/sad_tab_view.cc
@@ -57,9 +57,8 @@ void SadTabView::Paint(gfx::Canvas* canvas) {
kBackgroundColor,
kBackgroundEndColor))->safeUnref();
paint.setStyle(SkPaint::kFill_Style);
- canvas->drawRectCoords(0, 0,
- SkIntToScalar(width()), SkIntToScalar(height()),
- paint);
+ canvas->AsCanvasSkia()->drawRectCoords(
+ 0, 0, SkIntToScalar(width()), SkIntToScalar(height()), paint);
canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y());
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index 5026c49..71be04d 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -14,7 +14,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/browser_theme_provider.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/point.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
@@ -414,7 +414,7 @@ void StatusBubbleViews::StatusView::Paint(gfx::Canvas* canvas) {
SkPaint shadow_paint;
shadow_paint.setFlags(SkPaint::kAntiAlias_Flag);
shadow_paint.setColor(kShadowColor);
- canvas->drawPath(shadow_path, shadow_paint);
+ canvas->AsCanvasSkia()->drawPath(shadow_path, shadow_paint);
// Draw the bubble.
rect.set(SkIntToScalar(kShadowThickness),
@@ -423,7 +423,7 @@ void StatusBubbleViews::StatusView::Paint(gfx::Canvas* canvas) {
SkIntToScalar(height - kShadowThickness));
SkPath path;
path.addRoundRect(rect, rad, SkPath::kCW_Direction);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
// Draw highlight text and then the text body. In order to make sure the text
// is aligned to the right on RTL UIs, we mirror the text bounds if the
diff --git a/chrome/browser/views/tabs/base_tab.cc b/chrome/browser/views/tabs/base_tab.cc
index 04124ed..58e853f 100644
--- a/chrome/browser/views/tabs/base_tab.cc
+++ b/chrome/browser/views/tabs/base_tab.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/tabs/tab_controller.h"
#include "chrome/common/chrome_switches.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/favicon_size.h"
#include "gfx/font.h"
#include "gfx/skbitmap_operations.h"
@@ -437,7 +437,7 @@ void BaseTab::PaintIcon(gfx::Canvas* canvas, int x, int y) {
image_size, favicon_x, dst_y, image_size, image_size,
false);
} else {
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(0, 0, width(), height());
if (should_display_crashed_favicon_) {
canvas->DrawBitmapInt(*crashed_fav_icon, 0, 0,
@@ -460,7 +460,7 @@ void BaseTab::PaintIcon(gfx::Canvas* canvas, int x, int y) {
true);
}
}
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
}
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index bb97cd6..5778f0b 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -30,7 +30,7 @@
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/common/notification_service.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "views/event.h"
@@ -85,8 +85,9 @@ class DockView : public views::View {
SkPaint paint;
paint.setColor(SkColorSetRGB(108, 108, 108));
paint.setStyle(SkPaint::kFill_Style);
- canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius),
- SkIntToScalar(kRoundedRectRadius), paint);
+ canvas->AsCanvasSkia()->drawRoundRect(
+ outer_rect, SkIntToScalar(kRoundedRectRadius),
+ SkIntToScalar(kRoundedRectRadius), paint);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
@@ -96,7 +97,7 @@ class DockView : public views::View {
bool rtl_ui = base::i18n::IsRTL();
if (rtl_ui) {
// Flip canvas to draw the mirrored tab images for RTL UI.
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->TranslateInt(width(), 0);
canvas->ScaleInt(-1, 1);
}
@@ -170,7 +171,7 @@ class DockView : public views::View {
break;
}
if (rtl_ui)
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
private:
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc
index e5c55a4..e0b13a1 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.cc
+++ b/chrome/browser/views/tabs/dragged_tab_view.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/views/tabs/dragged_tab_view.h"
#include "chrome/browser/views/tabs/native_view_photobooth.h"
-#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
#include "third_party/skia/include/core/SkShader.h"
#include "views/widget/widget.h"
@@ -186,8 +185,7 @@ void DraggedTabView::PaintAttachedTab(gfx::Canvas* canvas) {
void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) {
gfx::Size ps = GetPreferredSize();
- // TODO(beng): Convert to CanvasSkia
- gfx::Canvas scale_canvas(ps.width(), ps.height(), false);
+ gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false);
SkBitmap& bitmap_device = const_cast<SkBitmap&>(
scale_canvas.getTopPlatformDevice().accessBitmap(true));
bitmap_device.eraseARGB(0, 0, 0, 0);
@@ -229,7 +227,7 @@ void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) {
rc.fTop = 0;
rc.fRight = SkIntToScalar(ps.width());
rc.fBottom = SkIntToScalar(ps.height());
- canvas->drawRect(rc, paint);
+ canvas->AsCanvasSkia()->drawRect(rc, paint);
}
void DraggedTabView::PaintFocusRect(gfx::Canvas* canvas) {
diff --git a/chrome/browser/views/tabs/native_view_photobooth_win.cc b/chrome/browser/views/tabs/native_view_photobooth_win.cc
index 8920a9b..1eb3125 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_win.cc
+++ b/chrome/browser/views/tabs/native_view_photobooth_win.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/views/tabs/native_view_photobooth_win.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/point.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "views/widget/widget_win.h"
@@ -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->beginPlatformPaint();
+ HDC target_dc = canvas->AsCanvasSkia()->beginPlatformPaint();
HDC source_dc = GetDC(current_hwnd_);
RECT window_rect = {0};
GetWindowRect(current_hwnd_, &window_rect);
@@ -109,12 +109,11 @@ void NativeViewPhotoboothWin::PaintScreenshotIntoCanvas(
SRCCOPY);
// Windows screws up the alpha channel on all text it draws, and so we need
// to call makeOpaque _after_ the blit to correct for this.
- canvas->getTopPlatformDevice().makeOpaque(target_bounds.x(),
- target_bounds.y(),
- target_bounds.width(),
- target_bounds.height());
+ canvas->AsCanvasSkia()->getTopPlatformDevice().makeOpaque(
+ target_bounds.x(), target_bounds.y(), target_bounds.width(),
+ target_bounds.height());
ReleaseDC(current_hwnd_, source_dc);
- canvas->endPlatformPaint();
+ canvas->AsCanvasSkia()->endPlatformPaint();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc
index c2448d2..05036d6 100644
--- a/chrome/browser/views/tabs/side_tab.cc
+++ b/chrome/browser/views/tabs/side_tab.cc
@@ -8,7 +8,7 @@
#include "app/theme_provider.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/favicon_size.h"
#include "gfx/path.h"
#include "gfx/skia_util.h"
@@ -91,18 +91,20 @@ void SideTab::Paint(gfx::Canvas* canvas) {
paint.setAntiAlias(true);
SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0),
SkIntToScalar(width()), SkIntToScalar(height()) };
- canvas->drawRoundRect(border_rect, SkIntToScalar(kRoundRectRadius),
- SkIntToScalar(kRoundRectRadius), paint);
+ canvas->AsCanvasSkia()->drawRoundRect(border_rect,
+ SkIntToScalar(kRoundRectRadius),
+ SkIntToScalar(kRoundRectRadius),
+ paint);
}
if (ShouldShowIcon()) {
if (data().phantom) {
SkRect bounds;
bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
- canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha,
- SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ &bounds, kPhantomTabIconAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag);
PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else {
PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
}
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index afb7f6a..82ab751 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -13,7 +13,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/defaults.h"
-#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
#include "gfx/favicon_size.h"
#include "gfx/font.h"
@@ -382,18 +381,20 @@ void Tab::PaintTabBackground(gfx::Canvas* canvas) {
if (throb_value > 0) {
SkRect bounds;
bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
- canvas->saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff),
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ &bounds, static_cast<int>(throb_value * 0xff),
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255,
+ SkXfermode::kClear_Mode);
PaintActiveTabBackground(canvas);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
}
}
void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) {
// Render the inactive tab background. We'll use this for clipping.
- gfx::Canvas background_canvas(width(), height(), false);
+ gfx::CanvasSkia background_canvas(width(), height(), false);
PaintInactiveTabBackground(&background_canvas);
SkBitmap background_image = background_canvas.ExtractBitmap();
@@ -437,10 +438,10 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) {
// And then the gradient on top of that.
if (mini_title_animation_->current_part_index() == 2) {
- canvas->saveLayerAlpha(NULL,
- mini_title_animation_->CurrentValueBetween(255, 0));
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ NULL, mini_title_animation_->CurrentValueBetween(255, 0));
canvas->DrawBitmapInt(hover_image, 0, 0);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else {
canvas->DrawBitmapInt(hover_image, 0, 0);
}
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index b8aecf5..2d54f66 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_strip_controller.h"
#include "chrome/common/pref_names.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/path.h"
#include "gfx/size.h"
#include "grit/generated_resources.h"
@@ -294,31 +294,31 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) {
if (HasPhantomTabs()) {
SkRect bounds;
bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
- canvas->saveLayerAlpha(&bounds, kPhantomTabAlpha,
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ &bounds, kPhantomTabAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
for (int i = tab_count() - 1; i >= 0; --i) {
Tab* tab = GetTabAtTabDataIndex(i);
if (tab->data().phantom)
tab->ProcessPaint(canvas);
}
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
- canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha,
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->saveLayerAlpha(
+ &bounds, kPhantomTabIconAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
for (int i = tab_count() - 1; i >= 0; --i) {
Tab* tab = GetTabAtTabDataIndex(i);
if (tab->data().phantom) {
- canvas->save();
+ canvas->AsCanvasSkia()->save();
canvas->ClipRectInt(tab->MirroredX(), tab->y(), tab->width(),
tab->height());
canvas->TranslateInt(tab->MirroredX(), tab->y());
tab->PaintIcon(canvas);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
}
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
}
Tab* selected_tab = NULL;
diff --git a/chrome/browser/views/theme_install_bubble_view.cc b/chrome/browser/views/theme_install_bubble_view.cc
index 43871b1..4e54812 100644
--- a/chrome/browser/views/theme_install_bubble_view.cc
+++ b/chrome/browser/views/theme_install_bubble_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "gfx/canvas_skia.h"
#include "grit/generated_resources.h"
#include "views/widget/widget.h"
@@ -125,7 +126,7 @@ void ThemeInstallBubbleView::Paint(gfx::Canvas* canvas) {
SkIntToScalar(height()));
SkPath path;
path.addRoundRect(rect, rad, SkPath::kCW_Direction);
- canvas->drawPath(path, paint);
+ canvas->AsCanvasSkia()->drawPath(path, paint);
int text_width = views::Label::font().GetStringWidth(text_);
gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height());