| 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 circle for folder shadow. |
| 92 gfx::Point center = gfx::Point(size().width() / 2, size().height() / 2); | 92 gfx::PointF shadow_center(size().width() / 2, size().height() / 2); |
| 93 SkPaint paint; | 93 SkPaint paint; |
| 94 paint.setStyle(SkPaint::kFill_Style); | 94 paint.setStyle(SkPaint::kFill_Style); |
| 95 paint.setAntiAlias(true); | 95 paint.setAntiAlias(true); |
| 96 paint.setColor(kFolderShadowColor); |
| 97 canvas->sk_canvas()->drawCircle( |
| 98 shadow_center.x(), shadow_center.y(), kFolderShadowRadius, paint); |
| 99 // Draw circle for folder bubble. |
| 100 gfx::PointF bubble_center(shadow_center); |
| 101 bubble_center.Offset(0, -kFolderShadowOffsetY); |
| 96 paint.setColor(kFolderBubbleColor); | 102 paint.setColor(kFolderBubbleColor); |
| 97 canvas->DrawCircle(center, size().width() / 2, paint); | 103 canvas->sk_canvas()->drawCircle( |
| 104 bubble_center.x(), bubble_center.y(), kFolderBubbleRadius, paint); |
| 98 | 105 |
| 99 if (icons_.size() == 0) | 106 if (icons_.size() == 0) |
| 100 return; | 107 return; |
| 101 | 108 |
| 102 // Draw top items' icons. | 109 // Draw top items' icons. |
| 103 const gfx::Size item_icon_size(ItemIconSize()); | 110 const gfx::Size item_icon_size(ItemIconSize()); |
| 104 std::vector<gfx::Rect> top_icon_bounds = GetTopIconsBounds(gfx::Rect(size())); | 111 std::vector<gfx::Rect> top_icon_bounds = GetTopIconsBounds(gfx::Rect(size())); |
| 105 | 112 |
| 106 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) { | 113 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) { |
| 107 DrawIcon(canvas, | 114 DrawIcon(canvas, |
| 108 icons_[i], | 115 icons_[i], |
| 109 item_icon_size, | 116 item_icon_size, |
| 110 top_icon_bounds[i].x(), | 117 top_icon_bounds[i].x(), |
| 111 top_icon_bounds[i].y()); | 118 top_icon_bounds[i].y()); |
| 112 } | 119 } |
| 113 } | 120 } |
| 114 | 121 |
| 115 } // namespace app_list | 122 } // namespace app_list |
| OLD | NEW |