Index: views/controls/button/image_button.cc |
=================================================================== |
--- views/controls/button/image_button.cc (revision 21771) |
+++ views/controls/button/image_button.cc (working copy) |
@@ -18,7 +18,6 @@ |
ImageButton::ImageButton(ButtonListener* listener) |
: CustomButton(listener), |
- background_image_(NULL), |
h_alignment_(ALIGN_LEFT), |
v_alignment_(ALIGN_TOP) { |
// By default, we request that the gfx::Canvas passed to our View::Paint() |
@@ -37,11 +36,14 @@ |
void ImageButton::SetBackground(SkColor color, |
SkBitmap* image, |
SkBitmap* mask) { |
- if (!color && !image) |
- background_image_.reset(NULL); |
+ if (!image || !mask) { |
+ background_image_.reset(); |
+ return; |
+ } |
- background_image_.reset(new SkBitmap( |
- skia::ImageOperations::CreateButtonBackground(color, *image, *mask))); |
+ background_image_ = skia::ImageOperations::CreateButtonBackground(color, |
+ *image, |
+ *mask); |
} |
void ImageButton::SetImageAlignment(HorizontalAlignment h_align, |
@@ -79,8 +81,8 @@ |
else if (v_alignment_ == ALIGN_BOTTOM) |
y = height() - img.height(); |
- if (background_image_.get()) |
- canvas->DrawBitmapInt(*(background_image_.get()), x, y); |
+ if (!background_image_.empty()) |
+ canvas->DrawBitmapInt(background_image_, x, y); |
canvas->DrawBitmapInt(img, x, y); |
} |
PaintFocusBorder(canvas); |
Property changes on: views\controls\button\image_button.cc |
___________________________________________________________________ |
Modified: svn:mergeinfo |
Merged /trunk/src/views/controls/button/image_button.cc:r21544 |