diff options
Diffstat (limited to 'chrome/browser')
35 files changed, 159 insertions, 169 deletions
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc index f6213ec..09c84f3 100644 --- a/chrome/browser/chromeos/status/network_menu_button.cc +++ b/chrome/browser/chromeos/status/network_menu_button.cc @@ -12,7 +12,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/options/network_config_view.h" #include "chrome/browser/chromeos/status/status_area_host.h" -#include "gfx/canvas_skia.h" +#include "gfx/canvas.h" #include "gfx/skbitmap_operations.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -387,7 +387,7 @@ SkBitmap NetworkMenuButton::IconForDisplay(SkBitmap icon, SkBitmap badge) { static const int kBadgeX = 14; static const int kBadgeY = 14; - gfx::CanvasSkia canvas(kIconWidth, kIconHeight, false); + gfx::Canvas canvas(kIconWidth, kIconHeight, false); canvas.DrawBitmapInt(icon, kIconX, kIconY); if (!badge.empty()) canvas.DrawBitmapInt(badge, kBadgeX, kBadgeY); diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 0042b75..0972ddc 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -27,7 +27,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/time_format.h" -#include "gfx/canvas_skia.h" +#include "gfx/canvas.h" #include "gfx/rect.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -225,7 +225,7 @@ void PaintDownloadProgress(gfx::Canvas* canvas, foreground_paint.setShader(shader); foreground_paint.setAntiAlias(true); shader->unref(); - canvas->AsCanvasSkia()->drawPath(path, foreground_paint); + canvas->drawPath(path, foreground_paint); return; } @@ -271,13 +271,12 @@ void PaintDownloadComplete(gfx::Canvas* canvas, SkIntToScalar(complete_bounds.y()), SkIntToScalar(complete_bounds.x() + complete_bounds.width()), SkIntToScalar(complete_bounds.y() + complete_bounds.height())); - canvas->AsCanvasSkia()->saveLayerAlpha( - &bounds, - static_cast<int>(255.0 * opacity), - SkCanvas::kARGB_ClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, + static_cast<int>(255.0 * opacity), + SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); canvas->DrawBitmapInt(*complete, complete_bounds.x(), complete_bounds.y()); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } // Load a language dependent height so that the dangerous download confirmation diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 5bd5ec8..7ab29e6 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -619,13 +619,13 @@ void TabRendererGtk::Paint(gfx::Canvas* canvas) { } SkBitmap TabRendererGtk::PaintBitmap() { - gfx::CanvasSkia canvas(width(), height(), false); + gfx::Canvas canvas(width(), height(), false); Paint(&canvas); return canvas.ExtractBitmap(); } cairo_surface_t* TabRendererGtk::PaintToSurface() { - gfx::CanvasSkia canvas(width(), height(), false); + gfx::Canvas canvas(width(), height(), false); Paint(&canvas); return cairo_surface_reference(cairo_get_target(canvas.beginPlatformPaint())); } @@ -804,7 +804,7 @@ void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { if (loading_animation_.animation_state() != ANIMATION_NONE) { PaintLoadingAnimation(canvas); } else { - canvas->AsCanvasSkia()->save(); + canvas->save(); canvas->ClipRectInt(0, 0, width(), height() - kFavIconTitleSpacing); if (should_display_crashed_favicon_) { canvas->DrawBitmapInt(*crashed_fav_icon, 0, 0, @@ -818,9 +818,8 @@ void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { if (!data_.favicon.isNull()) { if (data_.is_default_favicon && theme_provider_->UseGtkTheme()) { GdkPixbuf* favicon = GtkThemeProvider::GetDefaultFavicon(true); - canvas->AsCanvasSkia()->DrawGdkPixbuf( - favicon, favicon_bounds_.x(), - favicon_bounds_.y() + fav_icon_hiding_offset_); + canvas->DrawGdkPixbuf(favicon, favicon_bounds_.x(), + favicon_bounds_.y() + fav_icon_hiding_offset_); } else { // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch // to using that class to render the favicon). @@ -834,7 +833,7 @@ void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { } } } - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } } @@ -848,13 +847,11 @@ void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) { if (throb_value > 0) { SkRect bounds; bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height())); - canvas->AsCanvasSkia()->saveLayerAlpha( - &bounds, static_cast<int>(throb_value * 0xff), - SkCanvas::kARGB_ClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, - SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff), + SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); PaintActiveTabBackground(canvas); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } } } diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc index 4ea8193..b6e4326 100644 --- a/chrome/browser/renderer_host/render_widget_host_unittest.cc +++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/renderer_host/render_widget_host_painting_observer.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/render_messages.h" -#include "gfx/canvas_skia.h" +#include "gfx/canvas.h" #include "testing/gtest/include/gtest/gtest.h" using base::TimeDelta; @@ -406,7 +406,7 @@ TEST_F(RenderWidgetHostTest, Background) { host_->set_view(view.get()); // Create a checkerboard background to test with. - gfx::CanvasSkia canvas(4, 4, true); + gfx::Canvas canvas(4, 4, true); canvas.FillRectInt(SK_ColorBLACK, 0, 0, 2, 2); canvas.FillRectInt(SK_ColorWHITE, 2, 0, 2, 2); canvas.FillRectInt(SK_ColorWHITE, 0, 2, 2, 2); diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 17d243c..df9565c 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -15,6 +15,7 @@ #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" @@ -272,7 +273,7 @@ AutocompleteResultView::~AutocompleteResultView() { void AutocompleteResultView::Paint(gfx::Canvas* canvas) { const ResultViewState state = GetState(); if (state != NORMAL) - canvas->AsCanvasSkia()->drawColor(GetColor(state, BACKGROUND)); + canvas->drawColor(GetColor(state, BACKGROUND)); // Paint the icon. canvas->DrawBitmapInt(*GetIcon(), MirroredLeftPointForRect(icon_bounds_), @@ -764,7 +765,8 @@ 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. - gfx::CanvasSkia contents_canvas(width(), height(), true); + // TODO(beng): Convert to CanvasSkia + gfx::Canvas 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 @@ -786,7 +788,7 @@ void AutocompletePopupContentsView::Paint(gfx::Canvas* canvas) { gfx::Path path; MakeContentsPath(&path, GetLocalBounds(false)); - canvas->AsCanvasSkia()->drawPath(path, paint); + canvas->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 @@ -933,9 +935,8 @@ void AutocompletePopupContentsView::MakeCanvasTransparent( // Allow the window blur effect to show through the popup background. SkAlpha alpha = GetThemeProvider()->ShouldUseNativeFrame() ? kGlassPopupAlpha : kOpaquePopupAlpha; - canvas->AsCanvasSkia()->drawColor( - SkColorSetA(GetColor(NORMAL, BACKGROUND), alpha), - SkXfermode::kDstIn_Mode); + canvas->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 e595529..0b97017 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -37,6 +37,7 @@ #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" @@ -242,7 +243,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); } @@ -1110,7 +1111,8 @@ void BookmarkBarView::WriteDragData(View* sender, for (int i = 0; i < GetBookmarkButtonCount(); ++i) { if (sender == GetBookmarkButton(i)) { views::TextButton* button = GetBookmarkButton(i); - gfx::CanvasSkia canvas(button->width(), button->height(), false); + // 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); diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 78cf623..e472de6 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(); - gfx::Canvas* canvas = - new gfx::CanvasSkia(icon.width(), icon.height(), false); + // 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) { diff --git a/chrome/browser/views/bubble_border.cc b/chrome/browser/views/bubble_border.cc index e37f5fe..49c53b6 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawPath(path, paint); + canvas->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->AsCanvasSkia()->drawPath(path, paint); + canvas->drawPath(path, paint); } diff --git a/chrome/browser/views/create_application_shortcut_view.cc b/chrome/browser/views/create_application_shortcut_view.cc index b0a66b3..0d3f6e2 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawRoundRect( - border_rect, SkIntToScalar(2), SkIntToScalar(2), border_paint); + canvas->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->AsCanvasSkia()->drawRoundRect( - inner_rect, SkIntToScalar(1.5), SkIntToScalar(1.5), inner_paint); + canvas->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 ba44f3d..2e3e457 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawRoundRect( + canvas->drawRoundRect( rect, SkDoubleToScalar(roundness), SkDoubleToScalar(roundness), paint); } @@ -85,9 +85,9 @@ void DetachableToolbarView::PaintContentAreaBorder( border_paint.setAlpha(96); border_paint.setAntiAlias(true); - canvas->AsCanvasSkia()->drawRoundRect( - rect, SkDoubleToScalar(roundness), SkDoubleToScalar(roundness), - border_paint); + canvas->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->AsCanvasSkia()->drawRect(rc, paint); + canvas->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->AsCanvasSkia()->drawRect(rc_down, paint_down); + canvas->drawRect(rc_down, paint_down); } diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index edab6a5..d519783 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->save(); + canvas->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->AsCanvasSkia()->saveLayerAlpha(NULL, + canvas->saveLayerAlpha(NULL, static_cast<int>(body_hover_animation_->GetCurrentValue() * 255), SkCanvas::kARGB_NoClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); 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->AsCanvasSkia()->restore(); + canvas->restore(); if (rtl_ui) { - canvas->AsCanvasSkia()->restore(); - canvas->AsCanvasSkia()->save(); + canvas->restore(); + canvas->save(); // Flip it for drawing drop-down images for RTL locales. canvas->TranslateInt(width(), 0); canvas->ScaleInt(-1, 1); @@ -578,19 +578,17 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) { // Overlay our drop-down hot state. if (drop_hover_animation_->GetCurrentValue() > 0) { - canvas->AsCanvasSkia()->saveLayerAlpha( - NULL, + canvas->saveLayerAlpha(NULL, static_cast<int>(drop_hover_animation_->GetCurrentValue() * 255), SkCanvas::kARGB_NoClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, - SkXfermode::kClear_Mode); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); 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->AsCanvasSkia()->restore(); + canvas->restore(); } } @@ -598,7 +596,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->AsCanvasSkia()->restore(); + canvas->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 aa072f6..0b66c13 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_skia.h" +#include "gfx/canvas.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::Canvas> canvas(view->GetIconWithBadge()); + scoped_ptr<gfx::CanvasSkia> canvas(view->GetIconWithBadge()); menu_->AppendMenuItemWithIcon( command_id, UTF8ToWide(view->button()->extension()->name()), - canvas->AsCanvasSkia()->ExtractBitmap()); + canvas->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 7bb5391..e06b494 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -24,7 +24,6 @@ #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" @@ -943,15 +942,13 @@ void ExtensionShelf::InitBackground(gfx::Canvas* canvas) { for (int i = 0; i < count; ++i) { ExtensionView* view = ToolstripAtIndex(i)->view(); - const SkBitmap& background = - canvas->AsCanvasSkia()->getDevice()->accessBitmap(false); + const SkBitmap& background = canvas->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->AsCanvasSkia()->getTotalMatrix().mapRect(&mapped_subset); + bool result = canvas->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 caca13a..343519e 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->save(); + canvas->save(); } canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), height() - bitmap->height()); if (rtl_dir) - canvas->AsCanvasSkia()->restore(); + canvas->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 b37552e..d65cbc3 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->save(); + canvas->save(); canvas->ClipRectInt(x - kNonClientBorderThickness, y - kNonClientBorderThickness, kNonClientBorderThickness, kNonClientBorderThickness); canvas->DrawBitmapInt(*toolbar_left, x - kNonClientBorderThickness, y - kNonClientBorderThickness); - canvas->AsCanvasSkia()->restore(); + canvas->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->AsCanvasSkia()->save(); + canvas->save(); canvas->ClipRectInt(x + w - kNonClientBorderThickness, y - kNonClientBorderThickness, kNonClientBorderThickness, kNonClientBorderThickness); canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), x + w, y); - canvas->AsCanvasSkia()->restore(); + canvas->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->AsCanvasSkia()->save(); + canvas->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->AsCanvasSkia()->restore(); + canvas->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 227205f..d18375a 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->save(); + canvas->save(); canvas->ClipRectInt(0, 2, width(), otr_avatar_icon_->height() - 10); child->ProcessPaint(canvas); - canvas->AsCanvasSkia()->restore(); + canvas->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->AsCanvasSkia()->saveLayerAlpha(&bounds, 255); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, 255); + canvas->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->AsCanvasSkia()->restore(); + canvas->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 e216bd2..c12326a 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawPath(path, paint); + canvas->drawPath(path, paint); } diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 34645a0..7f1b4f2 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawPath(path, paint); + canvas->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 d344b88..aa89609 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_skia.h" +#include "gfx/canvas.h" #include "grit/app_resources.h" #include "views/controls/button/menu_button.h" #include "views/controls/image_view.h" @@ -148,12 +148,11 @@ 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->AsCanvasSkia()->saveLayerAlpha( - NULL, static_cast<int>(animation_value * 255), - SkCanvas::kARGB_NoClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(NULL, static_cast<int>(animation_value * 255), + SkCanvas::kARGB_NoClipLayer_SaveFlag); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); background.Paint(canvas, this); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } // TranslateInfoBarDelegate views specific method: diff --git a/chrome/browser/views/infobars/translate_infobars.cc b/chrome/browser/views/infobars/translate_infobars.cc index e395c39..08d4a0f 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_skia.h" +#include "gfx/canvas.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -757,12 +757,11 @@ 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->AsCanvasSkia()->saveLayerAlpha( - NULL, static_cast<int>(animation_value * 255), + canvas->saveLayerAlpha(NULL, static_cast<int>(animation_value * 255), SkCanvas::kARGB_NoClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); GetBackground(state)->Paint(canvas, this); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } inline TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() const { diff --git a/chrome/browser/views/list_background.h b/chrome/browser/views/list_background.h index fb10067..ba8317a 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->beginPlatformPaint(); + HDC dc = canvas->beginPlatformPaint(); RECT native_lb = view->GetLocalBounds(true).ToRECT(); gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb); - canvas->AsCanvasSkia()->endPlatformPaint(); + canvas->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 09c1007..77a459f 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_skia.h" +#include "gfx/canvas.h" #include "gfx/color_utils.h" #include "gfx/skia_util.h" #include "grit/generated_resources.h" @@ -556,8 +556,7 @@ void LocationBarView::Paint(gfx::Canvas* canvas) { // below, and all our other bubbles. const SkScalar radius(SkIntToScalar(BubbleBorder::GetCornerRadius())); bounds.Inset(kEdgeThickness, 0); - canvas->AsCanvasSkia()->drawRoundRect(gfx::RectToSkRect(bounds), radius, - radius, paint); + canvas->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 68c6570..2c362d0 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawPath(path, paint); + canvas->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 88dc660..b8b88cb 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->beginPlatformPaint(); + HDC dc = canvas->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->AsCanvasSkia()->endPlatformPaint(); + canvas->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 df5b832..4fd923e 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->beginPlatformPaint(); + HDC dc = canvas->beginPlatformPaint(); RECT rect = { 0, 0, width(), height() }; gfx::NativeTheme::instance()->PaintTextField( dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), true, true); - canvas->AsCanvasSkia()->endPlatformPaint(); + canvas->endPlatformPaint(); } void FontDisplayView::Layout() { diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index e02d975..fbaa37d5 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -57,8 +57,9 @@ void SadTabView::Paint(gfx::Canvas* canvas) { kBackgroundColor, kBackgroundEndColor))->safeUnref(); paint.setStyle(SkPaint::kFill_Style); - canvas->AsCanvasSkia()->drawRectCoords( - 0, 0, SkIntToScalar(width()), SkIntToScalar(height()), paint); + canvas->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 71be04d..5026c49 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->drawPath(shadow_path, shadow_paint); + canvas->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->AsCanvasSkia()->drawPath(path, paint); + canvas->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 58e853f..04124ed 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->save(); + canvas->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->AsCanvasSkia()->restore(); + canvas->restore(); } } diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index 5778f0b..bb97cd6 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_skia.h" +#include "gfx/canvas.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "views/event.h" @@ -85,9 +85,8 @@ class DockView : public views::View { SkPaint paint; paint.setColor(SkColorSetRGB(108, 108, 108)); paint.setStyle(SkPaint::kFill_Style); - canvas->AsCanvasSkia()->drawRoundRect( - outer_rect, SkIntToScalar(kRoundedRectRadius), - SkIntToScalar(kRoundedRectRadius), paint); + canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), + SkIntToScalar(kRoundedRectRadius), paint); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -97,7 +96,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->AsCanvasSkia()->save(); + canvas->save(); canvas->TranslateInt(width(), 0); canvas->ScaleInt(-1, 1); } @@ -171,7 +170,7 @@ class DockView : public views::View { break; } if (rtl_ui) - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } private: diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index e0b13a1..e5c55a4 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -5,6 +5,7 @@ #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" @@ -185,7 +186,8 @@ void DraggedTabView::PaintAttachedTab(gfx::Canvas* canvas) { void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { gfx::Size ps = GetPreferredSize(); - gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false); + // 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)); bitmap_device.eraseARGB(0, 0, 0, 0); @@ -227,7 +229,7 @@ void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { rc.fTop = 0; rc.fRight = SkIntToScalar(ps.width()); rc.fBottom = SkIntToScalar(ps.height()); - canvas->AsCanvasSkia()->drawRect(rc, paint); + canvas->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 1eb3125..8920a9b 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->beginPlatformPaint(); + HDC target_dc = canvas->beginPlatformPaint(); HDC source_dc = GetDC(current_hwnd_); RECT window_rect = {0}; GetWindowRect(current_hwnd_, &window_rect); @@ -109,11 +109,12 @@ 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->AsCanvasSkia()->getTopPlatformDevice().makeOpaque( - target_bounds.x(), target_bounds.y(), target_bounds.width(), - target_bounds.height()); + canvas->getTopPlatformDevice().makeOpaque(target_bounds.x(), + target_bounds.y(), + target_bounds.width(), + target_bounds.height()); ReleaseDC(current_hwnd_, source_dc); - canvas->AsCanvasSkia()->endPlatformPaint(); + canvas->endPlatformPaint(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc index 05036d6..c2448d2 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_skia.h" +#include "gfx/canvas.h" #include "gfx/favicon_size.h" #include "gfx/path.h" #include "gfx/skia_util.h" @@ -91,20 +91,18 @@ void SideTab::Paint(gfx::Canvas* canvas) { paint.setAntiAlias(true); SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(width()), SkIntToScalar(height()) }; - canvas->AsCanvasSkia()->drawRoundRect(border_rect, - SkIntToScalar(kRoundRectRadius), - SkIntToScalar(kRoundRectRadius), - paint); + canvas->drawRoundRect(border_rect, SkIntToScalar(kRoundRectRadius), + SkIntToScalar(kRoundRectRadius), paint); } if (ShouldShowIcon()) { if (data().phantom) { SkRect bounds; bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height())); - canvas->AsCanvasSkia()->saveLayerAlpha( - &bounds, kPhantomTabIconAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha, + SkCanvas::kARGB_ClipLayer_SaveFlag); PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y()); - canvas->AsCanvasSkia()->restore(); + canvas->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 82ab751..afb7f6a 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -13,6 +13,7 @@ #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" @@ -381,20 +382,18 @@ void Tab::PaintTabBackground(gfx::Canvas* canvas) { if (throb_value > 0) { SkRect bounds; bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height())); - canvas->AsCanvasSkia()->saveLayerAlpha( - &bounds, static_cast<int>(throb_value * 0xff), - SkCanvas::kARGB_ClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, - SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff), + SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); PaintActiveTabBackground(canvas); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } } } void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { // Render the inactive tab background. We'll use this for clipping. - gfx::CanvasSkia background_canvas(width(), height(), false); + gfx::Canvas background_canvas(width(), height(), false); PaintInactiveTabBackground(&background_canvas); SkBitmap background_image = background_canvas.ExtractBitmap(); @@ -438,10 +437,10 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { // And then the gradient on top of that. if (mini_title_animation_->current_part_index() == 2) { - canvas->AsCanvasSkia()->saveLayerAlpha( - NULL, mini_title_animation_->CurrentValueBetween(255, 0)); + canvas->saveLayerAlpha(NULL, + mini_title_animation_->CurrentValueBetween(255, 0)); canvas->DrawBitmapInt(hover_image, 0, 0); - canvas->AsCanvasSkia()->restore(); + canvas->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 2d54f66..b8aecf5 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_skia.h" +#include "gfx/canvas.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->AsCanvasSkia()->saveLayerAlpha( - &bounds, kPhantomTabAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, kPhantomTabAlpha, + SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->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->AsCanvasSkia()->restore(); + canvas->restore(); - canvas->AsCanvasSkia()->saveLayerAlpha( - &bounds, kPhantomTabIconAlpha, SkCanvas::kARGB_ClipLayer_SaveFlag); - canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); + canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha, + SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->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->AsCanvasSkia()->save(); + canvas->save(); canvas->ClipRectInt(tab->MirroredX(), tab->y(), tab->width(), tab->height()); canvas->TranslateInt(tab->MirroredX(), tab->y()); tab->PaintIcon(canvas); - canvas->AsCanvasSkia()->restore(); + canvas->restore(); } } - canvas->AsCanvasSkia()->restore(); + canvas->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 4e54812..43871b1 100644 --- a/chrome/browser/views/theme_install_bubble_view.cc +++ b/chrome/browser/views/theme_install_bubble_view.cc @@ -7,7 +7,6 @@ #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" @@ -126,7 +125,7 @@ void ThemeInstallBubbleView::Paint(gfx::Canvas* canvas) { SkIntToScalar(height())); SkPath path; path.addRoundRect(rect, rad, SkPath::kCW_Direction); - canvas->AsCanvasSkia()->drawPath(path, paint); + canvas->drawPath(path, paint); int text_width = views::Label::font().GetStringWidth(text_); gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height()); |