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

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

Issue 2716213002: ui: Fix cc/paint skia type mismatches (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | ui/app_list/views/app_list_item_view.cc » ('j') | ui/gfx/canvas.h » ('J')
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 "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (icon.isNull()) 72 if (icon.isNull())
73 return; 73 return;
74 74
75 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( 75 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(
76 icon, skia::ImageOperations::RESIZE_BEST, icon_size)); 76 icon, skia::ImageOperations::RESIZE_BEST, icon_size));
77 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(), x, y, 77 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(), x, y,
78 resized.width(), resized.height(), true); 78 resized.width(), resized.height(), true);
79 } 79 }
80 80
81 void FolderImageSource::Draw(gfx::Canvas* canvas) { 81 void FolderImageSource::Draw(gfx::Canvas* canvas) {
82 SkPaint paint; 82 cc::PaintFlags flags;
83 // Draw circle for folder bubble. 83 // Draw circle for folder bubble.
84 gfx::PointF bubble_center(size().width() / 2, size().height() / 2); 84 gfx::PointF bubble_center(size().width() / 2, size().height() / 2);
85 bubble_center.Offset(0, -kFolderBubbleOffsetY); 85 bubble_center.Offset(0, -kFolderBubbleOffsetY);
86 paint.setStyle(SkPaint::kFill_Style); 86 flags.setStyle(cc::PaintFlags::kFill_Style);
87 paint.setAntiAlias(true); 87 flags.setAntiAlias(true);
88 paint.setColor(kFolderBubbleColor); 88 flags.setColor(kFolderBubbleColor);
89 canvas->sk_canvas()->drawCircle(bubble_center.x(), bubble_center.y(), 89 canvas->sk_canvas()->drawCircle(bubble_center.x(), bubble_center.y(),
90 kFolderBubbleRadius, paint); 90 kFolderBubbleRadius, flags);
91 91
92 if (icons_.size() == 0) 92 if (icons_.size() == 0)
93 return; 93 return;
94 94
95 // Draw top items' icons. 95 // Draw top items' icons.
96 const gfx::Size item_icon_size(ItemIconSize()); 96 const gfx::Size item_icon_size(ItemIconSize());
97 std::vector<gfx::Rect> top_icon_bounds = 97 std::vector<gfx::Rect> top_icon_bounds =
98 FolderImage::GetTopIconsBounds(gfx::Rect(size())); 98 FolderImage::GetTopIconsBounds(gfx::Rect(size()));
99 99
100 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) { 100 for (size_t i = 0; i < kNumFolderTopItems && i < icons_.size(); ++i) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 const gfx::Size icon_size = gfx::Size(kGridIconDimension, kGridIconDimension); 222 const gfx::Size icon_size = gfx::Size(kGridIconDimension, kGridIconDimension);
223 icon_ = 223 icon_ =
224 gfx::ImageSkia(new FolderImageSource(top_icons, icon_size), icon_size); 224 gfx::ImageSkia(new FolderImageSource(top_icons, icon_size), icon_size);
225 225
226 for (auto& observer : observers_) 226 for (auto& observer : observers_)
227 observer.OnFolderImageUpdated(); 227 observer.OnFolderImageUpdated();
228 } 228 }
229 229
230 } // namespace app_list 230 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/app_list_item_view.cc » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698