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

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

Issue 10437006: Converts ui/views/controls, ui/views/examples, ui/base/models to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 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: ui/views/controls/button/text_button.cc
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc
index c44b65ebfff84dabc03c821fa182fbb544871aa6..764fac260509f11af7e54b07ada26d5541366ca2 100644
--- a/ui/views/controls/button/text_button.cc
+++ b/ui/views/controls/button/text_button.cc
@@ -90,28 +90,28 @@ TextButtonBorder::TextButtonBorder()
set_normal_set(normal_set);
BorderImageSet hot_set = {
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_LEFT_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_RIGHT_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_LEFT_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_CENTER_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_RIGHT_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_H).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_H).ToSkBitmap(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_LEFT_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_RIGHT_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_LEFT_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_CENTER_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_RIGHT_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_H).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_H).ToImageSkia(),
};
set_hot_set(hot_set);
BorderImageSet pushed_set = {
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_LEFT_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_TOP_RIGHT_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_LEFT_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_CENTER_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_RIGHT_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_P).ToSkBitmap(),
- rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_P).ToSkBitmap(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_LEFT_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_TOP_RIGHT_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_LEFT_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_CENTER_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_RIGHT_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_P).ToImageSkia(),
+ rb.GetImageNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_P).ToImageSkia(),
};
set_pushed_set(pushed_set);
}
@@ -514,7 +514,7 @@ void TextButtonBase::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
// canvas, we can not mirror the button by simply flipping the canvas as
// doing this will mirror the text itself. Flipping the canvas will also
// make the icons look wrong because icons are almost always represented as
- // direction-insensitive bitmaps and such bitmaps should never be flipped
+ // direction-insensitive images and such images should never be flipped
// horizontally.
//
// Due to the above, we must perform the flipping manually for RTL UIs.
@@ -668,18 +668,18 @@ TextButton::TextButton(ButtonListener* listener, const string16& text)
TextButton::~TextButton() {
}
-void TextButton::SetIcon(const SkBitmap& icon) {
+void TextButton::SetIcon(const gfx::ImageSkia& icon) {
icon_ = icon;
SchedulePaint();
}
-void TextButton::SetHoverIcon(const SkBitmap& icon) {
+void TextButton::SetHoverIcon(const gfx::ImageSkia& icon) {
icon_hover_ = icon;
has_hover_icon_ = true;
SchedulePaint();
}
-void TextButton::SetPushedIcon(const SkBitmap& icon) {
+void TextButton::SetPushedIcon(const gfx::ImageSkia& icon) {
icon_pushed_ = icon;
has_pushed_icon_ = true;
SchedulePaint();
@@ -717,7 +717,7 @@ gfx::Size TextButton::GetPreferredSize() {
void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
TextButtonBase::PaintButton(canvas, mode);
- const SkBitmap& icon = GetImageToPaint();
+ const gfx::ImageSkia& icon = GetImageToPaint();
if (icon.width() > 0) {
gfx::Rect text_bounds = GetTextBounds();
@@ -768,7 +768,7 @@ void TextButton::GetExtraParams(ui::NativeTheme::ExtraParams* params) const {
gfx::Rect TextButton::GetTextBounds() const {
int extra_width = 0;
- const SkBitmap& icon = GetImageToPaint();
+ const gfx::ImageSkia& icon = GetImageToPaint();
if (icon.width() > 0)
extra_width = icon.width() + (text_.empty() ? 0 : icon_text_spacing_);
@@ -786,7 +786,7 @@ gfx::Rect TextButton::GetTextBounds() const {
return bounds;
}
-const SkBitmap& TextButton::GetImageToPaint() const {
+const gfx::ImageSkia& TextButton::GetImageToPaint() const {
if (show_multiple_icon_states_) {
if (has_hover_icon_ && (state() == BS_HOT))
return icon_hover_;

Powered by Google App Engine
This is Rietveld 408576698