Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: ui/app_list/app_list_item_view.cc

Issue 10453035: Clean up SkBitmapOperations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/launcher/launcher_button.cc ('k') | ui/gfx/shadow_value.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/app_list_item_view.cc
diff --git a/ui/app_list/app_list_item_view.cc b/ui/app_list/app_list_item_view.cc
index f3e6803759947bf4fe7fc70cffd05c5fba257a7f..f2f0906ec1190275e095fe631012d73f96733e8b 100644
--- a/ui/app_list/app_list_item_view.cc
+++ b/ui/app_list/app_list_item_view.cc
@@ -11,6 +11,7 @@
#include "base/synchronization/cancellation_flag.h"
#include "base/threading/worker_pool.h"
#include "base/utf_string_conversions.h"
+#include "skia/ext/image_operations.h"
#include "ui/app_list/app_list_item_model.h"
#include "ui/app_list/apps_grid_view.h"
#include "ui/app_list/drop_shadow_label.h"
@@ -126,39 +127,27 @@ class AppListItemView::IconOperation
static const int kShadowPadding = 15;
void ResizeAndGenerateShadow() {
- // If you change shadow radius and shadow offset, please also update
- // kShadowPaddingAbove.
- const SkColor kShadowColor[] = {
- SkColorSetARGB(0xCC, 0, 0, 0),
- SkColorSetARGB(0x33, 0, 0, 0),
- SkColorSetARGB(0x4C, 0, 0, 0),
- };
- const gfx::Point kShadowOffset[] = {
- gfx::Point(0, 0),
- gfx::Point(0, 4),
- gfx::Point(0, 5),
- };
- const SkScalar kShadowRadius[] = {
- SkIntToScalar(2),
- SkIntToScalar(4),
- SkIntToScalar(10),
- };
-
if (cancel_flag_.IsSet())
return;
- if (size_ != gfx::Size(bitmap_.width(), bitmap_.height()))
- bitmap_ = SkBitmapOperations::CreateResizedBitmap(bitmap_, size_);
+ if (size_ != gfx::Size(bitmap_.width(), bitmap_.height())) {
+ bitmap_ = skia::ImageOperations::Resize(bitmap_,
+ skia::ImageOperations::RESIZE_BEST, size_.width(), size_.height());
+ }
if (cancel_flag_.IsSet())
return;
+ // If you change shadow radius and shadow offset, please also update
+ // kShadowPaddingAbove.
+ const gfx::ShadowValue kShadows[] = {
+ gfx::ShadowValue(gfx::Point(0, 0), 2, SkColorSetARGB(0xCC, 0, 0, 0)),
+ gfx::ShadowValue(gfx::Point(0, 4), 4, SkColorSetARGB(0x33, 0, 0, 0)),
+ gfx::ShadowValue(gfx::Point(0, 5), 10, SkColorSetARGB(0x4C, 0, 0, 0)),
+ };
+
bitmap_ = SkBitmapOperations::CreateDropShadow(
- bitmap_,
- arraysize(kShadowColor),
- kShadowColor,
- kShadowOffset,
- kShadowRadius);
+ bitmap_, gfx::ShadowValues(kShadows, kShadows + arraysize(kShadows)));
}
void Cancel() {
« no previous file with comments | « ash/launcher/launcher_button.cc ('k') | ui/gfx/shadow_value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698