OLD | NEW |
---|---|
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_source.h" | 5 #include "ui/app_list/folder_image_source.h" |
6 | 6 |
7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 resized.width(), | 81 resized.width(), |
82 resized.height(), | 82 resized.height(), |
83 x, | 83 x, |
84 y, | 84 y, |
85 resized.width(), | 85 resized.width(), |
86 resized.height(), | 86 resized.height(), |
87 true); | 87 true); |
88 } | 88 } |
89 | 89 |
90 void FolderImageSource::Draw(gfx::Canvas* canvas) { | 90 void FolderImageSource::Draw(gfx::Canvas* canvas) { |
91 // Draw folder circle. | 91 // Draw folder circles. |
92 gfx::Point center = gfx::Point(size().width() / 2, size().height() / 2); | 92 // Shadow. |
calamity
2014/10/28 06:30:17
// Draw circle for folder shadow.
Matt Giuca
2014/10/28 07:55:13
Done.
| |
93 gfx::PointF center(size().width() / 2, size().height() / 2); | |
93 SkPaint paint; | 94 SkPaint paint; |
94 paint.setStyle(SkPaint::kFill_Style); | 95 paint.setStyle(SkPaint::kFill_Style); |
95 paint.setAntiAlias(true); | 96 paint.setAntiAlias(true); |
97 paint.setColor(kFolderShadowColor); | |
98 canvas->sk_canvas()->drawCircle( | |
99 center.x(), center.y(), kFolderShadowRadius, paint); | |
100 // Bubble. | |
calamity
2014/10/28 06:30:17
// Draw circle for folder bubble.
(Is bubble the
Matt Giuca
2014/10/28 07:55:13
Well it was used before (kFolderBubbleColor) so I
| |
101 center = gfx::PointF(size().width() / 2, | |
102 size().height() / 2 - kFolderShadowOffsetY); | |
calamity
2014/10/28 06:30:17
gfx::PointF bubble_center? Then use center.x()/y()
Matt Giuca
2014/10/28 07:55:13
Done.
| |
96 paint.setColor(kFolderBubbleColor); | 103 paint.setColor(kFolderBubbleColor); |
97 canvas->DrawCircle(center, size().width() / 2, paint); | 104 canvas->sk_canvas()->drawCircle( |
105 center.x(), center.y(), kFolderBubbleRadius, paint); | |
98 | 106 |
99 if (icons_.size() == 0) | 107 if (icons_.size() == 0) |
100 return; | 108 return; |
101 | 109 |
102 // Draw top items' icons. | 110 // Draw top items' icons. |
103 const gfx::Size item_icon_size(ItemIconSize()); | 111 const gfx::Size item_icon_size(ItemIconSize()); |
104 std::vector<gfx::Rect> top_icon_bounds = GetTopIconsBounds(gfx::Rect(size())); | 112 std::vector<gfx::Rect> top_icon_bounds = GetTopIconsBounds(gfx::Rect(size())); |
105 | 113 |
106 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) { | 114 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) { |
107 DrawIcon(canvas, | 115 DrawIcon(canvas, |
108 icons_[i], | 116 icons_[i], |
109 item_icon_size, | 117 item_icon_size, |
110 top_icon_bounds[i].x(), | 118 top_icon_bounds[i].x(), |
111 top_icon_bounds[i].y()); | 119 top_icon_bounds[i].y()); |
112 } | 120 } |
113 } | 121 } |
114 | 122 |
115 } // namespace app_list | 123 } // namespace app_list |
OLD | NEW |