diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 23:30:26 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 23:30:26 +0000 |
commit | a219f823813abcf778eceea2eb81f2d3967009a8 (patch) | |
tree | e1a9e06b697d539260472a9faa2ea86d5984a4bf /views/controls/button | |
parent | 755e1b73a0b4894ecc36401fd042c744e7837844 (diff) | |
download | chromium_src-a219f823813abcf778eceea2eb81f2d3967009a8.zip chromium_src-a219f823813abcf778eceea2eb81f2d3967009a8.tar.gz chromium_src-a219f823813abcf778eceea2eb81f2d3967009a8.tar.bz2 |
Canvas refactoring part 3.
- Replace Canvas instance users with CanvasSkia users.
- Rename Canvas2 to Canvas.
- Delete Canvas subclass of CanvasSkia.
This has created some ugliness around the fact that people that used SkCanvas methods on Canvas now have to go through AsCanvasSkia first. This is temporary ugliness that will be eradicated as I incrementally build out the new Canvas API.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2825018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button')
-rw-r--r-- | views/controls/button/text_button.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 98c69fe..f2b7613 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -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 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { 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 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { 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::UpdateColor() { 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()); |