diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 23:04:23 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 23:04:23 +0000 |
commit | 3024338797b31cd0e0357878bcd5b084e4a8af69 (patch) | |
tree | cf20d1d15f3907bb625a7cd1e465bbc47118821e /chrome | |
parent | 218f45da1c19e775cf72f46cc72f1c624927fd93 (diff) | |
download | chromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.zip chromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.tar.gz chromium_src-3024338797b31cd0e0357878bcd5b084e4a8af69.tar.bz2 |
Canvas refactoring part 2.
- Rename Canvas to CanvasSkia.
- Create a subclass Canvas that inherits from CanvasSkia for compatibility.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2862025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
28 files changed, 68 insertions, 51 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 2795e6e..55b7530 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -44,6 +44,7 @@ #include "chrome/common/notification_service.h" #include "googleurl/src/url_util.h" #include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "grit/generated_resources.h" #include "net/base/escape.h" #include "skia/ext/skia_utils_win.h" @@ -2176,7 +2177,7 @@ void AutocompleteEditViewWin::DrawSlashForInsecureScheme( // 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::Canvas canvas(scheme_rect.Width(), scheme_rect.Height(), false); + gfx::CanvasSkia canvas(scheme_rect.Width(), scheme_rect.Height(), false); canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0); // Calculate the start and end of the stroke, which are just the lower left diff --git a/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm b/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm index 964a76e..9f50222 100644 --- a/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm +++ b/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm @@ -12,7 +12,7 @@ #import "chrome/browser/cocoa/browser_window_controller.h" #import "chrome/browser/cocoa/themed_window.h" #include "chrome/browser/ntp_background_util.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" const CGFloat kBorderRadius = 3.0; @@ -54,7 +54,7 @@ const CGFloat kBorderRadius = 3.0; // Draw the background. { - // CanvasPaint draws to the NSGraphicsContext during its destructor, so + // CanvasSkiaPaint draws to the NSGraphicsContext during its destructor, so // explicitly scope this. // // Paint the entire bookmark bar, even if the damage rect is much smaller @@ -66,7 +66,7 @@ const CGFloat kBorderRadius = 3.0; // already repainting the rest of the bookmark bar below without setting a // clip area, anyway. Also, the only time we weren't asked to redraw the // whole bookmark bar is when the find bar is drawn over it. - gfx::CanvasPaint canvas(bounds, true); + gfx::CanvasSkiaPaint canvas(bounds, true); gfx::Rect area(0, 0, NSWidth(bounds), NSHeight(bounds)); NtpBackgroundUtil::PaintBackgroundDetachedMode(themeProvider, &canvas, diff --git a/chrome/browser/cocoa/download_item_cell.mm b/chrome/browser/cocoa/download_item_cell.mm index 6e14a27..c9843aba 100644 --- a/chrome/browser/cocoa/download_item_cell.mm +++ b/chrome/browser/cocoa/download_item_cell.mm @@ -15,7 +15,7 @@ #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_util.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "grit/theme_resources.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" @@ -562,7 +562,7 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const { // Draw progress disk { - // CanvasPaint draws its content to the current NSGraphicsContext in its + // CanvasSkiaPaint draws its content to the current NSGraphicsContext in its // destructor, which needs to be invoked before the icon is drawn below - // hence this nested block. @@ -575,7 +575,7 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const { download_util::kSmallProgressIconSize, download_util::kSmallProgressIconSize); - gfx::CanvasPaint canvas(dirtyRect, false); + gfx::CanvasSkiaPaint canvas(dirtyRect, false); canvas.set_composite_alpha(true); if (completionAnimation_.get()) { if ([completionAnimation_ isAnimating]) { diff --git a/chrome/browser/cocoa/extensions/browser_action_button.mm b/chrome/browser/cocoa/extensions/browser_action_button.mm index 914f11d..0a7dc46 100644 --- a/chrome/browser/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/cocoa/extensions/browser_action_button.mm @@ -19,7 +19,7 @@ #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_source.h" #include "chrome/common/notification_type.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/rect.h" #include "gfx/size.h" #include "skia/ext/skia_utils_mac.h" @@ -326,7 +326,7 @@ class ExtensionImageTrackerBridge : public NotificationObserver, } - (void)drawBadgeWithinFrame:(NSRect)frame { - gfx::CanvasPaint canvas(frame, false); + gfx::CanvasSkiaPaint canvas(frame, false); canvas.set_composite_alpha(true); gfx::Rect boundingRect(NSRectToCGRect(frame)); extensionAction_->PaintBadge(&canvas, boundingRect, tabId_); diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index f5c9f53..b4a6d77 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -41,7 +41,7 @@ #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/gtk_util.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" @@ -1267,7 +1267,7 @@ gboolean BookmarkBarGtk::OnEventBoxExpose(GtkWidget* widget, gfx::Size tab_contents_size; if (!GetTabContentsSize(&tab_contents_size)) return FALSE; - gfx::CanvasPaint canvas(event, true); + gfx::CanvasSkiaPaint canvas(event, true); gfx::Rect area = GTK_WIDGET_NO_WINDOW(widget) ? gfx::Rect(widget->allocation) : diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/gtk/bookmark_utils_gtk.cc index 4c4fb04..3b5c3b5 100644 --- a/chrome/browser/gtk/bookmark_utils_gtk.cc +++ b/chrome/browser/gtk/bookmark_utils_gtk.cc @@ -16,7 +16,7 @@ #include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/browser/gtk/gtk_util.h" #include "chrome/browser/profile.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/font.h" #include "gfx/gtk_util.h" @@ -135,7 +135,7 @@ gboolean OnDragIconExpose(GtkWidget* sender, cairo_destroy(cr); // Paint the title text. - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); int text_x = gdk_pixbuf_get_width(data->favicon) + kBarButtonPadding; int text_width = sender->allocation.width - text_x; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc index 2e023b2..f19c720 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc @@ -30,7 +30,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/notification_source.h" #include "chrome/common/notification_type.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/gtk_util.h" #include "grit/app_resources.h" @@ -278,7 +278,7 @@ class BrowserActionButton : public NotificationObserver, if (action->GetBadgeText(tab_id).empty()) return FALSE; - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); gfx::Rect bounding_rect(widget->allocation); action->PaintBadge(&canvas, bounding_rect, tab_id); return FALSE; diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc index a3cd9cd..6653b22 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_toolbar_gtk.cc @@ -48,7 +48,7 @@ #include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/gtk_util.h" #include "gfx/skbitmap_operations.h" #include "grit/chromium_strings.h" @@ -799,7 +799,7 @@ gboolean BrowserToolbarGtk::OnAppMenuImageExpose(GtkWidget* sender, } // Draw the chrome app menu icon onto the canvas. - gfx::CanvasPaint canvas(expose, false); + gfx::CanvasSkiaPaint canvas(expose, false); int x_offset = base::i18n::IsRTL() ? sender->allocation.width - kUpgradeDotOffset - badge.width() : kUpgradeDotOffset; diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc index f64b30f..1a4c9b9 100644 --- a/chrome/browser/gtk/download_item_gtk.cc +++ b/chrome/browser/gtk/download_item_gtk.cc @@ -27,7 +27,7 @@ #include "chrome/browser/gtk/menu_gtk.h" #include "chrome/browser/gtk/nine_box.h" #include "chrome/common/notification_service.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/color_utils.h" #include "gfx/font.h" #include "gfx/skia_utils_gtk.h" @@ -789,7 +789,7 @@ void DownloadItemGtk::OnClick(GtkWidget* widget) { gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget, GdkEventExpose* event) { // Create a transparent canvas. - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); if (complete_animation_.get()) { if (complete_animation_->is_animating()) { download_util::PaintDownloadComplete(&canvas, diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 421bd46..3972ab6 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -49,7 +49,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/font.h" #include "gfx/gtk_util.h" #include "grit/generated_resources.h" @@ -1395,7 +1395,7 @@ gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( if (badge_text.empty()) return FALSE; - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); gfx::Rect bounding_rect(widget->allocation); page_action_->PaintBadge(&canvas, bounding_rect, tab_id); return FALSE; diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc index 426ab43..52cb110 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc @@ -18,7 +18,6 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tabs/tab_strip_model.h" -#include "gfx/canvas_paint.h" #include "gfx/gtk_util.h" #include "third_party/skia/include/core/SkShader.h" diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index df16d83..7ab29e6 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -19,7 +19,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/favicon_size.h" #include "gfx/skbitmap_operations.h" #include "grit/app_resources.h" @@ -361,7 +361,7 @@ void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) { event->area.y = y() + favicon_bounds_.y(); event->area.width = favicon_bounds_.width(); event->area.height = favicon_bounds_.height(); - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); // The actual paint methods expect 0, 0 to be the tab top left (see // PaintTab). @@ -767,7 +767,7 @@ SkBitmap* TabRendererGtk::GetMaskedBitmap(const SkBitmap* mask, } void TabRendererGtk::PaintTab(GdkEventExpose* event) { - gfx::CanvasPaint canvas(event, false); + gfx::CanvasSkiaPaint canvas(event, false); if (canvas.is_empty()) return; diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 9c4019e..a05105a 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -22,7 +22,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" -#include "gfx/canvas_paint.h" #include "gfx/gtk_util.h" #include "gfx/point.h" #include "grit/app_resources.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 5090b38..06292e5 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -31,6 +31,7 @@ #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "gfx/gdi_util.h" #include "gfx/rect.h" #include "grit/webkit_resources.h" @@ -235,7 +236,7 @@ BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { void DrawDeemphasized(const gfx::Rect& paint_rect, HDC backing_store_dc, HDC paint_dc) { - gfx::Canvas canvas(paint_rect.width(), paint_rect.height(), true); + gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true); HDC dc = canvas.beginPlatformPaint(); BitBlt(dc, 0, @@ -685,7 +686,7 @@ void RenderWidgetHostViewWin::DrawResizeCorner(const gfx::Rect& paint_rect, if (!paint_rect.Intersect(resize_corner_rect).IsEmpty()) { SkBitmap* bitmap = ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_TEXTAREA_RESIZER); - gfx::Canvas canvas(bitmap->width(), bitmap->height(), false); + gfx::CanvasSkia canvas(bitmap->width(), bitmap->height(), false); canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0); int x = resize_corner_rect.x() + resize_corner_rect.width() - bitmap->width(); @@ -999,9 +1000,9 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, CPaintDC* dc) { if (!background_.empty()) { - gfx::Canvas canvas(dirty_rect.right - dirty_rect.left, - dirty_rect.bottom - dirty_rect.top, - true); // opaque + gfx::CanvasSkia canvas(dirty_rect.right - dirty_rect.left, + dirty_rect.bottom - dirty_rect.top, + true); // opaque canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); const RECT& dc_rect = dc->m_ps.rcPaint; diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 8f9334f2e..df9565c 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -16,6 +16,7 @@ #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" #include "gfx/path.h" @@ -764,6 +765,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); contents_canvas.drawColor(GetColor(NORMAL, BACKGROUND)); View::PaintChildren(&contents_canvas); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 1723f9f..0b97017 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -38,6 +38,7 @@ #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" #include "grit/theme_resources.h" @@ -1110,10 +1111,11 @@ 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); button->Paint(&canvas, true); - drag_utils::SetDragImageOnDataObject(canvas, button->size(), press_pt, - data); + drag_utils::SetDragImageOnDataObject(canvas, button->size(), + press_pt, data); WriteDragData(model_->GetBookmarkBarNode()->GetChild(i), data); return; } diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 18eef4e..e472de6 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -31,6 +31,7 @@ #include "chrome/common/notification_type.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" #include "third_party/skia/include/core/SkBitmap.h" @@ -322,13 +323,15 @@ 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); canvas->DrawBitmapInt(icon, 0, 0); if (tab_id >= 0) { gfx::Rect bounds = gfx::Rect(icon.width(), icon.height() + kControlVertOffset); - button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id); + button_->extension()->browser_action()->PaintBadge(canvas, + bounds, tab_id); } return canvas; diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h index 1b7dbed..ce7ed70 100644 --- a/chrome/browser/views/browser_actions_container.h +++ b/chrome/browser/views/browser_actions_container.h @@ -34,6 +34,10 @@ class ExtensionPopup; class PrefService; class Profile; +namespace gfx { +class CanvasSkia; +} + namespace views { class Menu2; } 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 894f159..0b66c13 100644 --- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc +++ b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc @@ -34,7 +34,7 @@ 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::Canvas> canvas(view->GetIconWithBadge()); + scoped_ptr<gfx::CanvasSkia> canvas(view->GetIconWithBadge()); menu_->AppendMenuItemWithIcon( command_id, UTF8ToWide(view->button()->extension()->name()), diff --git a/chrome/browser/views/infobars/extension_infobar.cc b/chrome/browser/views/infobars/extension_infobar.cc index 4f0f857..6a6be3f 100644 --- a/chrome/browser/views/infobars/extension_infobar.cc +++ b/chrome/browser/views/infobars/extension_infobar.cc @@ -13,7 +13,7 @@ #include "chrome/browser/views/frame/browser_view.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "grit/theme_resources.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_2.h" @@ -115,9 +115,10 @@ void ExtensionInfoBar::OnImageLoaded( SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); int image_size = Extension::EXTENSION_ICON_BITTY; - scoped_ptr<gfx::Canvas> canvas( - new gfx::Canvas(image_size + kDropArrowLeftMargin + drop_image->width(), - image_size, false)); + scoped_ptr<gfx::CanvasSkia> canvas( + new gfx::CanvasSkia( + image_size + kDropArrowLeftMargin + drop_image->width(), + image_size, false)); canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, image_size, image_size, diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index 0e626d6..fbaa37d5 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -8,6 +8,7 @@ #include "app/resource_bundle.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "gfx/size.h" #include "gfx/skia_util.h" #include "grit/generated_resources.h" @@ -89,7 +90,7 @@ void SadTabView::Layout() { int title_height = title_font_->height(); title_bounds_.SetRect(title_x, title_y, title_width_, title_height); - gfx::Canvas cc(0, 0, true); + gfx::CanvasSkia cc(0, 0, true); int message_width = static_cast<int>(width() * kMessageSize); int message_height = 0; cc.SizeStringInt(message_, *message_font_, &message_width, &message_height, diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc index 55f2a32..b3e8194d 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc @@ -21,7 +21,7 @@ #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" #include "chrome/browser/views/sad_tab_view.h" #include "chrome/browser/views/tab_contents/render_view_context_menu_views.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "gfx/point.h" #include "gfx/rect.h" #include "gfx/size.h" @@ -388,7 +388,7 @@ gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { gfx::Rect bounds; GetBounds(&bounds, true); sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height())); - gfx::CanvasPaint canvas(event); + gfx::CanvasSkiaPaint canvas(event); sad_tab_->ProcessPaint(&canvas); } return false; // False indicates other widgets should get the event as well. diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc index 39190f0..0774fea 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc @@ -25,7 +25,7 @@ #include "chrome/browser/views/sad_tab_view.h" #include "chrome/browser/views/tab_contents/render_view_context_menu_views.h" #include "chrome/browser/views/tab_contents/tab_contents_drag_win.h" -#include "gfx/canvas_paint.h" +#include "gfx/canvas_skia_paint.h" #include "views/focus/view_storage.h" #include "views/screen.h" #include "views/widget/root_view.h" @@ -392,7 +392,7 @@ void TabContentsViewWin::OnPaint(HDC junk_dc) { CRect cr; GetClientRect(&cr); sad_tab_->SetBounds(gfx::Rect(cr)); - gfx::CanvasPaint canvas(GetNativeView(), true); + gfx::CanvasSkiaPaint canvas(GetNativeView(), true); sad_tab_->ProcessPaint(&canvas); return; } diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index f3148c6..e5c55a4 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -6,6 +6,7 @@ #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" @@ -185,6 +186,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); SkBitmap& bitmap_device = const_cast<SkBitmap&>( scale_canvas.getTopPlatformDevice().accessBitmap(true)); diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index e4785be..afb7f6a 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -14,6 +14,7 @@ #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" #include "gfx/path.h" @@ -398,7 +399,7 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { SkBitmap background_image = background_canvas.ExtractBitmap(); // Draw a radial gradient to hover_canvas. - gfx::Canvas hover_canvas(width(), height(), false); + gfx::CanvasSkia hover_canvas(width(), height(), false); int radius = kMiniTitleChangeGradientRadius; int x0 = width() + radius - kMiniTitleChangeInitialXOffset; int x1 = radius; diff --git a/chrome/browser/views/theme_helpers.cc b/chrome/browser/views/theme_helpers.cc index 82de958..41f6db5 100644 --- a/chrome/browser/views/theme_helpers.cc +++ b/chrome/browser/views/theme_helpers.cc @@ -9,7 +9,7 @@ #include <atltheme.h> #include "base/logging.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "skia/ext/bitmap_platform_device_win.h" #include "third_party/skia/include/effects/SkGradientShader.h" @@ -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::Canvas canvas(width, 1, true); + gfx::CanvasSkia canvas(width, 1, true); // Render the Rebar gradient into the DIB CTheme theme; diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 3175922..c16908c 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -25,6 +25,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "gfx/skbitmap_operations.h" @@ -682,8 +683,8 @@ SkBitmap ToolbarView::GetAppMenuIcon() { return icon; // Draw the chrome app menu icon onto the canvas. - scoped_ptr<gfx::Canvas> canvas( - new gfx::Canvas(icon.width(), icon.height(), false)); + scoped_ptr<gfx::CanvasSkia> canvas( + new gfx::CanvasSkia(icon.width(), icon.height(), false)); canvas->DrawBitmapInt(icon, 0, 0); SkBitmap badge; diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 8b4068c..9fa30d1 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -30,7 +30,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "gfx/blit.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "gfx/native_widget_types.h" #include "gfx/size.h" #include "grit/generated_resources.h" @@ -1282,7 +1282,7 @@ void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, // Make a temporary canvas for the background image. const int width = plugin_rect_.width(); const int height = plugin_rect_.height(); - gfx::Canvas canvas(width, height, false); + gfx::CanvasSkia canvas(width, height, false); #if defined(OS_MACOSX) // Flip the canvas, since the context expects flipped data. canvas.translate(0, height); |