Chromium Code Reviews| Index: ash/launcher/launcher_button.cc |
| diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc |
| index 7c41621bcd4cb52ffccf50226f636edbc66eef81..727c77f23c8efbbda880b97a6fdc33a33c52621c 100644 |
| --- a/ash/launcher/launcher_button.cc |
| +++ b/ash/launcher/launcher_button.cc |
| @@ -9,7 +9,6 @@ |
| #include "ash/launcher/launcher_button_host.h" |
| #include "grit/ui_resources.h" |
| -#include "skia/ext/image_operations.h" |
| #include "ui/base/accessibility/accessible_view_state.h" |
| #include "ui/base/animation/animation_delegate.h" |
| #include "ui/base/animation/throb_animation.h" |
| @@ -21,8 +20,8 @@ |
| #include "ui/compositor/scoped_layer_animation_settings.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/image/image.h" |
| +#include "ui/gfx/image/image_skia_sources.h" |
| #include "ui/gfx/shadow_value.h" |
| -#include "ui/gfx/skbitmap_operations.h" |
| #include "ui/gfx/transform_util.h" |
| #include "ui/views/controls/image_view.h" |
| @@ -235,19 +234,25 @@ LauncherButton::LauncherButton(views::ButtonListener* listener, |
| LauncherButton::~LauncherButton() { |
| } |
| -void LauncherButton::SetShadowedImage(const SkBitmap& bitmap) { |
| +void LauncherButton::SetShadowedImage(const gfx::ImageSkia& image) { |
| const gfx::ShadowValue kShadows[] = { |
| gfx::ShadowValue(gfx::Point(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), |
| gfx::ShadowValue(gfx::Point(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), |
| gfx::ShadowValue(gfx::Point(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), |
| }; |
| - SkBitmap shadowed_bitmap = SkBitmapOperations::CreateDropShadow( |
| - bitmap, gfx::ShadowValues(kShadows, kShadows + arraysize(kShadows))); |
| - icon_view_->SetImage(shadowed_bitmap); |
| + const gfx::ShadowValues shadows(kShadows, kShadows + arraysize(kShadows)); |
| + const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); |
| + gfx::Size shadow_image_size = image.size(); |
| + shadow_image_size.Enlarge(shadow_padding.width(), |
| + shadow_padding.height()); |
| + |
| + icon_view_->SetImage(gfx::ImageSkia( |
| + gfx::image_skia_sources::CreateDropShadowSource(image, shadows), |
| + shadow_image_size)); |
|
oshima
2012/07/10 23:51:06
Can you move this to gfx::ImageSkiaOperations ? (u
xiyuan
2012/07/11 17:39:13
Done. Peter made a similar proposal. :)
|
| } |
| -void LauncherButton::SetImage(const SkBitmap& image) { |
| +void LauncherButton::SetImage(const gfx::ImageSkia& image) { |
| if (image.empty()) { |
| // TODO: need an empty image. |
| icon_view_->SetImage(image); |
| @@ -275,9 +280,10 @@ void LauncherButton::SetImage(const SkBitmap& image) { |
| return; |
| } |
| - SkBitmap resized_image = skia::ImageOperations::Resize( |
| - image, skia::ImageOperations::RESIZE_BEST, width, height); |
| - SetShadowedImage(resized_image); |
| + const gfx::Size size(width, height); |
| + SetShadowedImage(gfx::ImageSkia( |
| + gfx::image_skia_sources::CreateResizeSource(image, size), |
| + size)); |
| } |
| void LauncherButton::AddState(State state) { |