From 67ae93c46f0efc8b23ed5b1eee2c8ad1788c4db5 Mon Sep 17 00:00:00 2001 From: "pkotwicz@chromium.org" Date: Tue, 28 Jan 2014 20:06:47 +0000 Subject: Remove unused ImageButton::SetOverlayImage() BUG=None TEST=None R=jamescook, sadrul TBR=mukai (For trivial refactor of ui/message_center/views/padded_button.cc) Review URL: https://codereview.chromium.org/137423008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247489 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/message_center/views/padded_button.cc | 2 -- ui/views/controls/button/image_button.cc | 11 ----------- ui/views/controls/button/image_button.h | 7 ------- ui/views/controls/button/image_button_unittest.cc | 19 ------------------- ui/views/examples/button_example.cc | 2 -- 5 files changed, 41 deletions(-) diff --git a/ui/message_center/views/padded_button.cc b/ui/message_center/views/padded_button.cc index 182cde6..203d77bea 100644 --- a/ui/message_center/views/padded_button.cc +++ b/ui/message_center/views/padded_button.cc @@ -66,8 +66,6 @@ void PaddedButton::OnPaint(gfx::Canvas* canvas) { if (!background_image_.isNull()) canvas->DrawImageInt(background_image_, position.x(), position.y()); canvas->DrawImageInt(image, position.x(), position.y()); - if (!overlay_image_.isNull()) - canvas->DrawImageInt(overlay_image_, position.x(), position.y()); } views::Painter::PaintFocusPainter(this, canvas, focus_painter()); } diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index fc804e7..e424bbf 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc @@ -60,14 +60,6 @@ void ImageButton::SetBackground(SkColor color, *image, *mask); } -void ImageButton::SetOverlayImage(const gfx::ImageSkia* image) { - if (!image) { - overlay_image_ = gfx::ImageSkia(); - return; - } - overlay_image_ = *image; -} - void ImageButton::SetImageAlignment(HorizontalAlignment h_align, VerticalAlignment v_align) { h_alignment_ = h_align; @@ -116,9 +108,6 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) { canvas->DrawImageInt(background_image_, position.x(), position.y()); canvas->DrawImageInt(img, position.x(), position.y()); - - if (!overlay_image_.isNull()) - canvas->DrawImageInt(overlay_image_, position.x(), position.y()); } Painter::PaintFocusPainter(this, canvas, focus_painter()); diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index 46ab52ed..5d71ec4 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h @@ -51,10 +51,6 @@ class VIEWS_EXPORT ImageButton : public CustomButton { const gfx::ImageSkia* image, const gfx::ImageSkia* mask); - // Set an |image| to draw on top of the normal / hot / pushed image. - // Pass NULL for no image. - void SetOverlayImage(const gfx::ImageSkia* image); - // Sets how the image is laid out within the button's bounds. void SetImageAlignment(HorizontalAlignment h_align, VerticalAlignment v_align); @@ -96,9 +92,6 @@ class VIEWS_EXPORT ImageButton : public CustomButton { gfx::ImageSkia background_image_; - // Image to draw on top of normal / hot / pushed image. Usually empty. - gfx::ImageSkia overlay_image_; - private: FRIEND_TEST_ALL_PREFIXES(ImageButtonTest, Basics); FRIEND_TEST_ALL_PREFIXES(ImageButtonTest, ImagePositionWithBorder); diff --git a/ui/views/controls/button/image_button_unittest.cc b/ui/views/controls/button/image_button_unittest.cc index 734ffbd..406d02c 100644 --- a/ui/views/controls/button/image_button_unittest.cc +++ b/ui/views/controls/button/image_button_unittest.cc @@ -60,25 +60,6 @@ TEST_F(ImageButtonTest, Basics) { EXPECT_FALSE(button.GetImageToPaint().isNull()); EXPECT_EQ(10, button.GetImageToPaint().width()); EXPECT_EQ(20, button.GetImageToPaint().height()); - - // Set an overlay image. - gfx::ImageSkia overlay_image = CreateTestImage(12, 22); - button.SetOverlayImage(&overlay_image); - EXPECT_EQ(12, button.overlay_image_.width()); - EXPECT_EQ(22, button.overlay_image_.height()); - - // By convention, preferred size doesn't change, even though pushed image - // is bigger. - EXPECT_EQ("10x20", button.GetPreferredSize().ToString()); - - // We're still painting the normal image. - EXPECT_FALSE(button.GetImageToPaint().isNull()); - EXPECT_EQ(10, button.GetImageToPaint().width()); - EXPECT_EQ(20, button.GetImageToPaint().height()); - - // Reset the overlay image. - button.SetOverlayImage(NULL); - EXPECT_TRUE(button.overlay_image_.isNull()); } TEST_F(ImageButtonTest, SetAndGetImage) { diff --git a/ui/views/examples/button_example.cc b/ui/views/examples/button_example.cc index c4becd3..f5ea950 100644 --- a/ui/views/examples/button_example.cc +++ b/ui/views/examples/button_example.cc @@ -75,8 +75,6 @@ void ButtonExample::CreateExampleView(View* container) { rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); image_button_->SetImage(ImageButton::STATE_PRESSED, rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); - image_button_->SetOverlayImage(rb.GetImageNamed( - IDR_MENU_CHECK).ToImageSkia()); container->AddChildView(image_button_); } -- cgit v1.1