summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/controls/button/image_button.cc16
-rw-r--r--ui/views/controls/button/image_button.h13
-rw-r--r--ui/views/controls/button/image_button_unittest.cc20
-rw-r--r--ui/views/controls/button/menu_button.cc2
-rw-r--r--ui/views/controls/button/menu_button.h4
-rw-r--r--ui/views/controls/button/text_button.cc50
-rw-r--r--ui/views/controls/button/text_button.h36
-rw-r--r--ui/views/controls/combobox/native_combobox_views.cc2
-rw-r--r--ui/views/controls/combobox/native_combobox_views.h2
-rw-r--r--ui/views/controls/glow_hover_controller.cc6
-rw-r--r--ui/views/controls/glow_hover_controller.h7
-rw-r--r--ui/views/controls/image_view.cc9
-rw-r--r--ui/views/controls/image_view.h19
-rw-r--r--ui/views/controls/menu/menu.cc18
-rw-r--r--ui/views/controls/menu/menu.h21
-rw-r--r--ui/views/controls/menu/menu_config_views.cc6
-rw-r--r--ui/views/controls/menu/menu_image_util.cc23
-rw-r--r--ui/views/controls/menu/menu_image_util.h10
-rw-r--r--ui/views/controls/menu/menu_item_view.cc20
-rw-r--r--ui/views/controls/menu/menu_item_view.h18
-rw-r--r--ui/views/controls/menu/menu_item_view_views.cc5
-rw-r--r--ui/views/controls/menu/menu_model_adapter_unittest.cc2
-rw-r--r--ui/views/controls/menu/menu_win.cc12
-rw-r--r--ui/views/controls/menu/menu_win.h12
-rw-r--r--ui/views/controls/menu/native_menu_win.cc4
-rw-r--r--ui/views/controls/message_box_view.cc2
-rw-r--r--ui/views/controls/message_box_view.h6
-rw-r--r--ui/views/controls/scrollbar/bitmap_scroll_bar.cc40
-rw-r--r--ui/views/controls/scrollbar/bitmap_scroll_bar.h6
-rw-r--r--ui/views/controls/scrollbar/scroll_bar.h2
-rw-r--r--ui/views/controls/table/table_view_views.cc6
-rw-r--r--ui/views/controls/table/table_view_win.cc5
-rw-r--r--ui/views/controls/textfield/native_textfield_views_unittest.cc2
-rw-r--r--ui/views/controls/throbber.cc8
-rw-r--r--ui/views/controls/throbber.h14
-rw-r--r--ui/views/controls/tree/tree_view_views.cc6
-rw-r--r--ui/views/controls/tree/tree_view_views.h8
-rw-r--r--ui/views/controls/tree/tree_view_win.cc10
-rw-r--r--ui/views/examples/button_example.cc7
-rw-r--r--ui/views/examples/button_example.h2
-rw-r--r--ui/views/examples/table_example.cc4
-rw-r--r--ui/views/examples/table_example.h8
-rw-r--r--ui/views/view_unittest.cc2
43 files changed, 244 insertions, 231 deletions
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc
index 35e4960..729e848 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -23,7 +23,7 @@ ImageButton::ImageButton(ButtonListener* listener)
v_alignment_(ALIGN_TOP),
preferred_size_(kDefaultWidth, kDefaultHeight) {
// By default, we request that the gfx::Canvas passed to our View::OnPaint()
- // implementation is flipped horizontally so that the button's bitmaps are
+ // implementation is flipped horizontally so that the button's images are
// mirrored when the UI directionality is right-to-left.
EnableCanvasFlippingForRTLUI(true);
}
@@ -40,7 +40,7 @@ void ImageButton::SetBackground(SkColor color,
const gfx::ImageSkia* image,
const gfx::ImageSkia* mask) {
if (!image || !mask) {
- background_image_.reset();
+ background_image_ = gfx::ImageSkia();
return;
}
@@ -48,9 +48,9 @@ void ImageButton::SetBackground(SkColor color,
SkBitmapOperations::CreateButtonBackground(color, *image, *mask);
}
-void ImageButton::SetOverlayImage(const SkBitmap* image) {
+void ImageButton::SetOverlayImage(const gfx::ImageSkia* image) {
if (!image) {
- overlay_image_.reset();
+ overlay_image_ = gfx::ImageSkia();
return;
}
overlay_image_ = *image;
@@ -76,7 +76,7 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) {
// Call the base class first to paint any background/borders.
View::OnPaint(canvas);
- SkBitmap img = GetImageToPaint();
+ gfx::ImageSkia img = GetImageToPaint();
if (!img.isNull()) {
int x = 0, y = 0;
@@ -105,8 +105,8 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) {
////////////////////////////////////////////////////////////////////////////////
// ImageButton, protected:
-SkBitmap ImageButton::GetImageToPaint() {
- SkBitmap img;
+gfx::ImageSkia ImageButton::GetImageToPaint() {
+ gfx::ImageSkia img;
if (!images_[BS_HOT].isNull() && hover_animation_->is_animating()) {
img = SkBitmapOperations::CreateBlendedBitmap(images_[BS_NORMAL],
@@ -134,7 +134,7 @@ void ToggleImageButton::SetToggled(bool toggled) {
return;
for (int i = 0; i < BS_COUNT; ++i) {
- SkBitmap temp = images_[i];
+ gfx::ImageSkia temp = images_[i];
images_[i] = alternate_images_[i];
alternate_images_[i] = temp;
}
diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h
index 3a54e20..b267e3c 100644
--- a/ui/views/controls/button/image_button.h
+++ b/ui/views/controls/button/image_button.h
@@ -7,7 +7,6 @@
#pragma once
#include "base/gtest_prod_util.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/button/custom_button.h"
@@ -46,7 +45,7 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
// Set an |image| to draw on top of the normal / hot / pushed image.
// Pass NULL for no image.
- void SetOverlayImage(const SkBitmap* image);
+ void SetOverlayImage(const gfx::ImageSkia* image);
// Sets how the image is laid out within the button's bounds.
void SetImageAlignment(HorizontalAlignment h_align,
@@ -65,16 +64,16 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
protected:
// Returns the image to paint. This is invoked from paint and returns a value
// from images.
- virtual SkBitmap GetImageToPaint();
+ virtual gfx::ImageSkia GetImageToPaint();
// The images used to render the different states of this button.
- SkBitmap images_[BS_COUNT];
+ gfx::ImageSkia images_[BS_COUNT];
// The background image.
- SkBitmap background_image_;
+ gfx::ImageSkia background_image_;
// Image to draw on top of normal / hot / pushed image. Usually empty.
- SkBitmap overlay_image_;
+ gfx::ImageSkia overlay_image_;
private:
FRIEND_TEST_ALL_PREFIXES(ImageButtonTest, Basics);
@@ -122,7 +121,7 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton {
// The parent class's images_ member is used for the current images,
// and this array is used to hold the alternative images.
// We swap between the two when toggling.
- SkBitmap alternate_images_[BS_COUNT];
+ gfx::ImageSkia alternate_images_[BS_COUNT];
// True if the button is currently toggled.
bool toggled_;
diff --git a/ui/views/controls/button/image_button_unittest.cc b/ui/views/controls/button/image_button_unittest.cc
index f9b17c8..4e6c5b2 100644
--- a/ui/views/controls/button/image_button_unittest.cc
+++ b/ui/views/controls/button/image_button_unittest.cc
@@ -8,11 +8,11 @@
namespace {
-SkBitmap CreateTestBitmap(int width, int height) {
+gfx::ImageSkia CreateTestImage(int width, int height) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap.allocPixels();
- return bitmap;
+ return gfx::ImageSkia(bitmap);
}
} // namespace
@@ -35,8 +35,8 @@ TEST_F(ImageButtonTest, Basics) {
EXPECT_EQ("5x15", button.GetPreferredSize().ToString());
// Set a normal image.
- gfx::ImageSkia normal_bitmap = CreateTestBitmap(10, 20);
- button.SetImage(CustomButton::BS_NORMAL, &normal_bitmap);
+ gfx::ImageSkia normal_image = CreateTestImage(10, 20);
+ button.SetImage(CustomButton::BS_NORMAL, &normal_image);
// Image uses normal image for painting.
EXPECT_FALSE(button.GetImageToPaint().empty());
@@ -47,8 +47,8 @@ TEST_F(ImageButtonTest, Basics) {
EXPECT_EQ("10x20", button.GetPreferredSize().ToString());
// Set a pushed image.
- gfx::ImageSkia pushed_bitmap = CreateTestBitmap(11, 21);
- button.SetImage(CustomButton::BS_PUSHED, &pushed_bitmap);
+ gfx::ImageSkia pushed_image = CreateTestImage(11, 21);
+ button.SetImage(CustomButton::BS_PUSHED, &pushed_image);
// By convention, preferred size doesn't change, even though pushed image
// is bigger.
@@ -59,9 +59,9 @@ TEST_F(ImageButtonTest, Basics) {
EXPECT_EQ(10, button.GetImageToPaint().width());
EXPECT_EQ(20, button.GetImageToPaint().height());
- // Set an overlay bitmap.
- SkBitmap overlay_bitmap = CreateTestBitmap(12, 22);
- button.SetOverlayImage(&overlay_bitmap);
+ // 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());
@@ -74,7 +74,7 @@ TEST_F(ImageButtonTest, Basics) {
EXPECT_EQ(10, button.GetImageToPaint().width());
EXPECT_EQ(20, button.GetImageToPaint().height());
- // Reset the overlay bitmap.
+ // Reset the overlay image.
button.SetOverlayImage(NULL);
EXPECT_TRUE(button.overlay_image_.empty());
}
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index 0959bcf..a9aeb5b 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -56,7 +56,7 @@ MenuButton::MenuButton(ButtonListener* listener,
listener_(menu_button_listener),
show_menu_marker_(show_menu_marker),
menu_marker_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_MENU_DROPARROW).ToSkBitmap()),
+ IDR_MENU_DROPARROW).ToImageSkia()),
destroyed_flag_(NULL) {
set_alignment(TextButton::ALIGN_LEFT);
}
diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h
index d37044b..58f14f3 100644
--- a/ui/views/controls/button/menu_button.h
+++ b/ui/views/controls/button/menu_button.h
@@ -38,7 +38,7 @@ class VIEWS_EXPORT MenuButton : public TextButton {
bool show_menu_marker);
virtual ~MenuButton();
- void set_menu_marker(const SkBitmap* menu_marker) {
+ void set_menu_marker(const gfx::ImageSkia* menu_marker) {
menu_marker_ = menu_marker;
}
@@ -91,7 +91,7 @@ class VIEWS_EXPORT MenuButton : public TextButton {
// The down arrow used to differentiate the menu button from normal
// text buttons.
- const SkBitmap* menu_marker_;
+ const gfx::ImageSkia* menu_marker_;
// If non-null the destuctor sets this to true. This is set while the menu is
// showing and used to detect if the menu was deleted while running.
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc
index c44b65e..764fac2 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_;
diff --git a/ui/views/controls/button/text_button.h b/ui/views/controls/button/text_button.h
index 2dd1cb8..4d75eae 100644
--- a/ui/views/controls/button/text_button.h
+++ b/ui/views/controls/button/text_button.h
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "base/string16.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font.h"
#include "ui/views/border.h"
@@ -44,15 +44,15 @@ class VIEWS_EXPORT TextButtonBorder : public Border {
protected:
struct BorderImageSet {
- const SkBitmap* top_left;
- const SkBitmap* top;
- const SkBitmap* top_right;
- const SkBitmap* left;
- const SkBitmap* center;
- const SkBitmap* right;
- const SkBitmap* bottom_left;
- const SkBitmap* bottom;
- const SkBitmap* bottom_right;
+ const gfx::ImageSkia* top_left;
+ const gfx::ImageSkia* top;
+ const gfx::ImageSkia* top_right;
+ const gfx::ImageSkia* left;
+ const gfx::ImageSkia* center;
+ const gfx::ImageSkia* right;
+ const gfx::ImageSkia* bottom_left;
+ const gfx::ImageSkia* bottom;
+ const gfx::ImageSkia* bottom_right;
};
void Paint(const View& view,
@@ -320,9 +320,9 @@ class VIEWS_EXPORT TextButton : public TextButtonBase {
}
// Sets the icon.
- virtual void SetIcon(const SkBitmap& icon);
- virtual void SetHoverIcon(const SkBitmap& icon);
- virtual void SetPushedIcon(const SkBitmap& icon);
+ virtual void SetIcon(const gfx::ImageSkia& icon);
+ virtual void SetHoverIcon(const gfx::ImageSkia& icon);
+ virtual void SetPushedIcon(const gfx::ImageSkia& icon);
bool HasIcon() const { return !icon_.empty(); }
@@ -348,9 +348,9 @@ class VIEWS_EXPORT TextButton : public TextButtonBase {
virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
protected:
- SkBitmap icon() const { return icon_; }
+ gfx::ImageSkia icon() const { return icon_; }
- virtual const SkBitmap& GetImageToPaint() const;
+ virtual const gfx::ImageSkia& GetImageToPaint() const;
// Overridden from NativeThemeDelegate:
virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE;
@@ -365,14 +365,14 @@ class VIEWS_EXPORT TextButton : public TextButtonBase {
IconPlacement icon_placement_;
// An icon displayed with the text.
- SkBitmap icon_;
+ gfx::ImageSkia icon_;
// An optional different version of the icon for hover state.
- SkBitmap icon_hover_;
+ gfx::ImageSkia icon_hover_;
bool has_hover_icon_;
// An optional different version of the icon for pushed state.
- SkBitmap icon_pushed_;
+ gfx::ImageSkia icon_pushed_;
bool has_pushed_icon_;
// Space between icon and text.
diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc
index 1a538c8..4bd17a3 100644
--- a/ui/views/controls/combobox/native_combobox_views.cc
+++ b/ui/views/controls/combobox/native_combobox_views.cc
@@ -57,7 +57,7 @@ NativeComboboxViews::NativeComboboxViews(Combobox* combobox)
: combobox_(combobox),
text_border_(new FocusableBorder()),
disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_DISCLOSURE_ARROW).ToSkBitmap()),
+ IDR_DISCLOSURE_ARROW).ToImageSkia()),
dropdown_open_(false),
selected_index_(-1),
content_width_(0),
diff --git a/ui/views/controls/combobox/native_combobox_views.h b/ui/views/controls/combobox/native_combobox_views.h
index 502fb9e..145599e 100644
--- a/ui/views/controls/combobox/native_combobox_views.h
+++ b/ui/views/controls/combobox/native_combobox_views.h
@@ -79,7 +79,7 @@ class NativeComboboxViews : public views::View,
FocusableBorder* text_border_;
// The disclosure arrow next to the currently selected item from the list.
- const SkBitmap* disclosure_arrow_;
+ const gfx::ImageSkia* disclosure_arrow_;
// Responsible for showing the context menu.
scoped_ptr<MenuRunner> dropdown_list_menu_runner_;
diff --git a/ui/views/controls/glow_hover_controller.cc b/ui/views/controls/glow_hover_controller.cc
index c998f34..f3b356b 100644
--- a/ui/views/controls/glow_hover_controller.cc
+++ b/ui/views/controls/glow_hover_controller.cc
@@ -4,9 +4,9 @@
#include "ui/views/controls/glow_hover_controller.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skbitmap_operations.h"
#include "ui/views/view.h"
@@ -64,7 +64,7 @@ bool GlowHoverController::ShouldDraw() const {
}
void GlowHoverController::Draw(gfx::Canvas* canvas,
- const SkBitmap& mask_image) const {
+ const gfx::ImageSkia& mask_image) const {
if (!ShouldDraw())
return;
@@ -96,7 +96,7 @@ void GlowHoverController::Draw(gfx::Canvas* canvas,
location_.y() - radius,
radius * 2, radius * 2), paint);
}
- SkBitmap result = SkBitmapOperations::CreateMaskedBitmap(
+ gfx::ImageSkia result = SkBitmapOperations::CreateMaskedBitmap(
hover_canvas.ExtractBitmap(), mask_image);
canvas->DrawBitmapInt(result, (view_->width() - mask_image.width()) / 2,
(view_->height() - mask_image.height()) / 2);
diff --git a/ui/views/controls/glow_hover_controller.h b/ui/views/controls/glow_hover_controller.h
index 69aeecf..ea71252 100644
--- a/ui/views/controls/glow_hover_controller.h
+++ b/ui/views/controls/glow_hover_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,11 +12,10 @@
namespace gfx {
class Canvas;
+class ImageSkia;
class Point;
}
-class SkBitmap;
-
namespace views {
class View;
@@ -59,7 +58,7 @@ class VIEWS_EXPORT GlowHoverController : public ui::AnimationDelegate {
// If the hover is currently visible it is drawn to the supplied canvas.
// |mask_image| is used to determine what parts of the canvas to draw on.
- void Draw(gfx::Canvas* canvas, const SkBitmap& mask_image) const;
+ void Draw(gfx::Canvas* canvas, const gfx::ImageSkia& mask_image) const;
// ui::AnimationDelegate overrides:
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
diff --git a/ui/views/controls/image_view.cc b/ui/views/controls/image_view.cc
index e09603d..bf8043d 100644
--- a/ui/views/controls/image_view.cc
+++ b/ui/views/controls/image_view.cc
@@ -22,9 +22,9 @@ ImageView::ImageView()
ImageView::~ImageView() {
}
-void ImageView::SetImage(const SkBitmap& bm) {
+void ImageView::SetImage(const gfx::ImageSkia& img) {
gfx::Size pref_size(GetPreferredSize());
- image_ = bm;
+ image_ = img;
if (pref_size != GetPreferredSize())
PreferredSizeChanged();
SchedulePaint();
@@ -34,12 +34,12 @@ void ImageView::SetImage(const gfx::ImageSkia* image_skia) {
if (image_skia) {
SetImage(*image_skia);
} else {
- SkBitmap t;
+ gfx::ImageSkia t;
SetImage(t);
}
}
-const SkBitmap& ImageView::GetImage() {
+const gfx::ImageSkia& ImageView::GetImage() {
return image_;
}
@@ -119,7 +119,6 @@ void ImageView::OnPaint(gfx::Canvas* canvas) {
if (image_bounds.size() != gfx::Size(image_.width(), image_.height())) {
// Resize case
- image_.buildMipMap(false);
SkPaint paint;
paint.setFilterBitmap(true);
canvas->DrawBitmapInt(image_, 0, 0, image_.width(), image_.height(),
diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h
index 7c90fd8..5aa1553 100644
--- a/ui/views/controls/image_view.h
+++ b/ui/views/controls/image_view.h
@@ -6,7 +6,6 @@
#define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_
#pragma once
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/view.h"
@@ -20,7 +19,7 @@ namespace views {
//
// ImageView class.
//
-// An ImageView can display an image from an SkBitmap. If a size is provided,
+// An ImageView can display an image from an ImageSkia. If a size is provided,
// the ImageView will resize the provided image to fit if it is too big or will
// center the image if smaller. Otherwise, the preferred size matches the
// provided image size.
@@ -37,17 +36,17 @@ class VIEWS_EXPORT ImageView : public View {
ImageView();
virtual ~ImageView();
- // Set the bitmap that should be displayed.
- void SetImage(const SkBitmap& bm);
+ // Set the image that should be displayed.
+ void SetImage(const gfx::ImageSkia& img);
// Set the image that should be displayed from a pointer. Reset the image
// if the pointer is NULL. The pointer contents is copied in the receiver's
- // bitmap.
+ // image.
void SetImage(const gfx::ImageSkia* image_skia);
- // Returns the bitmap currently displayed or NULL of none is currently set.
- // The returned bitmap is still owned by the ImageView.
- const SkBitmap& GetImage();
+ // Returns the image currently displayed or NULL of none is currently set.
+ // The returned image is still owned by the ImageView.
+ const gfx::ImageSkia& GetImage();
// Set the desired image size for the receiving ImageView.
void SetImageSize(const gfx::Size& image_size);
@@ -93,8 +92,8 @@ class VIEWS_EXPORT ImageView : public View {
// The actual image size.
gfx::Size image_size_;
- // The underlying bitmap.
- SkBitmap image_;
+ // The underlying image.
+ gfx::ImageSkia image_;
// Horizontal alignment.
Alignment horiz_alignment_;
diff --git a/ui/views/controls/menu/menu.cc b/ui/views/controls/menu/menu.cc
index 2607cde..9b9a099 100644
--- a/ui/views/controls/menu/menu.cc
+++ b/ui/views/controls/menu/menu.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/controls/menu/menu.h"
#include "base/i18n/rtl.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
namespace views {
@@ -13,8 +13,8 @@ bool Menu::Delegate::IsRightToLeftUILayout() const {
return base::i18n::IsRTL();
}
-const SkBitmap& Menu::Delegate::GetEmptyIcon() const {
- static const SkBitmap* empty_icon = new SkBitmap();
+const gfx::ImageSkia& Menu::Delegate::GetEmptyIcon() const {
+ static const gfx::ImageSkia* empty_icon = new gfx::ImageSkia();
return *empty_icon;
}
@@ -44,7 +44,7 @@ void Menu::AddMenuItem(int index,
if (type == SEPARATOR)
AddSeparator(index);
else
- AddMenuItemInternal(index, item_id, label, SkBitmap(), type);
+ AddMenuItemInternal(index, item_id, label, gfx::ImageSkia(), type);
}
Menu* Menu::AppendSubMenu(int item_id, const string16& label) {
@@ -52,12 +52,12 @@ Menu* Menu::AppendSubMenu(int item_id, const string16& label) {
}
Menu* Menu::AddSubMenu(int index, int item_id, const string16& label) {
- return AddSubMenuWithIcon(index, item_id, label, SkBitmap());
+ return AddSubMenuWithIcon(index, item_id, label, gfx::ImageSkia());
}
Menu* Menu::AppendSubMenuWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
return AddSubMenuWithIcon(-1, item_id, label, icon);
}
@@ -85,14 +85,14 @@ void Menu::AppendSeparator() {
void Menu::AppendMenuItemWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
AddMenuItemWithIcon(-1, item_id, label, icon);
}
void Menu::AddMenuItemWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
AddMenuItemInternal(index, item_id, label, icon, Menu::NORMAL);
}
diff --git a/ui/views/controls/menu/menu.h b/ui/views/controls/menu/menu.h
index 2ee90f9..2ec9d36 100644
--- a/ui/views/controls/menu/menu.h
+++ b/ui/views/controls/menu/menu.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,9 +13,8 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/views/views_export.h"
-class SkBitmap;
-
namespace gfx {
+class ImageSkia;
class Point;
}
@@ -63,7 +62,7 @@ class VIEWS_EXPORT Menu {
}
// The icon shown for the menu item.
- virtual const SkBitmap& GetIcon(int id) const {
+ virtual const gfx::ImageSkia& GetIcon(int id) const {
return GetEmptyIcon();
}
@@ -124,7 +123,7 @@ class VIEWS_EXPORT Menu {
protected:
// Returns an empty icon.
- const SkBitmap& GetEmptyIcon() const;
+ const gfx::ImageSkia& GetEmptyIcon() const;
};
// How this popup should align itself relative to the point it is run at.
@@ -194,11 +193,11 @@ class VIEWS_EXPORT Menu {
// to draw the menu, instead of relying on Windows.
Menu* AppendSubMenuWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon);
+ const gfx::ImageSkia& icon);
virtual Menu* AddSubMenuWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) = 0;
+ const gfx::ImageSkia& icon) = 0;
// This is a convenience for standard text label menu items where the label
// is provided with this call.
@@ -219,11 +218,11 @@ class VIEWS_EXPORT Menu {
// the menu, instead of relying on Windows.
void AppendMenuItemWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon);
+ const gfx::ImageSkia& icon);
virtual void AddMenuItemWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon);
+ const gfx::ImageSkia& icon);
// Enables or disables the item with the specified id.
virtual void EnableMenuItemByID(int item_id, bool enabled) = 0;
@@ -235,7 +234,7 @@ class VIEWS_EXPORT Menu {
// Sets an icon for an item with a given item_id. Calling this function
// also forces the Menu class to draw the menu, instead of relying on Windows.
// Returns false if the item with |item_id| is not found.
- virtual bool SetIcon(const SkBitmap& icon, int item_id) = 0;
+ virtual bool SetIcon(const gfx::ImageSkia& icon, int item_id) = 0;
// Shows the menu, blocks until the user dismisses the menu or selects an
// item, and executes the command for the selected item (if any).
@@ -259,7 +258,7 @@ class VIEWS_EXPORT Menu {
virtual void AddMenuItemInternal(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
MenuItemType type) = 0;
private:
diff --git a/ui/views/controls/menu/menu_config_views.cc b/ui/views/controls/menu/menu_config_views.cc
index bfb0464..c690ebd 100644
--- a/ui/views/controls/menu/menu_config_views.cc
+++ b/ui/views/controls/menu/menu_config_views.cc
@@ -5,10 +5,10 @@
#include "ui/views/controls/menu/menu_config.h"
#include "grit/ui_resources.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/layout.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/base/native_theme/native_theme_aura.h"
namespace views {
@@ -25,8 +25,8 @@ MenuConfig* MenuConfig::Create() {
config->item_left_margin = 8;
config->arrow_to_edge_padding = 20;
config->icon_to_label_padding = 4;
- config->arrow_width = rb.GetImageNamed(IDR_MENU_ARROW).ToSkBitmap()->width();
- const SkBitmap* check = rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap();
+ config->arrow_width = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia()->width();
+ const gfx::ImageSkia* check = rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia();
// Add 4 to force some padding between check and label.
config->check_width = check->width() + 4;
config->check_height = check->height();
diff --git a/ui/views/controls/menu/menu_image_util.cc b/ui/views/controls/menu/menu_image_util.cc
index bd58755..d5a8be2 100644
--- a/ui/views/controls/menu/menu_image_util.cc
+++ b/ui/views/controls/menu/menu_image_util.cc
@@ -10,6 +10,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"
@@ -29,7 +30,7 @@ const SkColor kRadioButtonIndicatorGradient0 = SkColorSetRGB(0, 0, 0);
const SkColor kRadioButtonIndicatorGradient1 = SkColorSetRGB(0x83, 0x83, 0x83);
const SkColor kIndicatorStroke = SkColorSetRGB(0, 0, 0);
-SkBitmap* CreateRadioButtonImage(bool selected) {
+gfx::ImageSkia* CreateRadioButtonImage(bool selected) {
// + 2 (1px on each side) to cover rounding error.
gfx::Canvas canvas(gfx::Size(kIndicatorSize + 2, kIndicatorSize + 2), false);
canvas.Translate(gfx::Point(1, 1));
@@ -78,18 +79,18 @@ SkBitmap* CreateRadioButtonImage(bool selected) {
canvas.sk_canvas()->drawCircle(radius, radius,
kSelectedIndicatorSize / 2, paint);
}
- return new SkBitmap(canvas.ExtractBitmap());
+ return new gfx::ImageSkia(canvas.ExtractBitmap());
}
-SkBitmap* GetRtlSubmenuArrowImage() {
- static SkBitmap* kRtlArrow = NULL;
+gfx::ImageSkia* GetRtlSubmenuArrowImage() {
+ static gfx::ImageSkia* kRtlArrow = NULL;
if (!kRtlArrow) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- const SkBitmap* r = rb.GetImageNamed(IDR_MENU_ARROW).ToSkBitmap();
+ const gfx::ImageSkia* r = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia();
gfx::Canvas canvas(gfx::Size(r->width(), r->height()), false);
canvas.Scale(-1, 1);
canvas.DrawBitmapInt(*r, - r->width(), 0);
- kRtlArrow = new SkBitmap(canvas.ExtractBitmap());
+ kRtlArrow = new gfx::ImageSkia(canvas.ExtractBitmap());
}
return kRtlArrow;
}
@@ -98,17 +99,17 @@ SkBitmap* GetRtlSubmenuArrowImage() {
namespace views {
-const SkBitmap* GetRadioButtonImage(bool selected) {
- static const SkBitmap* kRadioOn = CreateRadioButtonImage(true);
- static const SkBitmap* kRadioOff = CreateRadioButtonImage(false);
+const gfx::ImageSkia* GetRadioButtonImage(bool selected) {
+ static const gfx::ImageSkia* kRadioOn = CreateRadioButtonImage(true);
+ static const gfx::ImageSkia* kRadioOff = CreateRadioButtonImage(false);
return selected ? kRadioOn : kRadioOff;
}
-const SkBitmap* GetSubmenuArrowImage() {
+const gfx::ImageSkia* GetSubmenuArrowImage() {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
return base::i18n::IsRTL() ? GetRtlSubmenuArrowImage()
- : rb.GetImageNamed(IDR_MENU_ARROW).ToSkBitmap();
+ : rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia();
}
} // namespace views
diff --git a/ui/views/controls/menu/menu_image_util.h b/ui/views/controls/menu/menu_image_util.h
index 7d98035..5e1062c 100644
--- a/ui/views/controls/menu/menu_image_util.h
+++ b/ui/views/controls/menu/menu_image_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,9 @@
#define UI_VIEWS_CONTROLS_MENU_MENU_IMAGE_UTIL_H_
#pragma once
-#include "third_party/skia/include/core/SkBitmap.h"
+namespace gfx {
+class ImageSkia;
+}
namespace views {
@@ -14,10 +16,10 @@ namespace views {
// It returns the "selected" image when |selected| is
// true, or the "unselected" image if false.
// The returned image is global object and should not be freed.
-const SkBitmap* GetRadioButtonImage(bool selected);
+const gfx::ImageSkia* GetRadioButtonImage(bool selected);
// Returns the image for submenu arrow for current RTL setting.
-const SkBitmap* GetSubmenuArrowImage();
+const gfx::ImageSkia* GetSubmenuArrowImage();
} // namespace views
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
index fff309b..b5f8111 100644
--- a/ui/views/controls/menu/menu_item_view.cc
+++ b/ui/views/controls/menu/menu_item_view.cc
@@ -203,7 +203,7 @@ void MenuItemView::Cancel() {
MenuItemView* MenuItemView::AddMenuItemAt(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
Type type) {
DCHECK_NE(type, EMPTY);
DCHECK_LE(0, index);
@@ -244,17 +244,17 @@ void MenuItemView::RemoveMenuItemAt(int index) {
MenuItemView* MenuItemView::AppendMenuItem(int item_id,
const string16& label,
Type type) {
- return AppendMenuItemImpl(item_id, label, SkBitmap(), type);
+ return AppendMenuItemImpl(item_id, label, gfx::ImageSkia(), type);
}
MenuItemView* MenuItemView::AppendSubMenu(int item_id,
const string16& label) {
- return AppendMenuItemImpl(item_id, label, SkBitmap(), SUBMENU);
+ return AppendMenuItemImpl(item_id, label, gfx::ImageSkia(), SUBMENU);
}
MenuItemView* MenuItemView::AppendSubMenuWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
return AppendMenuItemImpl(item_id, label, icon, SUBMENU);
}
@@ -268,19 +268,19 @@ MenuItemView* MenuItemView::AppendDelegateMenuItem(int item_id) {
}
void MenuItemView::AppendSeparator() {
- AppendMenuItemImpl(0, string16(), SkBitmap(), SEPARATOR);
+ AppendMenuItemImpl(0, string16(), gfx::ImageSkia(), SEPARATOR);
}
MenuItemView* MenuItemView::AppendMenuItemWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
return AppendMenuItemImpl(item_id, label, icon, NORMAL);
}
MenuItemView* MenuItemView::AppendMenuItemFromModel(ui::MenuModel* model,
int index,
int id) {
- SkBitmap icon;
+ gfx::ImageSkia icon;
string16 label;
MenuItemView::Type type;
ui::MenuModel::ItemType menu_type = model->GetTypeAt(index);
@@ -317,7 +317,7 @@ MenuItemView* MenuItemView::AppendMenuItemFromModel(ui::MenuModel* model,
MenuItemView* MenuItemView::AppendMenuItemImpl(int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
Type type) {
const int index = submenu_ ? submenu_->child_count() : 0;
return AddMenuItemAt(index, item_id, label, icon, type);
@@ -353,13 +353,13 @@ void MenuItemView::SetTooltip(const string16& tooltip, int item_id) {
item->tooltip_ = tooltip;
}
-void MenuItemView::SetIcon(const SkBitmap& icon, int item_id) {
+void MenuItemView::SetIcon(const gfx::ImageSkia& icon, int item_id) {
MenuItemView* item = GetMenuItemByID(item_id);
DCHECK(item);
item->SetIcon(icon);
}
-void MenuItemView::SetIcon(const SkBitmap& icon) {
+void MenuItemView::SetIcon(const gfx::ImageSkia& icon) {
icon_ = icon;
SchedulePaint();
}
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h
index 928ea84..6f4b89a 100644
--- a/ui/views/controls/menu/menu_item_view.h
+++ b/ui/views/controls/menu/menu_item_view.h
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/string16.h"
#include "build/build_config.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/view.h"
#if defined(OS_WIN)
@@ -134,7 +134,7 @@ class VIEWS_EXPORT MenuItemView : public View {
MenuItemView* AddMenuItemAt(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
Type type);
// Remove an item from the menu at a specified index.
@@ -163,7 +163,7 @@ class VIEWS_EXPORT MenuItemView : public View {
// The returned pointer is owned by this menu.
MenuItemView* AppendSubMenuWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon);
+ const gfx::ImageSkia& icon);
// This is a convenience for standard text label menu items where the label
// is provided with this call.
@@ -182,7 +182,7 @@ class VIEWS_EXPORT MenuItemView : public View {
// the menu, instead of relying on Windows.
MenuItemView* AppendMenuItemWithIcon(int item_id,
const string16& label,
- const SkBitmap& icon);
+ const gfx::ImageSkia& icon);
// Creates a menu item for the specified entry in the model and appends it as
// a child. |index| should be offset by GetFirstItemIndex() before calling
@@ -194,7 +194,7 @@ class VIEWS_EXPORT MenuItemView : public View {
// All the AppendXXX methods funnel into this.
MenuItemView* AppendMenuItemImpl(int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
Type type);
// Returns the view that contains child menu items. If the submenu has
@@ -234,13 +234,13 @@ class VIEWS_EXPORT MenuItemView : public View {
void SetTooltip(const string16& tooltip, int item_id);
// Sets the icon for the descendant identified by item_id.
- void SetIcon(const SkBitmap& icon, int item_id);
+ void SetIcon(const gfx::ImageSkia& icon, int item_id);
// Sets the icon of this menu item.
- void SetIcon(const SkBitmap& icon);
+ void SetIcon(const gfx::ImageSkia& icon);
// Returns the icon.
- const SkBitmap& GetIcon() const { return icon_; }
+ const gfx::ImageSkia& GetIcon() const { return icon_; }
// Sets the command id of this menu item.
void SetCommand(int command) { command_ = command; }
@@ -436,7 +436,7 @@ class VIEWS_EXPORT MenuItemView : public View {
string16 title_;
// Icon.
- SkBitmap icon_;
+ gfx::ImageSkia icon_;
// Does the title have a mnemonic? Only useful on the root menu item.
bool has_mnemonics_;
diff --git a/ui/views/controls/menu/menu_item_view_views.cc b/ui/views/controls/menu/menu_item_view_views.cc
index 00beeb9..e859546 100644
--- a/ui/views/controls/menu/menu_item_view_views.cc
+++ b/ui/views/controls/menu/menu_item_view_views.cc
@@ -45,13 +45,14 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
// Render the check.
if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- const SkBitmap* check = rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap();
+ const gfx::ImageSkia* check = rb.GetImageNamed(
+ IDR_MENU_CHECK).ToImageSkia();
// Don't use config.check_width here as it's padded to force more padding.
gfx::Rect check_bounds(icon_x, icon_y, check->width(), icon_height);
AdjustBoundsForRTLUI(&check_bounds);
canvas->DrawBitmapInt(*check, check_bounds.x(), check_bounds.y());
} else if (type_ == RADIO) {
- const SkBitmap* image =
+ const gfx::ImageSkia* image =
GetRadioButtonImage(GetDelegate()->IsItemChecked(GetCommand()));
gfx::Rect radio_bounds(icon_x,
top_margin +
diff --git a/ui/views/controls/menu/menu_model_adapter_unittest.cc b/ui/views/controls/menu/menu_model_adapter_unittest.cc
index ba6d406..8f86335 100644
--- a/ui/views/controls/menu/menu_model_adapter_unittest.cc
+++ b/ui/views/controls/menu/menu_model_adapter_unittest.cc
@@ -79,7 +79,7 @@ class MenuModelBase : public ui::MenuModel {
return 0;
}
- virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE {
+ virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE {
return false;
}
diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc
index 564fd5c..736a7ed 100644
--- a/ui/views/controls/menu/menu_win.cc
+++ b/ui/views/controls/menu/menu_win.cc
@@ -40,7 +40,7 @@ static MenuHostWindow* active_host_window = NULL;
// The data of menu items needed to display.
struct MenuWin::ItemData {
string16 label;
- SkBitmap icon;
+ gfx::ImageSkia icon;
bool submenu;
};
@@ -263,7 +263,7 @@ MenuWin::~MenuWin() {
void MenuWin::AddMenuItemWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
owner_draw_ = true;
Menu::AddMenuItemWithIcon(index, item_id, label, icon);
}
@@ -271,7 +271,7 @@ void MenuWin::AddMenuItemWithIcon(int index,
Menu* MenuWin::AddSubMenuWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) {
+ const gfx::ImageSkia& icon) {
MenuWin* submenu = new MenuWin(this);
submenus_.push_back(submenu);
AddMenuItemInternal(index, item_id, label, icon, submenu->menu_, NORMAL);
@@ -305,7 +305,7 @@ void MenuWin::SetMenuLabel(int item_id, const string16& label) {
SetMenuItemInfo(menu_, item_id, false, &mii);
}
-bool MenuWin::SetIcon(const SkBitmap& icon, int item_id) {
+bool MenuWin::SetIcon(const gfx::ImageSkia& icon, int item_id) {
if (!owner_draw_)
owner_draw_ = true;
@@ -386,7 +386,7 @@ int MenuWin::ItemCount() {
void MenuWin::AddMenuItemInternal(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
MenuItemType type) {
AddMenuItemInternal(index, item_id, label, icon, NULL, type);
}
@@ -394,7 +394,7 @@ void MenuWin::AddMenuItemInternal(int index,
void MenuWin::AddMenuItemInternal(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
HMENU submenu,
MenuItemType type) {
DCHECK(type != SEPARATOR) << "Call AddSeparator instead!";
diff --git a/ui/views/controls/menu/menu_win.h b/ui/views/controls/menu/menu_win.h
index 3b20f27..dd12a64 100644
--- a/ui/views/controls/menu/menu_win.h
+++ b/ui/views/controls/menu/menu_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -50,16 +50,16 @@ class MenuWin : public Menu {
virtual void AddMenuItemWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) OVERRIDE;
+ const gfx::ImageSkia& icon) OVERRIDE;
virtual Menu* AddSubMenuWithIcon(int index,
int item_id,
const string16& label,
- const SkBitmap& icon) OVERRIDE;
+ const gfx::ImageSkia& icon) OVERRIDE;
virtual void AddSeparator(int index) OVERRIDE;
virtual void EnableMenuItemByID(int item_id, bool enabled) OVERRIDE;
virtual void EnableMenuItemAt(int index, bool enabled) OVERRIDE;
virtual void SetMenuLabel(int item_id, const string16& label) OVERRIDE;
- virtual bool SetIcon(const SkBitmap& icon, int item_id) OVERRIDE;
+ virtual bool SetIcon(const gfx::ImageSkia& icon, int item_id) OVERRIDE;
virtual void RunMenuAt(int x, int y) OVERRIDE;
virtual void Cancel() OVERRIDE;
virtual int ItemCount() OVERRIDE;
@@ -75,7 +75,7 @@ class MenuWin : public Menu {
virtual void AddMenuItemInternal(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
MenuItemType type) OVERRIDE;
private:
@@ -87,7 +87,7 @@ class MenuWin : public Menu {
void AddMenuItemInternal(int index,
int item_id,
const string16& label,
- const SkBitmap& icon,
+ const gfx::ImageSkia& icon,
HMENU submenu,
MenuItemType type);
diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc
index 2b4af01..94461f33 100644
--- a/ui/views/controls/menu/native_menu_win.cc
+++ b/ui/views/controls/menu/native_menu_win.cc
@@ -12,7 +12,7 @@
#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/win/wrapped_window_proc.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util.h"
@@ -252,7 +252,7 @@ class NativeMenuWin::MenuHostWindow {
// Draw the icon after the label, otherwise it would be covered
// by the label.
- SkBitmap icon;
+ gfx::ImageSkia icon;
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
// We currently don't support items with both icons and checkboxes.
DCHECK(type != ui::MenuModel::TYPE_CHECK);
diff --git a/ui/views/controls/message_box_view.cc b/ui/views/controls/message_box_view.cc
index a0a2bf6..23151f1 100644
--- a/ui/views/controls/message_box_view.cc
+++ b/ui/views/controls/message_box_view.cc
@@ -91,7 +91,7 @@ bool MessageBoxView::IsCheckBoxSelected() {
return checkbox_ ? checkbox_->checked() : false;
}
-void MessageBoxView::SetIcon(const SkBitmap& icon) {
+void MessageBoxView::SetIcon(const gfx::ImageSkia& icon) {
if (!icon_)
icon_ = new ImageView();
icon_->SetImage(icon);
diff --git a/ui/views/controls/message_box_view.h b/ui/views/controls/message_box_view.h
index 7fa2f07..c492155 100644
--- a/ui/views/controls/message_box_view.h
+++ b/ui/views/controls/message_box_view.h
@@ -11,6 +11,10 @@
#include "base/string16.h"
#include "ui/views/view.h"
+namespace gfx {
+class ImageSkia;
+}
+
namespace views {
class Checkbox;
@@ -62,7 +66,7 @@ class VIEWS_EXPORT MessageBoxView : public View {
// Adds |icon| to the upper left of the message box or replaces the current
// icon. To start out, the message box has no icon.
- void SetIcon(const SkBitmap& icon);
+ void SetIcon(const gfx::ImageSkia& icon);
// Adds a checkbox with the specified label to the message box if this is the
// first call. Otherwise, it changes the label of the current checkbox. To
diff --git a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc
index aa614ea..6caaac0 100644
--- a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc
+++ b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc
@@ -13,10 +13,10 @@
#include "base/utf_string_conversions.h"
#include "build/build_config.h"
#include "grit/ui_strings.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/menu/menu.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h"
@@ -109,50 +109,50 @@ class BitmapScrollBarThumb : public BaseScrollBarThumb {
// View overrides:
virtual gfx::Size GetPreferredSize() OVERRIDE {
- return gfx::Size(background_bitmap()->width(),
- start_cap_bitmap()->height() +
- end_cap_bitmap()->height() +
- grippy_bitmap()->height());
+ return gfx::Size(background_image()->width(),
+ start_cap_image()->height() +
+ end_cap_image()->height() +
+ grippy_image()->height());
}
protected:
// View overrides:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->DrawBitmapInt(*start_cap_bitmap(), 0, 0);
- int top_cap_height = start_cap_bitmap()->height();
- int bottom_cap_height = end_cap_bitmap()->height();
+ canvas->DrawBitmapInt(*start_cap_image(), 0, 0);
+ int top_cap_height = start_cap_image()->height();
+ int bottom_cap_height = end_cap_image()->height();
int thumb_body_height = height() - top_cap_height - bottom_cap_height;
- canvas->TileImageInt(*background_bitmap(), 0, top_cap_height,
- background_bitmap()->width(), thumb_body_height);
- canvas->DrawBitmapInt(*end_cap_bitmap(), 0,
+ canvas->TileImageInt(*background_image(), 0, top_cap_height,
+ background_image()->width(), thumb_body_height);
+ canvas->DrawBitmapInt(*end_cap_image(), 0,
height() - bottom_cap_height);
// Paint the grippy over the track.
- int grippy_x = (width() - grippy_bitmap()->width()) / 2;
- int grippy_y = (thumb_body_height - grippy_bitmap()->height()) / 2;
- canvas->DrawBitmapInt(*grippy_bitmap(), grippy_x, grippy_y);
+ int grippy_x = (width() - grippy_image()->width()) / 2;
+ int grippy_y = (thumb_body_height - grippy_image()->height()) / 2;
+ canvas->DrawBitmapInt(*grippy_image(), grippy_x, grippy_y);
}
private:
// Returns the image rendered at the start of the thumb.
- gfx::ImageSkia* start_cap_bitmap() const {
+ gfx::ImageSkia* start_cap_image() const {
return scroll_bar_->images_[BitmapScrollBar::THUMB_START_CAP][GetState()];
}
// Returns the image rendered at the end of the thumb.
- gfx::ImageSkia* end_cap_bitmap() const {
+ gfx::ImageSkia* end_cap_image() const {
return scroll_bar_->images_[BitmapScrollBar::THUMB_END_CAP][GetState()];
}
// Returns the image that is tiled in the background of the thumb between
// the start and the end caps.
- gfx::ImageSkia* background_bitmap() const {
+ gfx::ImageSkia* background_image() const {
return scroll_bar_->images_[BitmapScrollBar::THUMB_MIDDLE][GetState()];
}
// Returns the image that is rendered in the middle of the thumb
- // transparently over the background bitmap.
- gfx::ImageSkia* grippy_bitmap() const {
+ // transparently over the background image.
+ gfx::ImageSkia* grippy_image() const {
return scroll_bar_->images_[BitmapScrollBar::THUMB_GRIPPY]
[CustomButton::BS_NORMAL];
}
@@ -265,7 +265,7 @@ void BitmapScrollBar::Layout() {
// Preserve the height/width of the thumb (depending on orientation) as set
// by the last call to |Update|, but coerce the width/height to be the
- // appropriate value for the bitmaps provided.
+ // appropriate value for the images provided.
if (IsHorizontal()) {
thumb->SetBounds(thumb->x(), thumb->y(), thumb->width(),
thumb_prefsize.height());
diff --git a/ui/views/controls/scrollbar/bitmap_scroll_bar.h b/ui/views/controls/scrollbar/bitmap_scroll_bar.h
index 3c6a1b4..10fd6d1 100644
--- a/ui/views/controls/scrollbar/bitmap_scroll_bar.h
+++ b/ui/views/controls/scrollbar/bitmap_scroll_bar.h
@@ -18,8 +18,8 @@ class BitmapScrollBarThumb;
//
// BitmapScrollBar
//
-// A ScrollBar subclass that implements a scroll bar rendered using bitmaps
-// that the user provides. There are bitmaps for the up and down buttons, as
+// A ScrollBar subclass that implements a scroll bar rendered using images
+// that the user provides. There are images for the up and down buttons, as
// well as for the thumb and track. This is intended for creating UIs that
// have customized, non-native appearances, like floating HUDs etc.
//
@@ -30,7 +30,7 @@ class VIEWS_EXPORT BitmapScrollBar : public BaseScrollBar,
BitmapScrollBar(bool horizontal, bool show_scroll_buttons);
virtual ~BitmapScrollBar() { }
- // A list of parts that the user may supply bitmaps for.
+ // A list of parts that the user may supply images for.
enum ScrollBarPart {
// The button used to represent scrolling up/left by 1 line.
PREV_BUTTON = 0,
diff --git a/ui/views/controls/scrollbar/scroll_bar.h b/ui/views/controls/scrollbar/scroll_bar.h
index 52bbb17..b34f4ed 100644
--- a/ui/views/controls/scrollbar/scroll_bar.h
+++ b/ui/views/controls/scrollbar/scroll_bar.h
@@ -91,7 +91,7 @@ class VIEWS_EXPORT ScrollBar : public View {
protected:
// Create new scrollbar, either horizontal or vertical. These are protected
// since you need to be creating either a NativeScrollBar or a
- // BitmapScrollBar.
+ // ImageScrollBar.
explicit ScrollBar(bool is_horiz);
private:
diff --git a/ui/views/controls/table/table_view_views.cc b/ui/views/controls/table/table_view_views.cc
index 365f81ba..bc27412 100644
--- a/ui/views/controls/table/table_view_views.cc
+++ b/ui/views/controls/table/table_view_views.cc
@@ -5,10 +5,10 @@
#include "ui/views/controls/table/table_view_views.h"
#include "base/i18n/rtl.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/table_model.h"
-#include "ui/gfx/canvas.h"
#include "ui/base/native_theme/native_theme.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/border.h"
#include "ui/views/controls/scroll_view.h"
@@ -249,7 +249,7 @@ void TableView::OnPaint(gfx::Canvas* canvas) {
}
int text_x = kTextHorizontalPadding;
if (table_type_ == ICON_AND_TEXT) {
- SkBitmap image = model_->GetIcon(i);
+ gfx::ImageSkia image = model_->GetIcon(i);
if (!image.isNull()) {
int image_x = GetMirroredXWithWidthInView(text_x, image.width());
canvas->DrawBitmapInt(
diff --git a/ui/views/controls/table/table_view_win.cc b/ui/views/controls/table/table_view_win.cc
index 3a1be57..42a266a 100644
--- a/ui/views/controls/table/table_view_win.cc
+++ b/ui/views/controls/table/table_view_win.cc
@@ -13,7 +13,7 @@
#include "base/string_util.h"
#include "base/win/scoped_gdi_object.h"
#include "skia/ext/skia_utils_win.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
@@ -24,6 +24,7 @@
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/font.h"
#include "ui/gfx/icon_util.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/controls/table/table_view_observer.h"
@@ -1225,7 +1226,7 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) {
LRESULT r = CDRF_DODEFAULT;
// First let's take care of painting the right icon.
if (table_type_ == ICON_AND_TEXT) {
- SkBitmap image = model_->GetIcon(model_index);
+ gfx::ImageSkia image = model_->GetIcon(model_index);
if (!image.isNull()) {
// Get the rect that holds the icon.
RECT icon_rect, client_rect;
diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc
index 2d557cc..2849617 100644
--- a/ui/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc
@@ -866,7 +866,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) {
bad_data.SetFilename(FilePath(FILE_PATH_LITERAL("x")));
#if defined(OS_WIN)
#if defined(USE_AURA)
- ui::OSExchangeData::CustomFormat fmt = ui::Clipboard::GetBitmapFormatType();
+ ui::OSExchangeData::CustomFormat fmt = ui::Clipboard::GetImageFormatType();
#else
ui::OSExchangeData::CustomFormat fmt = CF_BITMAP;
#endif
diff --git a/ui/views/controls/throbber.cc b/ui/views/controls/throbber.cc
index 8fe55ff..d9feb14 100644
--- a/ui/views/controls/throbber.cc
+++ b/ui/views/controls/throbber.cc
@@ -6,7 +6,7 @@
#include "base/time.h"
#include "grit/ui_resources.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
@@ -23,7 +23,7 @@ Throbber::Throbber(int frame_time_ms,
frames_(NULL),
frame_time_(TimeDelta::FromMilliseconds(frame_time_ms)) {
SetFrames(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_THROBBER).ToSkBitmap());
+ IDR_THROBBER).ToImageSkia());
}
Throbber::~Throbber() {
@@ -54,7 +54,7 @@ void Throbber::Stop() {
SchedulePaint(); // Important if we're not painting while stopped
}
-void Throbber::SetFrames(const SkBitmap* frames) {
+void Throbber::SetFrames(const gfx::ImageSkia* frames) {
frames_ = frames;
DCHECK(frames_->width() > 0 && frames_->height() > 0);
DCHECK(frames_->width() % frames_->height() == 0);
@@ -140,7 +140,7 @@ CheckmarkThrobber::CheckmarkThrobber()
: Throbber(kFrameTimeMs, false),
checked_(false),
checkmark_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_CHECKMARK).ToSkBitmap()) {
+ IDR_CHECKMARK).ToImageSkia()) {
}
void CheckmarkThrobber::SetChecked(bool checked) {
diff --git a/ui/views/controls/throbber.h b/ui/views/controls/throbber.h
index aeb1d9b..7fa6ea8 100644
--- a/ui/views/controls/throbber.h
+++ b/ui/views/controls/throbber.h
@@ -12,7 +12,9 @@
#include "base/timer.h"
#include "ui/views/view.h"
-class SkBitmap;
+namespace gfx {
+class ImageSkia;
+}
namespace views {
@@ -25,7 +27,7 @@ class VIEWS_EXPORT Throbber : public View {
// If |paint_while_stopped| is false, this view will be invisible when not
// running.
Throbber(int frame_time_ms, bool paint_while_stopped);
- Throbber(int frame_time_ms, bool paint_while_stopped, SkBitmap* frames);
+ Throbber(int frame_time_ms, bool paint_while_stopped, gfx::ImageSkia* frames);
virtual ~Throbber();
// Start and stop the throbber animation
@@ -33,7 +35,7 @@ class VIEWS_EXPORT Throbber : public View {
virtual void Stop();
// Set custom throbber frames. Otherwise IDR_THROBBER is loaded.
- void SetFrames(const SkBitmap* frames);
+ void SetFrames(const gfx::ImageSkia* frames);
// Overridden from View:
virtual gfx::Size GetPreferredSize() OVERRIDE;
@@ -49,7 +51,7 @@ class VIEWS_EXPORT Throbber : public View {
bool paint_while_stopped_;
int frame_count_; // How many frames we have.
base::Time start_time_; // Time when Start was called.
- const SkBitmap* frames_; // Frames bitmaps.
+ const gfx::ImageSkia* frames_; // Frames images.
base::TimeDelta frame_time_; // How long one frame is displayed.
base::RepeatingTimer<Throbber> timer_; // Used to schedule Run calls.
@@ -63,7 +65,7 @@ class VIEWS_EXPORT Throbber : public View {
class VIEWS_EXPORT SmoothedThrobber : public Throbber {
public:
explicit SmoothedThrobber(int frame_delay_ms);
- SmoothedThrobber(int frame_delay_ms, SkBitmap* frames);
+ SmoothedThrobber(int frame_delay_ms, gfx::ImageSkia* frames);
virtual ~SmoothedThrobber();
virtual void Start() OVERRIDE;
@@ -116,7 +118,7 @@ class VIEWS_EXPORT CheckmarkThrobber : public Throbber {
bool checked_;
// The checkmark image.
- const SkBitmap* checkmark_;
+ const gfx::ImageSkia* checkmark_;
DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber);
};
diff --git a/ui/views/controls/tree/tree_view_views.cc b/ui/views/controls/tree/tree_view_views.cc
index 524b763..20634e9 100644
--- a/ui/views/controls/tree/tree_view_views.cc
+++ b/ui/views/controls/tree/tree_view_views.cc
@@ -60,10 +60,10 @@ TreeView::TreeView()
set_background(Background::CreateSolidBackground(SK_ColorWHITE));
closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
(base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL
- : IDR_FOLDER_CLOSED)).ToSkBitmap();
+ : IDR_FOLDER_CLOSED)).ToImageSkia();
open_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
(base::i18n::IsRTL() ? IDR_FOLDER_OPEN_RTL
- : IDR_FOLDER_OPEN)).ToSkBitmap();
+ : IDR_FOLDER_OPEN)).ToImageSkia();
text_offset_ = closed_icon_.width() + kImagePadding + kImagePadding +
kArrowRegionSize;
}
@@ -639,7 +639,7 @@ void TreeView::PaintRow(gfx::Canvas* canvas,
PaintExpandControl(canvas, bounds, node->is_expanded());
// Paint the icon.
- SkBitmap icon;
+ gfx::ImageSkia icon;
int icon_index = model_->GetIconIndex(node->model_node());
if (icon_index != -1)
icon = icons_[icon_index];
diff --git a/ui/views/controls/tree/tree_view_views.h b/ui/views/controls/tree/tree_view_views.h
index f2ec5ce..4eb6368 100644
--- a/ui/views/controls/tree/tree_view_views.h
+++ b/ui/views/controls/tree/tree_view_views.h
@@ -10,9 +10,9 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/tree_node_model.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/view.h"
@@ -311,11 +311,11 @@ class VIEWS_EXPORT TreeView : public View,
ui::TreeModel* model_;
// Default icons for closed/open.
- SkBitmap closed_icon_;
- SkBitmap open_icon_;
+ gfx::ImageSkia closed_icon_;
+ gfx::ImageSkia open_icon_;
// Icons from the model.
- std::vector<SkBitmap> icons_;
+ std::vector<gfx::ImageSkia> icons_;
// The root node.
InternalNode root_;
diff --git a/ui/views/controls/tree/tree_view_win.cc b/ui/views/controls/tree/tree_view_win.cc
index a878432..3f982fc 100644
--- a/ui/views/controls/tree/tree_view_win.cc
+++ b/ui/views/controls/tree/tree_view_win.cc
@@ -657,16 +657,16 @@ TreeView::NodeDetails* TreeView::GetNodeDetailsByTreeItem(HTREEITEM tree_item) {
}
HIMAGELIST TreeView::CreateImageList() {
- std::vector<SkBitmap> model_images;
+ std::vector<gfx::ImageSkia> model_images;
model_->GetIcons(&model_images);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
bool rtl = base::i18n::IsRTL();
// Creates the default image list used for trees.
- const SkBitmap* closed_icon = rb.GetImageNamed(
- (rtl ? IDR_FOLDER_CLOSED_RTL : IDR_FOLDER_CLOSED)).ToSkBitmap();
- const SkBitmap* opened_icon = rb.GetImageNamed(
- (rtl ? IDR_FOLDER_OPEN_RTL : IDR_FOLDER_OPEN)).ToSkBitmap();
+ const gfx::ImageSkia* closed_icon = rb.GetImageNamed(
+ (rtl ? IDR_FOLDER_CLOSED_RTL : IDR_FOLDER_CLOSED)).ToImageSkia();
+ const gfx::ImageSkia* opened_icon = rb.GetImageNamed(
+ (rtl ? IDR_FOLDER_OPEN_RTL : IDR_FOLDER_OPEN)).ToImageSkia();
int width = closed_icon->width();
int height = closed_icon->height();
DCHECK(opened_icon->width() == width && opened_icon->height() == height);
diff --git a/ui/views/examples/button_example.cc b/ui/views/examples/button_example.cc
index 21dfc20..dca7c8f 100644
--- a/ui/views/examples/button_example.cc
+++ b/ui/views/examples/button_example.cc
@@ -29,7 +29,7 @@ ButtonExample::ButtonExample()
icon_(NULL),
count_(0) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- icon_ = rb.GetImageNamed(IDR_CLOSE_SA_H).ToSkBitmap();
+ icon_ = rb.GetImageNamed(IDR_CLOSE_SA_H).ToImageSkia();
}
ButtonExample::~ButtonExample() {
@@ -50,7 +50,8 @@ void ButtonExample::CreateExampleView(View* container) {
rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia());
image_button_->SetImage(ImageButton::BS_PUSHED,
rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia());
- image_button_->SetOverlayImage(rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap());
+ image_button_->SetOverlayImage(rb.GetImageNamed(
+ IDR_MENU_CHECK).ToImageSkia());
container->AddChildView(image_button_);
}
@@ -80,7 +81,7 @@ void ButtonExample::ButtonPressed(Button* sender, const Event& event) {
}
} else if (event.IsAltDown()) {
if (text_button_->HasIcon())
- text_button_->SetIcon(SkBitmap());
+ text_button_->SetIcon(gfx::ImageSkia());
else
text_button_->SetIcon(*icon_);
} else {
diff --git a/ui/views/examples/button_example.h b/ui/views/examples/button_example.h
index da0970c..55f4685 100644
--- a/ui/views/examples/button_example.h
+++ b/ui/views/examples/button_example.h
@@ -38,7 +38,7 @@ class ButtonExample : public ExampleBase, public ButtonListener {
// Values used to modify the look and feel of the button.
TextButton::TextAlignment alignment_;
bool use_native_theme_border_;
- const SkBitmap* icon_;
+ const gfx::ImageSkia* icon_;
// The number of times the buttons are pressed.
int count_;
diff --git a/ui/views/examples/table_example.cc b/ui/views/examples/table_example.cc
index f0595c8..51ab1d3 100644
--- a/ui/views/examples/table_example.cc
+++ b/ui/views/examples/table_example.cc
@@ -8,7 +8,9 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/layout/grid_layout.h"
@@ -111,7 +113,7 @@ string16 TableExample::GetText(int row, int column_id) {
return ASCIIToUTF16(cells[row % 5][column_id]);
}
-SkBitmap TableExample::GetIcon(int row) {
+gfx::ImageSkia TableExample::GetIcon(int row) {
return row % 2 ? icon1_ : icon2_;
}
diff --git a/ui/views/examples/table_example.h b/ui/views/examples/table_example.h
index 45a98ad..33f1cde 100644
--- a/ui/views/examples/table_example.h
+++ b/ui/views/examples/table_example.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,6 +17,10 @@
#include "ui/views/controls/table/table_view_observer.h"
#include "ui/views/examples/example_base.h"
+namespace gfx {
+class ImageSkia;
+}
+
namespace views {
class Checkbox;
class Event;
@@ -38,7 +42,7 @@ class TableExample : public ExampleBase,
// ui::TableModel:
virtual int RowCount() OVERRIDE;
virtual string16 GetText(int row, int column_id) OVERRIDE;
- virtual SkBitmap GetIcon(int row) OVERRIDE;
+ virtual gfx::ImageSkia GetIcon(int row) OVERRIDE;
virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE;
// TableViewObserver:
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index 2e32f63..f78e06f 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -1367,7 +1367,7 @@ class MockMenuModel : public ui::MenuModel {
ui::Accelerator* accelerator));
MOCK_CONST_METHOD1(IsItemCheckedAt, bool(int index));
MOCK_CONST_METHOD1(GetGroupIdAt, int(int index));
- MOCK_METHOD2(GetIconAt, bool(int index, SkBitmap* icon));
+ MOCK_METHOD2(GetIconAt, bool(int index, gfx::ImageSkia* icon));
MOCK_CONST_METHOD1(GetButtonMenuItemAt, ui::ButtonMenuItemModel*(int index));
MOCK_CONST_METHOD1(IsEnabledAt, bool(int index));
MOCK_CONST_METHOD1(IsVisibleAt, bool(int index));