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

Unified Diff: views/controls/button/text_button.cc

Issue 2825018: Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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: views/controls/button/text_button.cc
===================================================================
--- views/controls/button/text_button.cc (revision 50661)
+++ views/controls/button/text_button.cc (working copy)
@@ -8,7 +8,7 @@
#include "app/throb_animation.h"
#include "app/resource_bundle.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "views/controls/button/button.h"
#include "views/event.h"
#include "grit/app_resources.h"
@@ -256,12 +256,13 @@
if (show_highlighted_ && hover_animation_->is_animating()) {
// Draw the hover bitmap into an offscreen buffer, then blend it
// back into the current canvas.
- canvas->saveLayerAlpha(NULL,
+ canvas->AsCanvasSkia()->saveLayerAlpha(NULL,
static_cast<int>(hover_animation_->GetCurrentValue() * 255),
SkCanvas::kARGB_NoClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255,
+ SkXfermode::kClear_Mode);
PaintBorder(canvas);
- canvas->restore();
+ canvas->AsCanvasSkia()->restore();
} else if ((show_highlighted_ &&
(state_ == BS_HOT || state_ == BS_PUSHED)) ||
(state_ == BS_NORMAL && normal_has_border_)) {
@@ -330,19 +331,17 @@
else
text_color = color_;
- int draw_string_flags = gfx::Canvas::DefaultCanvasTextAlignment() |
+ int draw_string_flags = gfx::CanvasSkia::DefaultCanvasTextAlignment() |
PrefixTypeToCanvasType(prefix_type_);
if (for_drag) {
#if defined(OS_WIN)
// TODO(erg): Either port DrawStringWithHalo to linux or find an
// alternative here.
- canvas->DrawStringWithHalo(text_, font_, text_color, color_highlight_,
- text_bounds.x(),
- text_bounds.y(),
- text_bounds.width(),
- text_bounds.height(),
- draw_string_flags);
+ canvas->AsCanvasSkia()->DrawStringWithHalo(
+ text_, font_, text_color, color_highlight_, text_bounds.x(),
+ text_bounds.y(), text_bounds.width(), text_bounds.height(),
+ draw_string_flags);
#else
canvas->DrawStringInt(text_,
font_,
@@ -381,7 +380,7 @@
void TextButton::UpdateTextSize() {
int width = 0, height = 0;
- gfx::Canvas::SizeStringInt(
+ gfx::CanvasSkia::SizeStringInt(
text_, font_, &width, &height,
gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_));
text_size_.SetSize(width, font_.height());
« gfx/canvas.h ('K') | « views/background.cc ('k') | views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698