diff options
Diffstat (limited to 'ash')
26 files changed, 116 insertions, 110 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index 5b2562e..a173098 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -42,7 +42,7 @@ class DesktopBackgroundController::WallpaperOperation if (cancel_flag_.IsSet()) return; wallpaper_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( - GetWallpaperInfo(index_).id).ToSkBitmap(); + GetWallpaperInfo(index_).id).ToImageSkia(); if (cancel_flag_.IsSet()) return; layout_ = GetWallpaperInfo(index_).layout; @@ -52,7 +52,7 @@ class DesktopBackgroundController::WallpaperOperation cancel_flag_.Set(); } - const SkBitmap* wallpaper() { + const gfx::ImageSkia* wallpaper() { return wallpaper_; } @@ -70,7 +70,7 @@ class DesktopBackgroundController::WallpaperOperation base::CancellationFlag cancel_flag_; - const SkBitmap* wallpaper_; + const gfx::ImageSkia* wallpaper_; WallpaperLayout layout_; int index_; @@ -103,8 +103,9 @@ void DesktopBackgroundController::SetDefaultWallpaper(int index) { true /* task_is_slow */); } -void DesktopBackgroundController::SetCustomWallpaper(const SkBitmap& wallpaper, - WallpaperLayout layout) { +void DesktopBackgroundController::SetCustomWallpaper( + const gfx::ImageSkia& wallpaper, + WallpaperLayout layout) { internal::RootWindowLayoutManager* root_window_layout = Shell::GetInstance()->root_window_layout(); root_window_layout->SetBackgroundLayer(NULL); @@ -170,7 +171,7 @@ void DesktopBackgroundController::OnWallpaperLoadCompleted( } void DesktopBackgroundController::CreateEmptyWallpaper() { - SkBitmap dummy; + gfx::ImageSkia dummy; internal::CreateDesktopBackground(dummy, CENTER); desktop_background_mode_ = BACKGROUND_IMAGE; } diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h index a531001..0b80157 100644 --- a/ash/desktop_background/desktop_background_controller.h +++ b/ash/desktop_background/desktop_background_controller.h @@ -11,7 +11,9 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" -class SkBitmap; +namespace gfx { +class ImageSkia; +} namespace ash { @@ -53,7 +55,8 @@ class ASH_EXPORT DesktopBackgroundController { // Sets the user selected custom wallpaper. Called when user selected a file // from file system or changed the layout of wallpaper. - void SetCustomWallpaper(const SkBitmap& wallpaper, WallpaperLayout layout); + void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, + WallpaperLayout layout); // Cancels the current wallpaper loading operation. void CancelPendingWallpaperOperation(); diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc index e5cf675..76dc091 100644 --- a/ash/desktop_background/desktop_background_resources.cc +++ b/ash/desktop_background/desktop_background_resources.cc @@ -9,7 +9,6 @@ #include "grit/ui_resources.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" -#include "third_party/skia/include/core/SkBitmap.h" namespace { diff --git a/ash/desktop_background/desktop_background_resources.h b/ash/desktop_background/desktop_background_resources.h index 4b48e9d..1de8762 100644 --- a/ash/desktop_background/desktop_background_resources.h +++ b/ash/desktop_background/desktop_background_resources.h @@ -7,8 +7,6 @@ #include "ash/ash_export.h" -class SkBitmap; - namespace ash { enum WallpaperLayout { diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index c1c08d8..bedd737 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -60,11 +60,10 @@ static int RoundPositive(double x) { //////////////////////////////////////////////////////////////////////////////// // DesktopBackgroundView, public: -DesktopBackgroundView::DesktopBackgroundView(const SkBitmap& wallpaper, +DesktopBackgroundView::DesktopBackgroundView(const gfx::ImageSkia& wallpaper, WallpaperLayout wallpaper_layout) { wallpaper_ = wallpaper; wallpaper_layout_ = wallpaper_layout; - wallpaper_.buildMipMap(false); } DesktopBackgroundView::~DesktopBackgroundView() { @@ -127,7 +126,7 @@ void DesktopBackgroundView::OnMouseReleased(const views::MouseEvent& event) { Shell::GetInstance()->ShowBackgroundMenu(GetWidget(), event.location()); } -void CreateDesktopBackground(const SkBitmap& wallpaper, +void CreateDesktopBackground(const gfx::ImageSkia& wallpaper, WallpaperLayout wallpaper_layout) { views::Widget* desktop_widget = new views::Widget; views::Widget::InitParams params( diff --git a/ash/desktop_background/desktop_background_view.h b/ash/desktop_background/desktop_background_view.h index 4a5b676..16164e4 100644 --- a/ash/desktop_background/desktop_background_view.h +++ b/ash/desktop_background/desktop_background_view.h @@ -7,7 +7,7 @@ #pragma once #include "ash/desktop_background/desktop_background_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/view.h" #include "ui/views/widget/widget_delegate.h" @@ -16,7 +16,7 @@ namespace internal { class DesktopBackgroundView : public views::WidgetDelegateView { public: - DesktopBackgroundView(const SkBitmap& wallpaper, + DesktopBackgroundView(const gfx::ImageSkia& wallpaper, WallpaperLayout wallpaper_layout); virtual ~DesktopBackgroundView(); @@ -26,7 +26,7 @@ class DesktopBackgroundView : public views::WidgetDelegateView { virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; - SkBitmap wallpaper_; + gfx::ImageSkia wallpaper_; WallpaperLayout wallpaper_layout_; DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundView); diff --git a/ash/shell.cc b/ash/shell.cc index ebf4a19..a9f9d42 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -65,7 +65,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "grit/ui_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" #include "ui/aura/focus_manager.h" @@ -78,6 +77,7 @@ #include "ui/aura/window.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/monitor.h" #include "ui/gfx/screen.h" #include "ui/gfx/size.h" @@ -276,7 +276,7 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { return "über@tray"; } - virtual const SkBitmap& GetUserImage() const OVERRIDE { + virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { return null_image_; } @@ -505,7 +505,7 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { bool bluetooth_enabled_; float volume_; bool caps_lock_enabled_; - SkBitmap null_image_; + gfx::ImageSkia null_image_; DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); }; diff --git a/ash/shell.h b/ash/shell.h index 7d162b4..237c4945 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -17,11 +17,10 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" -#include "ui/gfx/size.h" #include "ui/gfx/insets.h" +#include "ui/gfx/size.h" class CommandLine; -class SkBitmap; namespace aura { class EventFilter; @@ -39,6 +38,7 @@ class BrowserContext; } namespace gfx { +class ImageSkia; class Point; class Rect; } diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index b9d1174..4e5cb06 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -5,9 +5,9 @@ #include <string> #include "ash/shell.h" -#include "ash/shell_delegate.h" #include "ash/shell/example_factory.h" #include "ash/shell/toplevel_window.h" +#include "ash/shell_delegate.h" #include "base/basictypes.h" #include "base/i18n/case_conversion.h" #include "base/i18n/string_search.h" @@ -46,7 +46,7 @@ class WindowTypeLauncherItem : public app_list::AppListItemModel { SetTitle(GetTitle(type)); } - static SkBitmap GetIcon(Type type) { + static gfx::ImageSkia GetIcon(Type type) { static const SkColor kColors[] = { SK_ColorRED, SK_ColorGREEN, @@ -60,7 +60,7 @@ class WindowTypeLauncherItem : public app_list::AppListItemModel { icon.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); icon.allocPixels(); icon.eraseColor(kColors[static_cast<int>(type) % arraysize(kColors)]); - return icon; + return gfx::ImageSkia(icon); } // The text below is not localized as this is an example code. @@ -199,7 +199,7 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { } } - SkBitmap CreateSearchBoxIcon() { + gfx::ImageSkia CreateSearchBoxIcon() { const string16 icon_text = ASCIIToUTF16("ash"); const gfx::Size icon_size(32, 32); @@ -212,7 +212,7 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { gfx::Canvas::TEXT_VALIGN_MIDDLE | gfx::Canvas::NO_SUBPIXEL_RENDERING); - return canvas.ExtractBitmap(); + return gfx::ImageSkia(canvas.ExtractBitmap()); } void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) { diff --git a/ash/shell_factory.h b/ash/shell_factory.h index c1ebf51e..7e60116 100644 --- a/ash/shell_factory.h +++ b/ash/shell_factory.h @@ -9,7 +9,9 @@ #include "ash/ash_export.h" #include "ash/desktop_background/desktop_background_resources.h" -class SkBitmap; +namespace gfx { +class ImageSkia; +} namespace views { class View; @@ -21,7 +23,7 @@ class Widget; namespace ash { namespace internal { -void CreateDesktopBackground(const SkBitmap& wallpaper, +void CreateDesktopBackground(const gfx::ImageSkia& wallpaper, WallpaperLayout wallpaper_layout); ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents); } // namespace internal diff --git a/ash/system/date/tray_date.cc b/ash/system/date/tray_date.cc index a3224a5..e9c9a25 100644 --- a/ash/system/date/tray_date.cc +++ b/ash/system/date/tray_date.cc @@ -16,10 +16,10 @@ #include "base/timer.h" #include "base/utf_string_conversions.h" #include "grit/ui_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkRect.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/size.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/button/text_button.h" diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc index 632d595..95823ca 100644 --- a/ash/system/network/tray_network.cc +++ b/ash/system/network/tray_network.cc @@ -448,7 +448,7 @@ class NetworkDetailedView : public TrayDetailsView, HoverHighlightView* container = new HoverHighlightView(this); container->set_fixed_height(kTrayPopupItemHeight); container->AddIconAndLabel( - *rb.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_AIRPLANE).ToSkBitmap(), + *rb.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_AIRPLANE).ToImageSkia(), rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_AIRPLANE_MODE), gfx::Font::NORMAL); AddChildView(container); diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index 4d7b8ae..48b206e 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -17,12 +17,12 @@ #include "base/utf_string_conversions.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkRect.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/size.h" -#include "ui/base/l10n/l10n_util.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/controls/image_view.h" @@ -58,9 +58,9 @@ enum IconSet { ICON_DARK }; -SkBitmap GetBatteryImage(const PowerSupplyStatus& supply_status, +gfx::ImageSkia GetBatteryImage(const PowerSupplyStatus& supply_status, IconSet icon_set) { - SkBitmap image; + gfx::ImageSkia image; gfx::Image all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( icon_set == ICON_DARK ? IDR_AURA_UBER_TRAY_POWER_SMALL_DARK : IDR_AURA_UBER_TRAY_POWER_SMALL); @@ -83,7 +83,7 @@ SkBitmap GetBatteryImage(const PowerSupplyStatus& supply_status, (supply_status.line_power_on ? kBatteryImageWidth : 0) + 2, image_index * kBatteryImageHeight, kBatteryImageWidth - 2, kBatteryImageHeight); - all.ToSkBitmap()->extractSubset(&image, region); + all.ToImageSkia()->extractSubset(&image, region); return image; } diff --git a/ash/system/status_area_widget_delegate.h b/ash/system/status_area_widget_delegate.h index ffba10d..35228d4 100644 --- a/ash/system/status_area_widget_delegate.h +++ b/ash/system/status_area_widget_delegate.h @@ -7,7 +7,7 @@ #pragma once #include "ash/ash_export.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/accessible_pane_view.h" #include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget_delegate.h" diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index 3b9284f..d8d48ff 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -10,12 +10,11 @@ #include <vector> #include "ash/ash_export.h" -#include "ash/system/user/login_status.h" #include "ash/system/power/power_supply_status.h" +#include "ash/system/user/login_status.h" #include "base/file_path.h" #include "base/i18n/time_formatting.h" #include "base/string16.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image_skia.h" namespace ash { @@ -107,7 +106,7 @@ class SystemTrayDelegate { // Gets information about the logged in user. virtual const std::string GetUserDisplayName() const = 0; virtual const std::string GetUserEmail() const = 0; - virtual const SkBitmap& GetUserImage() const = 0; + virtual const gfx::ImageSkia& GetUserImage() const = 0; virtual user::LoginStatus GetUserLoginStatus() const = 0; // Returns whether a system upgrade is available. diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc index 5418fa3..664f987b 100644 --- a/ash/system/tray/tray_views.cc +++ b/ash/system/tray/tray_views.cc @@ -5,7 +5,6 @@ #include "ash/system/tray/tray_views.h" #include "ash/system/tray/tray_constants.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" #include "grit/ui_resources_standard.h" @@ -13,6 +12,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/views/border.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/label.h" @@ -125,7 +125,7 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener) HoverHighlightView::~HoverHighlightView() { } -void HoverHighlightView::AddIconAndLabel(const SkBitmap& image, +void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, const string16& text, gfx::Font::FontStyle style) { SetLayoutManager(new views::BoxLayout( @@ -412,7 +412,7 @@ void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { container->set_text_default_color(kHeaderTextColorNormal); container->AddIconAndLabel( - *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap(), + *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(), rb.GetLocalizedString(string_id), gfx::Font::BOLD); @@ -528,7 +528,7 @@ void TrayNotificationView::InitView(views::View* contents) { layout->AddPaddingRow(0, kTrayPopupPaddingBetweenItems); } -void TrayNotificationView::SetIconImage(const SkBitmap& image) { +void TrayNotificationView::SetIconImage(const gfx::ImageSkia& image) { icon_->SetImage(image); SchedulePaint(); } @@ -542,7 +542,7 @@ void TrayNotificationView::UpdateView(views::View* new_contents) { } void TrayNotificationView::UpdateViewAndImage(views::View* new_contents, - const SkBitmap& image) { + const gfx::ImageSkia& image) { RemoveAllChildViews(true); InitView(new_contents); icon_->SetImage(image); diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h index f6173b2..2eff8bb 100644 --- a/ash/system/tray/tray_views.h +++ b/ash/system/tray/tray_views.h @@ -16,9 +16,12 @@ #include "ui/views/controls/slider.h" #include "ui/views/view.h" -class SkBitmap; typedef unsigned int SkColor; +namespace gfx { +class ImageSkia; +} + namespace views { class Label; class BoxLayout; @@ -96,7 +99,7 @@ class HoverHighlightView : public ActionableView { // Convenience function for adding an icon and a label. This also sets the // accessible name. - void AddIconAndLabel(const SkBitmap& image, + void AddIconAndLabel(const gfx::ImageSkia& image, const string16& text, gfx::Font::FontStyle style); @@ -266,13 +269,14 @@ class TrayNotificationView : public views::View, void InitView(views::View* contents); // Sets/updates the icon image. - void SetIconImage(const SkBitmap& image); + void SetIconImage(const gfx::ImageSkia& image); // Replaces the contents view. void UpdateView(views::View* new_contents); // Replaces the contents view and updates the icon image. - void UpdateViewAndImage(views::View* new_contents, const SkBitmap& image); + void UpdateViewAndImage(views::View* new_contents, + const gfx::ImageSkia& image); // Overridden from ButtonListener. virtual void ButtonPressed(views::Button* sender, diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index 07fb61e..d894335 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -53,10 +53,10 @@ class RoundedImageView : public views::View { virtual ~RoundedImageView() { } - // Set the bitmap that should be displayed from a pointer. The pointer - // contents is copied in the receiver's bitmap. - void SetImage(const SkBitmap& bm, const gfx::Size& size) { - image_ = bm; + // Set the image that should be displayed from a pointer. The pointer + // contents is copied in the receiver's image. + void SetImage(const gfx::ImageSkia& img, const gfx::Size& size) { + image_ = img; image_size_ = size; // Try to get the best image quality for the avatar. @@ -99,8 +99,8 @@ class RoundedImageView : public views::View { } private: - SkBitmap image_; - SkBitmap resized_; + gfx::ImageSkia image_; + gfx::ImageSkia resized_; gfx::Size image_size_; int corner_radius_; diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc index 49cca635..3132e7f 100644 --- a/ash/wm/custom_frame_view_ash.cc +++ b/ash/wm/custom_frame_view_ash.cc @@ -121,13 +121,13 @@ void CustomFrameViewAsh::Layout() { void CustomFrameViewAsh::OnPaint(gfx::Canvas* canvas) { bool paint_as_active = ShouldPaintAsActive(); - int theme_bitmap_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : + int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; frame_painter_->PaintHeader( this, canvas, paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE, - theme_bitmap_id, + theme_image_id, NULL); frame_painter_->PaintTitleBar(this, canvas, GetTitleFont()); frame_painter_->PaintHeaderContentSeparator(this, canvas); diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index f35db43..076af87 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -76,7 +76,7 @@ const int kButtonOverlap = 1; // we need to copy the theme image for the window header from a few pixels // inset to preserve alignment with the NTP image, or else we'll break a bunch // of existing themes. We do something similar on OS X for the same reason. -const int kThemeFrameBitmapOffsetX = 5; +const int kThemeFrameImageOffsetX = 5; // Duration of crossfade animation for activating and deactivating frame. const int kActivationCrossfadeDurationMs = 200; // Alpha/opacity value for fully-opaque headers. @@ -87,14 +87,14 @@ const int kFullyOpaque = 255; void TileRoundRect(gfx::Canvas* canvas, int x, int y, int w, int h, SkPaint* paint, - const SkBitmap& bitmap, + const gfx::ImageSkia& image, int corner_radius, - int bitmap_offset_x) { + int image_offset_x) { // To get the shader to sample the image |inset_y| pixels in but tile across // the whole image, we adjust the target rectangle for the shader to the right // and translate the canvas left to compensate. SkRect rect; - rect.iset(x + bitmap_offset_x, y, x + bitmap_offset_x + w, y + h); + rect.iset(x + image_offset_x, y, x + image_offset_x + w, y + h); const SkScalar kRadius = SkIntToScalar(corner_radius); SkScalar radii[8] = { kRadius, kRadius, // top-left @@ -104,7 +104,7 @@ void TileRoundRect(gfx::Canvas* canvas, SkPath path; path.addRoundRect(rect, radii, SkPath::kCW_Direction); - SkShader* shader = SkShader::CreateBitmapShader(bitmap, + SkShader* shader = SkShader::CreateBitmapShader(image, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); paint->setShader(shader); @@ -113,9 +113,9 @@ void TileRoundRect(gfx::Canvas* canvas, shader->unref(); // Adjust canvas to compensate for image sampling offset, draw, then adjust // back. This is cheaper than pushing/popping the entire canvas state. - canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0); + canvas->sk_canvas()->translate(SkIntToScalar(-image_offset_x), 0); canvas->DrawPath(path, *paint); - canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0); + canvas->sk_canvas()->translate(SkIntToScalar(image_offset_x), 0); } // Returns true if |window| is a visible, normal window. @@ -189,17 +189,17 @@ void FramePainter::Init(views::Widget* frame, // Window frame image parts. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); button_separator_ = - rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToImageSkia(); top_left_corner_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToImageSkia(); top_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); top_right_corner_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); header_left_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); header_right_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); window_ = frame->GetNativeWindow(); // Ensure we get resize cursors for a few pixels outside our bounds. @@ -306,7 +306,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, gfx::Canvas* canvas, HeaderMode header_mode, int theme_frame_id, - const SkBitmap* theme_frame_overlay) { + const gfx::ImageSkia* theme_frame_overlay) { if (previous_theme_frame_id_ != 0 && previous_theme_frame_id_ != theme_frame_id) { crossfade_animation_.reset(new ui::SlideAnimation(this)); @@ -319,15 +319,16 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, int opacity = GetHeaderOpacity(header_mode, theme_frame_id, theme_frame_overlay); ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); - SkBitmap* theme_frame = theme_provider->GetBitmapNamed(theme_frame_id); + gfx::ImageSkia* theme_frame = theme_provider->GetImageSkiaNamed( + theme_frame_id); header_frame_bounds_ = gfx::Rect(0, 0, view->width(), theme_frame->height()); const int kCornerRadius = 2; SkPaint paint; if (crossfade_animation_.get() && crossfade_animation_->is_animating()) { - SkBitmap* crossfade_theme_frame = - theme_provider->GetBitmapNamed(crossfade_theme_frame_id_); + gfx::ImageSkia* crossfade_theme_frame = + theme_provider->GetImageSkiaNamed(crossfade_theme_frame_id_); if (crossfade_theme_frame) { double current_value = crossfade_animation_->GetCurrentValue(); int old_alpha = (1 - current_value) * crossfade_opacity_; @@ -341,7 +342,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, &paint, *crossfade_theme_frame, kCornerRadius, - kThemeFrameBitmapOffsetX); + kThemeFrameImageOffsetX); paint.setAlpha(new_alpha); } else { @@ -358,7 +359,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, &paint, *theme_frame, kCornerRadius, - kThemeFrameBitmapOffsetX); + kThemeFrameImageOffsetX); previous_theme_frame_id_ = theme_frame_id; previous_opacity_ = opacity; @@ -564,16 +565,16 @@ void FramePainter::AnimationProgressed(const ui::Animation* animation) { // FramePainter, private: void FramePainter::SetButtonImages(views::ImageButton* button, - int normal_bitmap_id, - int hot_bitmap_id, - int pushed_bitmap_id) { + int normal_image_id, + int hot_image_id, + int pushed_image_id) { ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); button->SetImage(views::CustomButton::BS_NORMAL, - theme_provider->GetImageSkiaNamed(normal_bitmap_id)); + theme_provider->GetImageSkiaNamed(normal_image_id)); button->SetImage(views::CustomButton::BS_HOT, - theme_provider->GetImageSkiaNamed(hot_bitmap_id)); + theme_provider->GetImageSkiaNamed(hot_image_id)); button->SetImage(views::CustomButton::BS_PUSHED, - theme_provider->GetImageSkiaNamed(pushed_bitmap_id)); + theme_provider->GetImageSkiaNamed(pushed_image_id)); } int FramePainter::GetTitleOffsetX() const { @@ -584,7 +585,7 @@ int FramePainter::GetTitleOffsetX() const { int FramePainter::GetHeaderOpacity(HeaderMode header_mode, int theme_frame_id, - const SkBitmap* theme_frame_overlay) { + const gfx::ImageSkia* theme_frame_overlay) { // User-provided themes are painted fully opaque. if (frame_->GetThemeProvider()->HasCustomImage(theme_frame_id)) return kFullyOpaque; diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h index 883d671..2d21203 100644 --- a/ash/wm/frame_painter.h +++ b/ash/wm/frame_painter.h @@ -13,17 +13,17 @@ #include "base/compiler_specific.h" // OVERRIDE #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" +#include "ui/aura/window_observer.h" #include "ui/base/animation/animation_delegate.h" #include "ui/gfx/rect.h" -#include "ui/aura/window_observer.h" -class SkBitmap; namespace aura { class Window; } namespace gfx { class Canvas; class Font; +class ImageSkia; class Point; class Size; } @@ -86,7 +86,7 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, gfx::Canvas* canvas, HeaderMode header_mode, int theme_frame_id, - const SkBitmap* theme_frame_overlay); + const gfx::ImageSkia* theme_frame_overlay); // Paints the header/content separator line. Exists as a separate function // because some windows with complex headers (e.g. browsers with tab strips) @@ -124,9 +124,9 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, // Sets the images for a button base on IDs from the |frame_| theme provider. void SetButtonImages(views::ImageButton* button, - int normal_bitmap_id, - int hot_bitmap_id, - int pushed_bitmap_id); + int normal_image_id, + int hot_image_id, + int pushed_image_id); // Returns the offset between window left edge and title string. int GetTitleOffsetX() const; @@ -134,7 +134,7 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, // Returns the opacity value used to paint the header. int GetHeaderOpacity(HeaderMode header_mode, int theme_frame_id, - const SkBitmap* theme_frame_overlay); + const gfx::ImageSkia* theme_frame_overlay); // Returns true if there is exactly one visible, normal-type window using // a header painted by this class, in which case we should paint a transparent @@ -156,18 +156,18 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, aura::Window* window_; // Window frame header/caption parts. - const SkBitmap* button_separator_; - const SkBitmap* top_left_corner_; - const SkBitmap* top_edge_; - const SkBitmap* top_right_corner_; - const SkBitmap* header_left_edge_; - const SkBitmap* header_right_edge_; - - // Bitmap id and opacity last used for painting header. + const gfx::ImageSkia* button_separator_; + const gfx::ImageSkia* top_left_corner_; + const gfx::ImageSkia* top_edge_; + const gfx::ImageSkia* top_right_corner_; + const gfx::ImageSkia* header_left_edge_; + const gfx::ImageSkia* header_right_edge_; + + // Image id and opacity last used for painting header. int previous_theme_frame_id_; int previous_opacity_; - // Bitmap id and opacity we are crossfading from. + // Image id and opacity we are crossfading from. int crossfade_theme_frame_id_; int crossfade_opacity_; diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc index 234d11f..57ae977 100644 --- a/ash/wm/frame_painter_unittest.cc +++ b/ash/wm/frame_painter_unittest.cc @@ -164,7 +164,7 @@ TEST_F(FramePainterTest, GetHeaderOpacity) { NULL)); // Custom overlay image is drawn completely opaque. - SkBitmap custom_overlay; + gfx::ImageSkia custom_overlay; EXPECT_EQ(255, p1.GetHeaderOpacity(FramePainter::ACTIVE, IDR_AURA_WINDOW_HEADER_BASE_ACTIVE, diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc index f5a1c46..c4fec2a 100644 --- a/ash/wm/image_grid.cc +++ b/ash/wm/image_grid.cc @@ -6,12 +6,12 @@ #include <algorithm> +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkXfermode.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image.h" #include "ui/gfx/rect.h" #include "ui/gfx/transform.h" -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkXfermode.h" using std::max; using std::min; @@ -227,7 +227,7 @@ void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { if (!clip_rect_.IsEmpty()) canvas->ClipRect(clip_rect_); - canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); + canvas->DrawBitmapInt(*(image_->ToImageSkia()), 0, 0); } void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( @@ -238,7 +238,7 @@ void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( // static gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { return image ? - gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) : + gfx::Size(image->ToImageSkia()->width(), image->ToImageSkia()->height()) : gfx::Size(); } diff --git a/ash/wm/panel_frame_view.cc b/ash/wm/panel_frame_view.cc index f0cdba9..e0d93e2 100644 --- a/ash/wm/panel_frame_view.cc +++ b/ash/wm/panel_frame_view.cc @@ -63,13 +63,13 @@ int PanelFrameView::NonClientHitTest(const gfx::Point& point) { void PanelFrameView::OnPaint(gfx::Canvas* canvas) { bool paint_as_active = ShouldPaintAsActive(); - int theme_bitmap_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : + int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; frame_painter_->PaintHeader( this, canvas, paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE, - theme_bitmap_id, + theme_image_id, NULL); frame_painter_->PaintHeaderContentSeparator(this, canvas); } diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index 0d83ec3..ec986ed 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -4,10 +4,10 @@ #include "ash/wm/workspace/frame_maximize_button.h" +#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/wm/property_util.h" -#include "ash/launcher/launcher.h" #include "ash/wm/workspace/phantom_window_controller.h" #include "ash/wm/workspace/snap_sizer.h" #include "grit/ash_strings.h" @@ -217,7 +217,7 @@ gfx::ImageSkia FrameMaximizeButton::GetImageToPaint() { NOTREACHED(); } } - return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToSkBitmap(); + return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); } // Hot and pressed states handled by regular ImageButton. return ImageButton::GetImageToPaint(); diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index 053a646..9219027 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -67,7 +67,7 @@ class MultiWindowResizeController::ResizeView : public views::View { int image_id = direction == TOP_BOTTOM ? IDR_AURA_MULTI_WINDOW_RESIZE_H : IDR_AURA_MULTI_WINDOW_RESIZE_V; - image_ = rb.GetImageNamed(image_id).ToSkBitmap(); + image_ = rb.GetImageNamed(image_id).ToImageSkia(); } // views::View overrides: @@ -105,7 +105,7 @@ class MultiWindowResizeController::ResizeView : public views::View { private: MultiWindowResizeController* controller_; const Direction direction_; - const SkBitmap* image_; + const gfx::ImageSkia* image_; DISALLOW_COPY_AND_ASSIGN(ResizeView); }; |