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

Side by Side Diff: ui/app_list/folder_image.cc

Issue 1154323002: Use app list item shadow for app list folders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_arrow_keys_crash
Patch Set: fix mac compile Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/app_list/demo/app_list_demo_views.cc ('k') | ui/app_list/folder_image_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/folder_image.h" 5 #include "ui/app_list/folder_image.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ui/app_list/app_list_constants.h" 9 #include "ui/app_list/app_list_constants.h"
10 #include "ui/app_list/app_list_item.h" 10 #include "ui/app_list/app_list_item.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (icon.isNull()) 70 if (icon.isNull())
71 return; 71 return;
72 72
73 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( 73 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(
74 icon, skia::ImageOperations::RESIZE_BEST, icon_size)); 74 icon, skia::ImageOperations::RESIZE_BEST, icon_size));
75 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(), x, y, 75 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(), x, y,
76 resized.width(), resized.height(), true); 76 resized.width(), resized.height(), true);
77 } 77 }
78 78
79 void FolderImageSource::Draw(gfx::Canvas* canvas) { 79 void FolderImageSource::Draw(gfx::Canvas* canvas) {
80 // Draw circle for folder shadow.
81 gfx::PointF shadow_center(size().width() / 2, size().height() / 2);
82 SkPaint paint; 80 SkPaint paint;
81 // Draw circle for folder bubble.
82 gfx::PointF bubble_center(size().width() / 2, size().height() / 2);
83 bubble_center.Offset(0, -kFolderBubbleOffsetY);
83 paint.setStyle(SkPaint::kFill_Style); 84 paint.setStyle(SkPaint::kFill_Style);
84 paint.setAntiAlias(true); 85 paint.setAntiAlias(true);
85 paint.setColor(kFolderShadowColor);
86 canvas->sk_canvas()->drawCircle(shadow_center.x(), shadow_center.y(),
87 kFolderShadowRadius, paint);
88 // Draw circle for folder bubble.
89 gfx::PointF bubble_center(shadow_center);
90 bubble_center.Offset(0, -kFolderShadowOffsetY);
91 paint.setColor(kFolderBubbleColor); 86 paint.setColor(kFolderBubbleColor);
92 canvas->sk_canvas()->drawCircle(bubble_center.x(), bubble_center.y(), 87 canvas->sk_canvas()->drawCircle(bubble_center.x(), bubble_center.y(),
93 kFolderBubbleRadius, paint); 88 kFolderBubbleRadius, paint);
94 89
95 if (icons_.size() == 0) 90 if (icons_.size() == 0)
96 return; 91 return;
97 92
98 // Draw top items' icons. 93 // Draw top items' icons.
99 const gfx::Size item_icon_size(ItemIconSize()); 94 const gfx::Size item_icon_size(ItemIconSize());
100 std::vector<gfx::Rect> top_icon_bounds = 95 std::vector<gfx::Rect> top_icon_bounds =
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 top_icons.push_back(item->icon()); 218 top_icons.push_back(item->icon());
224 219
225 const gfx::Size icon_size = gfx::Size(kGridIconDimension, kGridIconDimension); 220 const gfx::Size icon_size = gfx::Size(kGridIconDimension, kGridIconDimension);
226 icon_ = 221 icon_ =
227 gfx::ImageSkia(new FolderImageSource(top_icons, icon_size), icon_size); 222 gfx::ImageSkia(new FolderImageSource(top_icons, icon_size), icon_size);
228 223
229 FOR_EACH_OBSERVER(FolderImageObserver, observers_, OnFolderImageUpdated()); 224 FOR_EACH_OBSERVER(FolderImageObserver, observers_, OnFolderImageUpdated());
230 } 225 }
231 226
232 } // namespace app_list 227 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/demo/app_list_demo_views.cc ('k') | ui/app_list/folder_image_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698