diff options
-rw-r--r-- | chrome/browser/download/download_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/first_run/try_chrome_dialog_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/themes/browser_theme_pack.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/download/download_item_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc | 31 | ||||
-rw-r--r-- | chrome/browser/ui/views/page_info_bubble_view.cc | 4 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 3 | ||||
-rw-r--r-- | ui/gfx/image/image.cc | 4 | ||||
-rw-r--r-- | ui/gfx/image/image.h | 1 | ||||
-rw-r--r-- | ui/gfx/image/image_unittest.cc | 4 |
10 files changed, 28 insertions, 37 deletions
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 551bc2b..ab1bb68 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -375,7 +375,7 @@ void DragDownload(const DownloadItem* download, if (icon) { drag_utils::CreateDragImageForFile( - download->GetFileNameToReportUser(), *icon, &data); + download->GetFileNameToReportUser(), icon->ToSkBitmap(), &data); } const FilePath full_path = download->GetFullPath(); diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index 71135a7..1eda4a6 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -64,7 +64,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( ResourceBundle& rb = ResourceBundle::GetSharedInstance(); views::ImageView* icon = new views::ImageView(); - icon->SetImage(*rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32)); + icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToSkBitmap()); gfx::Size icon_size = icon->GetPreferredSize(); // An approximate window size. After Layout() we'll get better bounds. @@ -159,11 +159,11 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( // The close button is custom. views::ImageButton* close_button = new views::ImageButton(this); close_button->SetImage(views::CustomButton::BS_NORMAL, - rb.GetNativeImageNamed(IDR_CLOSE_BAR)); + rb.GetNativeImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); close_button->SetImage(views::CustomButton::BS_HOT, - rb.GetNativeImageNamed(IDR_CLOSE_BAR_H)); + rb.GetNativeImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); close_button->SetImage(views::CustomButton::BS_PUSHED, - rb.GetNativeImageNamed(IDR_CLOSE_BAR_P)); + rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); close_button->set_tag(BT_CLOSE_BUTTON); layout->AddView(close_button); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 2edf646..fac66f6 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -502,12 +502,10 @@ SkBitmap* BrowserThemePack::GetBitmapNamed(int idr_id) const { if (!image) return NULL; - const SkBitmap* bitmap = *image; - // TODO(sail): This cast should be removed. Currently we use this const_cast // to avoid changing the BrowserThemePack::GetBitmapNamed API. Once we // switch to using gfx::Image everywhere this can be removed. - return const_cast<SkBitmap*>(bitmap); + return const_cast<SkBitmap*>(image->ToSkBitmap()); } const gfx::Image* BrowserThemePack::GetImageNamed(int idr_id) const { @@ -1002,7 +1000,7 @@ void BrowserThemePack::GenerateTabBackgroundImages(ImageCache* bitmaps) const { // If they've provided a custom image, overlay it. ImageCache::const_iterator overlay_it = bitmaps->find(prs_id); if (overlay_it != bitmaps->end()) { - const SkBitmap* overlay = *(overlay_it->second); + const SkBitmap* overlay = overlay_it->second->ToSkBitmap(); SkCanvas canvas(*bg_tab); for (int x = 0; x < bg_tab->width(); x += overlay->width()) canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL); diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 4c20aa9..7e86498 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc @@ -837,7 +837,7 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { if (IsShowingWarningDialog()) icon = warning_icon_; else if (image) - icon = *image; + icon = image->ToSkBitmap(); // We count on the fact that the icon manager will cache the icons and if one // is available, it will be cached here. We *don't* want to request the icon diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc index 9316a89..2491ea0 100644 --- a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc +++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc @@ -55,16 +55,16 @@ class AppNonClientFrameViewAura::ControlView restore_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ? IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE : IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; - control_base_ = *rb.GetImageNamed(control_base_resource_id); + control_base_ = rb.GetImageNamed(control_base_resource_id).ToSkBitmap(); separator_ = - *rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR).ToSkBitmap(); - shadow_ = *rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToSkBitmap(); + rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR).ToSkBitmap(); + shadow_ = rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToSkBitmap(); AddChildView(close_button_); AddChildView(restore_button_); @@ -72,9 +72,8 @@ class AppNonClientFrameViewAura::ControlView virtual void Layout() OVERRIDE { restore_button_->SetPosition(gfx::Point(kShadowStart, 0)); - close_button_->SetPosition( - gfx::Point(kShadowStart + restore_button_->width() + separator_.width(), - 0)); + close_button_->SetPosition(gfx::Point(kShadowStart + + restore_button_->width() + separator_->width(), 0)); } virtual void ViewHierarchyChanged(bool is_add, View* parent, @@ -95,12 +94,12 @@ class AppNonClientFrameViewAura::ControlView } virtual gfx::Size GetPreferredSize() OVERRIDE { - return gfx::Size(shadow_.width() + kShadowWidthStretch, - shadow_.height() + kShadowHeightStretch); + return gfx::Size(shadow_->width() + kShadowWidthStretch, + shadow_->height() + kShadowHeightStretch); } virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { - canvas->TileImageInt(control_base_, + canvas->TileImageInt(*control_base_, restore_button_->x(), restore_button_->y(), restore_button_->width() + close_button_->width(), @@ -108,9 +107,9 @@ class AppNonClientFrameViewAura::ControlView views::View::OnPaint(canvas); - canvas->DrawBitmapInt( - separator_, restore_button_->x() + restore_button_->width(), 0); - canvas->DrawBitmapInt(shadow_, 0, kShadowHeightStretch); + canvas->DrawBitmapInt(*separator_, + restore_button_->x() + restore_button_->width(), 0); + canvas->DrawBitmapInt(*shadow_, 0, kShadowHeightStretch); } void ButtonPressed( @@ -141,9 +140,9 @@ class AppNonClientFrameViewAura::ControlView AppNonClientFrameViewAura* owner_; views::ImageButton* close_button_; views::ImageButton* restore_button_; - SkBitmap control_base_; - SkBitmap separator_; - SkBitmap shadow_; + const SkBitmap* control_base_; + const SkBitmap* separator_; + const SkBitmap* shadow_; DISALLOW_COPY_AND_ASSIGN(ControlView); }; diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index ca717432..c41e106 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -196,7 +196,7 @@ void PageInfoBubbleView::LayoutSections() { if (count == 1 && info.type == PageInfoModel::SECTION_INFO_INTERNAL_PAGE) only_internal_section = true; layout->StartRow(0, 0); - const SkBitmap* icon = *model_.GetIconImage(info.icon_id); + const SkBitmap* icon = model_.GetIconImage(info.icon_id)->ToSkBitmap(); Section* section = new Section(this, info, icon, cert_id_ > 0); if (info.type == PageInfoModel::SECTION_INFO_FIRST_VISIT) { // This section is animated into view, so we need to set the height of it @@ -244,7 +244,7 @@ gfx::Size PageInfoBubbleView::GetPreferredSize() { int count = model_.GetSectionCount(); for (int i = 0; i < count; ++i) { PageInfoModel::SectionInfo info = model_.GetSectionInfo(i); - const SkBitmap* icon = *model_.GetIconImage(info.icon_id); + const SkBitmap* icon = model_.GetIconImage(info.icon_id)->ToSkBitmap(); Section section(this, info, icon, cert_id_ > 0); size.Enlarge(0, section.GetHeightForWidth(size.width())); } diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 77e5b2a..5f44fa2 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -212,8 +212,7 @@ std::string ResourceBundle::ReloadLocaleResources( } SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { - const SkBitmap* bitmap = - static_cast<const SkBitmap*>(GetImageNamed(resource_id)); + const SkBitmap* bitmap = GetImageNamed(resource_id).ToSkBitmap(); return const_cast<SkBitmap*>(bitmap); } diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc index bf21259..717ea94 100644 --- a/ui/gfx/image/image.cc +++ b/ui/gfx/image/image.cc @@ -326,10 +326,6 @@ NSImage* Image::CopyNSImage() const { } #endif -Image::operator const SkBitmap*() const { - return ToSkBitmap(); -} - Image::operator const SkBitmap&() const { return *ToSkBitmap(); } diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h index 64fccf3..bc5d20a 100644 --- a/ui/gfx/image/image.h +++ b/ui/gfx/image/image.h @@ -119,7 +119,6 @@ class UI_EXPORT Image { // DEPRECATED ---------------------------------------------------------------- // Conversion handlers. These wrap the ToType() variants. - operator const SkBitmap*() const; operator const SkBitmap&() const; #if defined(TOOLKIT_USES_GTK) operator GdkPixbuf*() const; diff --git a/ui/gfx/image/image_unittest.cc b/ui/gfx/image/image_unittest.cc index 5309ff3..a779f8c 100644 --- a/ui/gfx/image/image_unittest.cc +++ b/ui/gfx/image/image_unittest.cc @@ -209,11 +209,11 @@ TEST_F(ImageTest, SwapRepresentations) { const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; gfx::Image image1(gt::CreateBitmap(25, 25)); - const SkBitmap* bitmap1 = image1; + const SkBitmap* bitmap1 = image1.ToSkBitmap(); EXPECT_EQ(1U, image1.RepresentationCount()); gfx::Image image2(gt::CreatePlatformImage()); - const SkBitmap* bitmap2 = image2; + const SkBitmap* bitmap2 = image2.ToSkBitmap(); gt::PlatformImage platform_image = gt::ToPlatformType(image2); EXPECT_EQ(kRepCount, image2.RepresentationCount()); |