diff options
44 files changed, 92 insertions, 108 deletions
diff --git a/ash/app_list/drop_shadow_label.cc b/ash/app_list/drop_shadow_label.cc index 169890f..de1c90f 100644 --- a/ash/app_list/drop_shadow_label.cc +++ b/ash/app_list/drop_shadow_label.cc @@ -40,7 +40,7 @@ void DropShadowLabel::PaintText(gfx::Canvas* canvas, // when transfering contents on this canvas to target canvas. gfx::Size canvas_size(text_bounds.width() + drop_shadow_size_, text_bounds.height() + drop_shadow_size_); - gfx::CanvasSkia text_canvas(canvas_size, false); + gfx::Canvas text_canvas(canvas_size, false); const double kShadowOpacity = 0.2; const SkColor shadow_color = @@ -84,7 +84,7 @@ void DropShadowLabel::PaintText(gfx::Canvas* canvas, SkPaint paint; paint.setShader(s)->unref(); - gfx::CanvasSkia alpha_canvas(canvas_size, false); + gfx::Canvas alpha_canvas(canvas_size, false); alpha_canvas.DrawRect(gfx::Rect(canvas_size), paint); const SkBitmap& alpha_bitmap = const_cast<SkBitmap&>( diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index ff8ea97..82c4319 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -101,7 +101,7 @@ void LauncherButton::SetImage(const SkBitmap& image) { icon_view_->SetImage(&image); return; } - gfx::CanvasSkia canvas(gfx::Size(width, height), false); + gfx::Canvas canvas(gfx::Size(width, height), false); canvas.DrawBitmapInt(image, 0, 0, image.width(), image.height(), 0, 0, width, height, false); SkBitmap resized_image(canvas.ExtractBitmap()); diff --git a/build/common.gypi b/build/common.gypi index 6970fd9..ab23f94 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -271,7 +271,7 @@ 'enable_plugin_installation%': 1, # Specifies whether to use canvas_skia_skia.cc in place of platform - # specific implementations of CanvasSkia. Affects text drawing in the + # specific implementations of gfx::Canvas. Affects text drawing in the # Chrome UI. # TODO(asvitkine): Enable this on all platforms and delete this flag. # http://crbug.com/105550 diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc index 90b6e04..ae9379a 100644 --- a/chrome/browser/chromeos/login/username_view.cc +++ b/chrome/browser/chromeos/login/username_view.cc @@ -59,18 +59,16 @@ gfx::NativeCursor UsernameView::GetCursor(const views::MouseEvent& event) { void UsernameView::PaintUsername(const gfx::Rect& bounds) { margin_width_ = bounds.height() * kMarginRatio; - gfx::CanvasSkia canvas(bounds.size(), false); + gfx::Canvas canvas(bounds.size(), false); // Draw transparent background. canvas.sk_canvas()->drawColor(0); // Calculate needed space. - int flags = gfx::Canvas::TEXT_ALIGN_LEFT | - gfx::Canvas::TEXT_VALIGN_MIDDLE | - gfx::Canvas::NO_ELLIPSIS; + int flags = gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::TEXT_VALIGN_MIDDLE | + gfx::Canvas::NO_ELLIPSIS; int text_height, text_width; - gfx::CanvasSkia::SizeStringInt(GetText(), font(), - &text_width, &text_height, - flags); + gfx::Canvas::SizeStringInt(GetText(), font(), &text_width, &text_height, + flags); text_width += margin_width_; // Also leave the right margin. diff --git a/chrome/browser/chromeos/status/network_menu_icon.cc b/chrome/browser/chromeos/status/network_menu_icon.cc index a7c5734..46405b7 100644 --- a/chrome/browser/chromeos/status/network_menu_icon.cc +++ b/chrome/browser/chromeos/status/network_menu_icon.cc @@ -161,9 +161,9 @@ const SkBitmap& GetEmptyVpnBadge() { } const SkBitmap GetVpnResource(int resource_id) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); const SkBitmap* ethernet_icon = rb.GetBitmapNamed(resource_id); - gfx::CanvasSkia canvas( + gfx::Canvas canvas( gfx::Size(ethernet_icon->width(), ethernet_icon->height()), false); canvas.DrawBitmapInt(*ethernet_icon, 0, 0); const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); @@ -758,7 +758,7 @@ const SkBitmap NetworkMenuIcon::GenerateBitmapFromComponents( const SkBitmap* bottom_left_badge, const SkBitmap* bottom_right_badge) { DCHECK(!icon.empty()); - gfx::CanvasSkia canvas(icon, false); + gfx::Canvas canvas(icon, false); if (top_left_badge) { canvas.DrawBitmapInt(*top_left_badge, kBadgeLeftX, kBadgeTopY); diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc index 8227e03..37d17fe 100644 --- a/chrome/browser/extensions/extension_icon_manager.cc +++ b/chrome/browser/extensions/extension_icon_manager.cc @@ -25,10 +25,9 @@ namespace { // around the original bitmap. static SkBitmap ApplyPadding(const SkBitmap& source, const gfx::Insets& padding) { - scoped_ptr<gfx::CanvasSkia> result( - new gfx::CanvasSkia(gfx::Size(source.width() + padding.width(), - source.height() + padding.height()), - false)); + scoped_ptr<gfx::Canvas> result( + new gfx::Canvas(gfx::Size(source.width() + padding.width(), + source.height() + padding.height()), false)); result->DrawBitmapInt( source, 0, 0, source.width(), source.height(), diff --git a/chrome/browser/profiles/profile_info_util.cc b/chrome/browser/profiles/profile_info_util.cc index 7c1be96..ac6f50b 100644 --- a/chrome/browser/profiles/profile_info_util.cc +++ b/chrome/browser/profiles/profile_info_util.cc @@ -21,7 +21,7 @@ gfx::Image GetAvatarIconForMenu(const gfx::Image& image, int length = std::min(kAvatarIconWidth, kAvatarIconHeight) - 2; SkBitmap bmp = skia::ImageOperations::Resize( image, skia::ImageOperations::RESIZE_BEST, length, length); - gfx::CanvasSkia canvas(gfx::Size(kAvatarIconWidth, kAvatarIconHeight), false); + gfx::Canvas canvas(gfx::Size(kAvatarIconWidth, kAvatarIconHeight), false); // Draw the icon centered on the canvas. int x = (kAvatarIconWidth - length) / 2; @@ -43,7 +43,7 @@ gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, int length = std::min(kAvatarIconWidth, kAvatarIconHeight) - 2; SkBitmap bmp = skia::ImageOperations::Resize( image, skia::ImageOperations::RESIZE_BEST, length, length); - gfx::CanvasSkia canvas(gfx::Size(kAvatarIconWidth, kAvatarIconHeight), false); + gfx::Canvas canvas(gfx::Size(kAvatarIconWidth, kAvatarIconHeight), false); // Draw the icon centered on the canvas. int x = (kAvatarIconWidth - length) / 2; @@ -64,7 +64,7 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, std::min(dst_width, dst_height)) - 2; SkBitmap bmp = skia::ImageOperations::Resize( image, skia::ImageOperations::RESIZE_BEST, length, length); - gfx::CanvasSkia canvas(gfx::Size(dst_width, dst_height), false); + gfx::Canvas canvas(gfx::Size(dst_width, dst_height), false); // Draw the icon on the bottom center of the canvas. int x1 = (dst_width - length) / 2; diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index aa95f9d..051bbb4 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -29,7 +29,7 @@ TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_Empty) { TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_SingleColor) { const gfx::Size kSize(20, 10); - gfx::CanvasSkia canvas(kSize, true); + gfx::Canvas canvas(kSize, true); // Fill all pixesl in black. canvas.FillRect(gfx::Rect(kSize), SK_ColorBLACK); @@ -42,7 +42,7 @@ TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_SingleColor) { TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_TwoColors) { const gfx::Size kSize(20, 10); - gfx::CanvasSkia canvas(kSize, true); + gfx::Canvas canvas(kSize, true); // Fill all pixesl in black. canvas.FillRect(gfx::Rect(kSize), SK_ColorBLACK); // Fill the left half pixels in white. @@ -59,7 +59,7 @@ TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_TwoColors) { TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_TallerThanWide) { // The input bitmap is vertically long. - gfx::CanvasSkia canvas(gfx::Size(40, 90), true); + gfx::Canvas canvas(gfx::Size(40, 90), true); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); @@ -76,7 +76,7 @@ TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_TallerThanWide) { TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_WiderThanTall) { // The input bitmap is horizontally long. - gfx::CanvasSkia canvas(gfx::Size(90, 40), true); + gfx::Canvas canvas(gfx::Size(90, 40), true); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); @@ -93,7 +93,7 @@ TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_WiderThanTall) { TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_NotClipped) { // The input bitmap is square. - gfx::CanvasSkia canvas(gfx::Size(40, 40), true); + gfx::Canvas canvas(gfx::Size(40, 40), true); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); @@ -110,7 +110,7 @@ TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_NotClipped) { TEST_F(ThumbnailGeneratorTest, GetClippedBitmap_NonSquareOutput) { // The input bitmap is square. - gfx::CanvasSkia canvas(gfx::Size(40, 40), true); + gfx::Canvas canvas(gfx::Size(40, 40), true); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); diff --git a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm index 8faf73c..cff2141 100644 --- a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm @@ -100,8 +100,8 @@ class InfobarBridge : public ExtensionInfoBarDelegate::DelegateObserver, SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); const int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; - scoped_ptr<gfx::CanvasSkia> canvas( - new gfx::CanvasSkia( + scoped_ptr<gfx::Canvas> canvas( + new gfx::Canvas( gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(), image_size), false)); canvas->DrawBitmapInt(*icon, diff --git a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc index 7b36f6b..57f43ae 100644 --- a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc +++ b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc @@ -241,7 +241,7 @@ void AvatarMenuItemGtk::Init(ThemeServiceGtk* theme_service) { // of the profile icon. if (item_.active) { const SkBitmap* avatar_image = item_.icon.ToSkBitmap(); - gfx::CanvasSkia canvas(*avatar_image, /* is_opaque */ true); + gfx::Canvas canvas(*avatar_image, /* is_opaque */ true); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); SkBitmap check_image = rb.GetImageNamed(IDR_PROFILE_SELECTED); diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc index 43c3491..704cf6f 100644 --- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc @@ -83,10 +83,9 @@ void ExtensionInfoBarGtk::OnImageLoaded(const gfx::Image& image, int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; // The margin between the extension icon and the drop-down arrow bitmap. static const int kDropArrowLeftMargin = 3; - scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia( + scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas( gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), - image_size), - false)); + image_size), false)); canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, image_size, image_size, false); canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, diff --git a/chrome/browser/ui/gtk/theme_service_gtk.cc b/chrome/browser/ui/gtk/theme_service_gtk.cc index 1e12881..9410b4b 100644 --- a/chrome/browser/ui/gtk/theme_service_gtk.cc +++ b/chrome/browser/ui/gtk/theme_service_gtk.cc @@ -1000,8 +1000,7 @@ SkBitmap* ThemeServiceGtk::GenerateFrameImage( DCHECK(it != colors_.end()); SkColor base = it->second; - gfx::CanvasSkia canvas(gfx::Size(kToolbarImageWidth, kToolbarImageHeight), - true); + gfx::Canvas canvas(gfx::Size(kToolbarImageWidth, kToolbarImageHeight), true); int gradient_size; const GdkColor* gradient_top_color = NULL; diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h index 776d5b2..236d757 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h @@ -22,10 +22,6 @@ struct AutocompleteMatch; class AutocompleteResultView; class Profile; -namespace gfx { -class CanvasSkia; -} - namespace views { class BubbleBorder; } diff --git a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h index 84241f7..1007499 100644 --- a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h @@ -15,7 +15,6 @@ class OmniboxView; namespace gfx { class Canvas; -class CanvasSkia; } namespace views { diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc index e7a7c4f..febc552 100644 --- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc +++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc @@ -317,7 +317,7 @@ SkBitmap ProfileItemView::GetBadgedIcon(const SkBitmap& icon) { const float kBadgeOverlapRatioY = 1.0f / 3.0f; int height = icon_rect.height() + badge.height() * kBadgeOverlapRatioY; - gfx::CanvasSkia canvas(gfx::Size(width, height), false); + gfx::Canvas canvas(gfx::Size(width, height), false); canvas.DrawBitmapInt(icon, 0, 0, icon.width(), icon.height(), 0, 0, icon_rect.width(), icon_rect.height(), true); canvas.DrawBitmapInt(badge, width - badge.width(), height - badge.height()); diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc index ca26f29..26114e9 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.cc +++ b/chrome/browser/ui/views/infobars/extension_infobar.cc @@ -121,10 +121,9 @@ void ExtensionInfoBar::OnImageLoaded(const gfx::Image& image, int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; // The margin between the extension icon and the drop-down arrow bitmap. static const int kDropArrowLeftMargin = 3; - scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia( + scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas( gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), - image_size), - false)); + image_size), false)); canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, image_size, image_size, false); canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index 88cbf4b..3438ee3 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -2367,8 +2367,8 @@ void OmniboxViewWin::DrawSlashForInsecureScheme(HDC hdc, // Create a canvas as large as |scheme_rect| to do our drawing, and initialize // it to fully transparent so any antialiasing will look nice when painted // atop the edit. - gfx::CanvasSkia canvas(gfx::Size(scheme_rect.Width(), scheme_rect.Height()), - false); + gfx::Canvas canvas(gfx::Size(scheme_rect.Width(), scheme_rect.Height()), + false); SkCanvas* sk_canvas = canvas.sk_canvas(); sk_canvas->getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0); diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index a5798cb..a58ed32 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -385,7 +385,7 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { SkBitmap background_image = background_canvas.ExtractBitmap(); // Draw a radial gradient to hover_canvas. - gfx::CanvasSkia hover_canvas(size(), false); + gfx::Canvas hover_canvas(size(), false); int radius = kMiniTitleChangeGradientRadius; int x0 = width() + radius - kMiniTitleChangeInitialXOffset; int x1 = radius; @@ -453,10 +453,10 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ? 0 : background_offset_.y(); - // We need a CanvasSkia object to be able to extract the bitmap from. + // We need a gfx::Canvas object to be able to extract the bitmap from. // We draw everything to this canvas and then output it to the canvas // parameter in addition to using it to mask the hover glow if needed. - gfx::CanvasSkia background_canvas(size(), false); + gfx::Canvas background_canvas(size(), false); // Draw left edge. Don't draw over the toolbar, as we're not the foreground // tab. diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index e0d1a407..9eb4dec 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -230,7 +230,7 @@ SkBitmap NewTabButton::GetBackgroundBitmap( SkBitmap* mask = GetThemeProvider()->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); int height = mask->height(); int width = mask->width(); - gfx::CanvasSkia canvas(gfx::Size(width, height), false); + gfx::Canvas canvas(gfx::Size(width, height), false); // For custom images the background starts at the top of the tab strip. // Otherwise the background starts at the top of the frame. @@ -261,7 +261,7 @@ SkBitmap NewTabButton::GetBitmapForState( IDR_NEWTAB_BUTTON_P : IDR_NEWTAB_BUTTON; SkBitmap* overlay = GetThemeProvider()->GetBitmapNamed(overlay_id); - gfx::CanvasSkia canvas(gfx::Size(overlay->width(), overlay->height()), false); + gfx::Canvas canvas(gfx::Size(overlay->width(), overlay->height()), false); canvas.DrawBitmapInt(GetBackgroundBitmap(state), 0, 0); // Draw the button border with a slight alpha. diff --git a/chrome/browser/ui/views/theme_helpers.cc b/chrome/browser/ui/views/theme_helpers.cc index a522f1d..954a745 100644 --- a/chrome/browser/ui/views/theme_helpers.cc +++ b/chrome/browser/ui/views/theme_helpers.cc @@ -23,7 +23,7 @@ void GetRebarGradientColors(int width, int x1, int x2, // those so calling code can use them to create gradient brushes for use in // rendering in other directions. - gfx::CanvasSkia canvas(gfx::Size(width, 1), true); + gfx::Canvas canvas(gfx::Size(width, 1), true); // Render the Rebar gradient into the DIB CTheme theme; diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 442d05b..1432ccc 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -287,7 +287,7 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { return icon; // Draw the chrome app menu icon onto the canvas. - scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia(icon, false)); + scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas(icon, false)); SkBitmap badge; // Only one badge can be active at any given time. The Upgrade notification diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc index 2e689ce..ca8138d 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc @@ -57,7 +57,7 @@ SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) { SkBitmap bmp = skia::ImageOperations::Resize( image, skia::ImageOperations::RESIZE_BEST, length, length); - gfx::CanvasSkia canvas(gfx::Size(length, length), false); + gfx::Canvas canvas(gfx::Size(length, length), false); canvas.DrawBitmapInt(bmp, 0, 0); // Draw a gray border on the inside of the icon. diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc index f1d3ef4..0c7478e 100644 --- a/chrome/common/badge_util.cc +++ b/chrome/common/badge_util.cc @@ -84,8 +84,8 @@ SkBitmap DrawBadgeIconOverlay(const SkBitmap& icon, badge_width--; // Render the badge bitmap and overlay into a canvas. - scoped_ptr<gfx::CanvasSkia> canvas( - new gfx::CanvasSkia(gfx::Size(badge_width, icon.height()), false)); + scoped_ptr<gfx::Canvas> canvas( + new gfx::Canvas(gfx::Size(badge_width, icon.height()), false)); canvas->DrawBitmapInt(icon, 0, 0); // Draw the text overlay centered horizontally and vertically. Skia expects diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 7c979f3..69d9206 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -453,7 +453,7 @@ TEST_F(RenderWidgetHostTest, Background) { host_->SetView(view.get()); // Create a checkerboard background to test with. - gfx::CanvasSkia canvas(gfx::Size(4, 4), true); + gfx::Canvas canvas(gfx::Size(4, 4), true); canvas.FillRect(gfx::Rect(0, 0, 2, 2), SK_ColorBLACK); canvas.FillRect(gfx::Rect(2, 0, 2, 2), SK_ColorWHITE); canvas.FillRect(gfx::Rect(0, 2, 2, 2), SK_ColorWHITE); diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 33539a1..7b45563 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -1190,7 +1190,7 @@ void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, CPaintDC* dc) { if (!background_.empty()) { gfx::Rect dirty_area(dirty_rect); - gfx::CanvasSkia canvas(dirty_area.size(), true); + gfx::Canvas canvas(dirty_area.size(), true); canvas.Translate(gfx::Point().Subtract(dirty_area.origin())); gfx::Rect dc_rect(dc->m_ps.rcPaint); diff --git a/ui/base/clipboard/clipboard_gtk.cc b/ui/base/clipboard/clipboard_gtk.cc index f896edf..f069c8c 100644 --- a/ui/base/clipboard/clipboard_gtk.cc +++ b/ui/base/clipboard/clipboard_gtk.cc @@ -552,9 +552,8 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const { if (!pixbuf.get()) return SkBitmap(); - gfx::CanvasSkia canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()), - gdk_pixbuf_get_height(pixbuf.get())), - false); + gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()), + gdk_pixbuf_get_height(pixbuf.get())), false); { skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); cairo_t* context = scoped_platform_paint.GetPlatformSurface(); diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index d48e988..622a728 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -336,7 +336,7 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const { int width = [image size].width; int height = [image size].height; - gfx::CanvasSkia canvas(gfx::Size(width, height), false); + gfx::Canvas canvas(gfx::Size(width, height), false); { skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); CGContextRef gc = scoped_platform_paint.GetPlatformSurface(); diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index e1bc476..bd21708 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -549,9 +549,8 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const { const void* bitmap_bits = reinterpret_cast<const char*>(bitmap) + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD); - gfx::CanvasSkia canvas(gfx::Size(bitmap->bmiHeader.biWidth, - bitmap->bmiHeader.biHeight), - false); + gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth, + bitmap->bmiHeader.biHeight), false); { skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); HDC dc = scoped_platform_paint.GetPlatformSurface(); diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc index df611e1..bf21259 100644 --- a/ui/gfx/image/image.cc +++ b/ui/gfx/image/image.cc @@ -36,9 +36,8 @@ bool NSImageToSkBitmaps(NSImage* image, std::vector<const SkBitmap*>* bitmaps); #if defined(TOOLKIT_USES_GTK) const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) { CHECK(pixbuf); - gfx::CanvasSkia canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf), - gdk_pixbuf_get_height(pixbuf)), - /*is_opaque=*/false); + gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf), + gdk_pixbuf_get_height(pixbuf)), false); skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm index eae7c39..3670a0b 100644 --- a/ui/gfx/platform_font_mac.mm +++ b/ui/gfx/platform_font_mac.mm @@ -57,8 +57,8 @@ int PlatformFontMac::GetAverageCharacterWidth() const { } int PlatformFontMac::GetStringWidth(const string16& text) const { - return CanvasSkia::GetStringWidth(text, - Font(const_cast<PlatformFontMac*>(this))); + return Canvas::GetStringWidth(text, + Font(const_cast<PlatformFontMac*>(this))); } int PlatformFontMac::GetExpectedTextWidth(int length) const { diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc index f0ed5e4..90a3a09 100644 --- a/ui/gfx/platform_font_pango.cc +++ b/ui/gfx/platform_font_pango.cc @@ -235,8 +235,8 @@ int PlatformFontPango::GetAverageCharacterWidth() const { } int PlatformFontPango::GetStringWidth(const string16& text) const { - return CanvasSkia::GetStringWidth(text, - Font(const_cast<PlatformFontPango*>(this))); + return Canvas::GetStringWidth(text, + Font(const_cast<PlatformFontPango*>(this))); } int PlatformFontPango::GetExpectedTextWidth(int length) const { diff --git a/ui/gfx/platform_font_win.cc b/ui/gfx/platform_font_win.cc index 1911a47..b97da23 100644 --- a/ui/gfx/platform_font_win.cc +++ b/ui/gfx/platform_font_win.cc @@ -103,8 +103,8 @@ int PlatformFontWin::GetAverageCharacterWidth() const { } int PlatformFontWin::GetStringWidth(const string16& text) const { - return CanvasSkia::GetStringWidth(text, - Font(const_cast<PlatformFontWin*>(this))); + return Canvas::GetStringWidth(text, + Font(const_cast<PlatformFontWin*>(this))); } int PlatformFontWin::GetExpectedTextWidth(int length) const { diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc index 54fa78d4..da63caa 100644 --- a/ui/gfx/render_text_linux.cc +++ b/ui/gfx/render_text_linux.cc @@ -242,7 +242,7 @@ void RenderTextLinux::ResetLayout() { void RenderTextLinux::EnsureLayout() { if (layout_ == NULL) { - CanvasSkia canvas(display_rect().size(), false); + Canvas canvas(display_rect().size(), false); skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); @@ -253,7 +253,7 @@ void RenderTextLinux::EnsureLayout() { font_list().GetFontDescriptionString(), display_rect().width(), base::i18n::GetFirstStrongCharacterDirection(text()), - CanvasSkia::DefaultCanvasTextAlignment()); + Canvas::DefaultCanvasTextAlignment()); // No width set so that the x-axis position is relative to the start of the // text. ToViewPoint and ToTextPoint take care of the position conversion diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc index a1549eb..6339317 100644 --- a/ui/views/controls/button/text_button.cc +++ b/ui/views/controls/button/text_button.cc @@ -410,7 +410,7 @@ void TextButtonBase::CalculateTextSize(gfx::Size* text_size, int max_width) { if (!multi_line_) flags |= gfx::Canvas::NO_ELLIPSIS; - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, flags); + gfx::Canvas::SizeStringInt(text_, font_, &w, &h, flags); // Add 2 extra pixels to width and height when text halo is used. if (has_text_halo_) { @@ -509,7 +509,7 @@ void TextButtonBase::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { SkColor text_color = (show_multiple_icon_states_ && (state() == BS_HOT || state() == BS_PUSHED)) ? color_hover_ : color_; - int draw_string_flags = gfx::CanvasSkia::DefaultCanvasTextAlignment() | + int draw_string_flags = gfx::Canvas::DefaultCanvasTextAlignment() | ComputeCanvasStringFlags(); if (mode == PB_FOR_DRAG) { diff --git a/ui/views/controls/glow_hover_controller.cc b/ui/views/controls/glow_hover_controller.cc index d175b10..c998f34 100644 --- a/ui/views/controls/glow_hover_controller.cc +++ b/ui/views/controls/glow_hover_controller.cc @@ -69,8 +69,8 @@ void GlowHoverController::Draw(gfx::Canvas* canvas, return; // Draw a radial gradient to hover_canvas. - gfx::CanvasSkia hover_canvas( - gfx::Size(mask_image.width(), mask_image.height()), false); + gfx::Canvas hover_canvas(gfx::Size(mask_image.width(), mask_image.height()), + false); // Draw a radial gradient to hover_canvas. int radius = view_->width() / 3; diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc index 567d60e..17e82c2 100644 --- a/ui/views/controls/label.cc +++ b/ui/views/controls/label.cc @@ -214,8 +214,7 @@ int Label::GetHeightForWidth(int w) { w = std::max(0, w - GetInsets().width()); int h = font_.GetHeight(); - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, - ComputeDrawStringFlags()); + gfx::Canvas::SizeStringInt(text_, font_, &w, &h, ComputeDrawStringFlags()); return h + GetInsets().height(); } @@ -293,7 +292,7 @@ gfx::Size Label::GetTextSize() const { int flags = ComputeDrawStringFlags(); 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/ui/views/controls/menu/menu_image_util.cc b/ui/views/controls/menu/menu_image_util.cc index 931edc9..bd58755 100644 --- a/ui/views/controls/menu/menu_image_util.cc +++ b/ui/views/controls/menu/menu_image_util.cc @@ -31,8 +31,7 @@ const SkColor kIndicatorStroke = SkColorSetRGB(0, 0, 0); SkBitmap* CreateRadioButtonImage(bool selected) { // + 2 (1px on each side) to cover rounding error. - gfx::CanvasSkia canvas(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2), - false); + gfx::Canvas canvas(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2), false); canvas.Translate(gfx::Point(1, 1)); SkPoint gradient_points[3]; @@ -87,7 +86,7 @@ SkBitmap* GetRtlSubmenuArrowImage() { if (!kRtlArrow) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); const SkBitmap* r = rb.GetImageNamed(IDR_MENU_ARROW).ToSkBitmap(); - gfx::CanvasSkia canvas(gfx::Size(r->width(), r->height()), false); + gfx::Canvas canvas(gfx::Size(r->width(), r->height()), false); canvas.Scale(-1, 1); canvas.DrawBitmapInt(*r, - r->width(), 0); kRtlArrow = new SkBitmap(canvas.ExtractBitmap()); diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc index 47ae3ab..6536ef1 100644 --- a/ui/views/controls/menu/menu_win.cc +++ b/ui/views/controls/menu/menu_win.cc @@ -184,7 +184,7 @@ class MenuHostWindow : public ui::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::CanvasSkia canvas(data->icon, false); + gfx::Canvas canvas(data->icon, false); skia::DrawToNativeContext( canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc index 990c4f5..aa4adbd 100644 --- a/ui/views/controls/menu/native_menu_win.cc +++ b/ui/views/controls/menu/native_menu_win.cc @@ -248,7 +248,7 @@ class NativeMenuWin::MenuHostWindow { if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) { // We currently don't support items with both icons and checkboxes. DCHECK(type != ui::MenuModel::TYPE_CHECK); - gfx::CanvasSkia canvas(icon, false); + gfx::Canvas canvas(icon, false); skia::DrawToNativeContext( canvas.sk_canvas(), dc, draw_item_struct->rcItem.left + kItemLeftMargin, @@ -271,8 +271,8 @@ class NativeMenuWin::MenuHostWindow { int icon_y = kItemTopMargin + (height - kItemTopMargin - kItemBottomMargin - config.check_height) / 2; - gfx::CanvasSkia canvas(gfx::Size(config.check_width, - config.check_height), false); + gfx::Canvas canvas(gfx::Size(config.check_width, config.check_height), + false); NativeTheme::ExtraParams extra; extra.menu_check.is_radio = false; gfx::Rect bounds(0, 0, config.check_width, config.check_height); diff --git a/ui/views/controls/table/table_view_win.cc b/ui/views/controls/table/table_view_win.cc index e85d635..0ba1163 100644 --- a/ui/views/controls/table/table_view_win.cc +++ b/ui/views/controls/table/table_view_win.cc @@ -809,7 +809,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::CanvasSkia canvas(gfx::Size(kImageSize, kImageSize), false); + gfx::Canvas canvas(gfx::Size(kImageSize, kImageSize), false); { base::win::ScopedHICON empty_icon( IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap())); @@ -1154,11 +1154,11 @@ void TableView::PaintAltText() { HDC dc = GetDC(GetNativeControlHWND()); gfx::Font font = GetAltTextFont(); gfx::Rect bounds = GetAltTextBounds(); - gfx::CanvasSkia canvas(bounds.size(), false); + gfx::Canvas canvas(bounds.size(), false); // 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()); skia::DrawToNativeContext( canvas.sk_canvas(), dc, bounds.x(), bounds.y(), NULL); ReleaseDC(GetNativeControlHWND(), dc); @@ -1238,9 +1238,9 @@ 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::CanvasSkia canvas( - gfx::Size(icon_rect.right - icon_rect.left, - icon_rect.bottom - icon_rect.top), false); + gfx::Canvas canvas(gfx::Size(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/ui/views/controls/tree/tree_view_views.cc b/ui/views/controls/tree/tree_view_views.cc index 8e3f93f..4234676 100644 --- a/ui/views/controls/tree/tree_view_views.cc +++ b/ui/views/controls/tree/tree_view_views.cc @@ -562,7 +562,7 @@ void TreeView::ConfigureInternalNode(TreeModelNode* model_node, void TreeView::UpdateNodeTextWidth(InternalNode* node) { int width = 0, height = 0; - gfx::CanvasSkia::SizeStringInt(node->model_node()->GetTitle(), + gfx::Canvas::SizeStringInt(node->model_node()->GetTitle(), font_, &width, &height, gfx::Canvas::NO_ELLIPSIS); node->set_text_width(width); } diff --git a/ui/views/controls/tree/tree_view_win.cc b/ui/views/controls/tree/tree_view_win.cc index f2efc51..0547f6a 100644 --- a/ui/views/controls/tree/tree_view_win.cc +++ b/ui/views/controls/tree/tree_view_win.cc @@ -694,7 +694,7 @@ HIMAGELIST TreeView::CreateImageList() { // IDR_FOLDER_CLOSED if they aren't already. if (model_images[i].width() != width || model_images[i].height() != height) { - gfx::CanvasSkia canvas(gfx::Size(width, height), false); + gfx::Canvas canvas(gfx::Size(width, height), false); // Draw our icons into this canvas. int height_offset = (height - model_images[i].height()) / 2; @@ -749,7 +749,7 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, HDC dc = skia::BeginPlatformPaint(canvas.sk_canvas()); if (base::i18n::IsRTL()) { - // gfx::CanvasSkia ends up configuring the DC with a mode of + // 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 diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc index 0da14ec..3ffb589 100644 --- a/ui/views/examples/text_example.cc +++ b/ui/views/examples/text_example.cc @@ -96,7 +96,7 @@ class TextExample::TextExampleView : public View { text_flags_(0), halo_(false), fade_(false), - fade_mode_(gfx::CanvasSkia::TruncateFadeTail) { + fade_mode_(gfx::Canvas::TruncateFadeTail) { } virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { @@ -132,8 +132,8 @@ class TextExample::TextExampleView : public View { bool fade() const { return fade_; } void set_fade(bool fade) { fade_ = fade; } - gfx::CanvasSkia::TruncateFadeMode fade_mode() const { return fade_mode_; } - void set_fade_mode(gfx::CanvasSkia::TruncateFadeMode fade_mode) { + gfx::Canvas::TruncateFadeMode fade_mode() const { return fade_mode_; } + void set_fade_mode(gfx::Canvas::TruncateFadeMode fade_mode) { fade_mode_ = fade_mode; } @@ -163,7 +163,7 @@ class TextExample::TextExampleView : public View { bool fade_; // If |fade_| is |true|, fade mode parameter to |DrawFadeTruncatingString()|. - gfx::CanvasSkia::TruncateFadeMode fade_mode_; + gfx::Canvas::TruncateFadeMode fade_mode_; DISALLOW_COPY_AND_ASSIGN(TextExampleView); }; @@ -338,15 +338,15 @@ void TextExample::ItemChanged(Combobox* combo_box, break; #if defined(OS_WIN) case 2: - text_view_->set_fade_mode(gfx::CanvasSkia::TruncateFadeTail); + text_view_->set_fade_mode(gfx::Canvas::TruncateFadeTail); text_view_->set_fade(true); break; case 3: - text_view_->set_fade_mode(gfx::CanvasSkia::TruncateFadeHead); + text_view_->set_fade_mode(gfx::Canvas::TruncateFadeHead); text_view_->set_fade(true); break; case 4: - text_view_->set_fade_mode(gfx::CanvasSkia::TruncateFadeHeadAndTail); + text_view_->set_fade_mode(gfx::Canvas::TruncateFadeHeadAndTail); text_view_->set_fade(true); break; #endif diff --git a/ui/views/view_text_utils.cc b/ui/views/view_text_utils.cc index 8bd5e15..0ea27d7 100644 --- a/ui/views/view_text_utils.cc +++ b/ui/views/view_text_utils.cc @@ -111,7 +111,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, word = text; // Draw the whole text at once. int w = 0, h = 0; - gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags); + gfx::Canvas::SizeStringInt(word, font, &w, &h, flags); // If we exceed the boundaries, we need to wrap. WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds); @@ -123,7 +123,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, // draw the trailing space (if one exists after the LTR text) to the // left of the LTR string. if (ltr_within_rtl && word[word.size() - 1] == ' ') - x += gfx::CanvasSkia::GetStringWidth(ASCIIToUTF16(" "), font); + x += gfx::Canvas::GetStringWidth(ASCIIToUTF16(" "), font); } int y = position->height() + bounds.y(); |