Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2711)

Unified Diff: chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc (revision 82144)
+++ chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc (working copy)
@@ -26,6 +26,7 @@
#include "ui/base/animation/throb_animation.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/canvas_skia_paint.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/platform_font_gtk.h"
@@ -377,11 +378,12 @@
event->area.y = y() + favicon_bounds_.y();
event->area.width = favicon_bounds_.width();
event->area.height = favicon_bounds_.height();
- gfx::CanvasSkiaPaint canvas(event, false);
+ gfx::CanvasSkiaPaint canvas_paint(event, false);
+ gfx::CanvasSkia* canvas = canvas_paint.AsCanvas()->AsCanvasSkia();
// The actual paint methods expect 0, 0 to be the tab top left (see
// PaintTab).
- canvas.TranslateInt(x(), y());
+ canvas->TranslateInt(x(), y());
// Paint the background behind the favicon.
int theme_id;
@@ -398,7 +400,7 @@
offset_y = background_offset_y_;
}
SkBitmap* tab_bg = theme_service_->GetBitmapNamed(theme_id);
- canvas.TileImageInt(*tab_bg,
+ canvas->TileImageInt(*tab_bg,
x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(),
favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.width(), favicon_bounds_.height());
@@ -409,20 +411,22 @@
SkRect bounds;
bounds.set(favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.right(), favicon_bounds_.bottom());
- canvas.saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff),
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->skia_canvas()->saveLayerAlpha(&bounds,
+ static_cast<int>(throb_value * 0xff),
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas->skia_canvas()->drawARGB(
+ 0, 255, 255, 255, SkXfermode::kClear_Mode);
SkBitmap* active_bg = theme_service_->GetBitmapNamed(IDR_THEME_TOOLBAR);
- canvas.TileImageInt(*active_bg,
+ canvas->TileImageInt(*active_bg,
x() + favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.width(), favicon_bounds_.height());
- canvas.restore();
+ canvas->Restore();
}
}
// Now paint the icon.
- PaintIcon(&canvas);
+ PaintIcon(canvas);
}
bool TabRendererGtk::ShouldShowIcon() const {
@@ -643,15 +647,17 @@
}
SkBitmap TabRendererGtk::PaintBitmap() {
- gfx::CanvasSkia canvas(width(), height(), false);
+ gfx::CanvasSkia canvas;
+ canvas.Init(width(), height(), false);
Paint(&canvas);
return canvas.ExtractBitmap();
}
cairo_surface_t* TabRendererGtk::PaintToSurface() {
- gfx::CanvasSkia canvas(width(), height(), false);
+ gfx::CanvasSkia canvas;
+ canvas.Init(width(), height(), false);
Paint(&canvas);
- return cairo_surface_reference(cairo_get_target(canvas.beginPlatformPaint()));
+ return cairo_surface_reference(cairo_get_target(canvas.BeginPlatformPaint()));
}
void TabRendererGtk::SchedulePaint() {
@@ -791,19 +797,20 @@
}
void TabRendererGtk::PaintTab(GdkEventExpose* event) {
- gfx::CanvasSkiaPaint canvas(event, false);
- if (canvas.is_empty())
+ gfx::CanvasSkiaPaint canvas_paint(event, false);
+ if (canvas_paint.IsValid())
return;
+ gfx::Canvas* canvas = canvas_paint.AsCanvas();
// The tab is rendered into a windowless widget whose offset is at the
// coordinate event->area. Translate by these offsets so we can render at
// (0,0) to match Windows' rendering metrics.
- canvas.TranslateInt(event->area.x, event->area.y);
+ canvas->TranslateInt(event->area.x, event->area.y);
// Save the original x offset so we can position background images properly.
background_offset_x_ = event->area.x;
- Paint(&canvas);
+ Paint(canvas);
}
void TabRendererGtk::PaintTitle(gfx::Canvas* canvas) {
@@ -883,8 +890,8 @@
if (throb_value > 0) {
canvas->SaveLayerAlpha(static_cast<int>(throb_value * 0xff),
gfx::Rect(width(), height()));
- canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255,
- SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->skia_canvas()->drawARGB(
+ 0, 255, 255, 255, SkXfermode::kClear_Mode);
PaintActiveTabBackground(canvas);
canvas->Restore();
}

Powered by Google App Engine
This is Rietveld 408576698