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

Side by Side Diff: ash/common/shelf/app_list_button.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Re-add ios changes Created 3 years, 11 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
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 "ash/common/shelf/app_list_button.h" 5 #include "ash/common/shelf/app_list_button.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/shelf/ink_drop_button_listener.h" 9 #include "ash/common/shelf/ink_drop_button_listener.h"
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 PaintAppListButton(canvas, foreground_image); 156 PaintAppListButton(canvas, foreground_image);
157 } 157 }
158 158
159 views::Painter::PaintFocusPainter(this, canvas, focus_painter()); 159 views::Painter::PaintFocusPainter(this, canvas, focus_painter());
160 } 160 }
161 161
162 void AppListButton::PaintMd(gfx::Canvas* canvas) { 162 void AppListButton::PaintMd(gfx::Canvas* canvas) {
163 gfx::PointF circle_center(GetCenterPoint()); 163 gfx::PointF circle_center(GetCenterPoint());
164 164
165 // Paint the circular background. 165 // Paint the circular background.
166 SkPaint bg_paint; 166 cc::PaintFlags bg_paint;
167 bg_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); 167 bg_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_));
168 bg_paint.setFlags(SkPaint::kAntiAlias_Flag); 168 bg_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag);
169 bg_paint.setStyle(SkPaint::kFill_Style); 169 bg_paint.setStyle(cc::PaintFlags::kFill_Style);
170 canvas->DrawCircle(circle_center, kAppListButtonRadius, bg_paint); 170 canvas->DrawCircle(circle_center, kAppListButtonRadius, bg_paint);
171 171
172 // Paint a white ring as the foreground. The ceil/dsf math assures that the 172 // Paint a white ring as the foreground. The ceil/dsf math assures that the
173 // ring draws sharply and is centered at all scale factors. 173 // ring draws sharply and is centered at all scale factors.
174 const float kRingOuterRadiusDp = 7.f; 174 const float kRingOuterRadiusDp = 7.f;
175 const float kRingThicknessDp = 1.5f; 175 const float kRingThicknessDp = 1.5f;
176 const float dsf = canvas->UndoDeviceScaleFactor(); 176 const float dsf = canvas->UndoDeviceScaleFactor();
177 circle_center.Scale(dsf); 177 circle_center.Scale(dsf);
178 178
179 SkPaint fg_paint; 179 cc::PaintFlags fg_paint;
180 fg_paint.setFlags(SkPaint::kAntiAlias_Flag); 180 fg_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag);
181 fg_paint.setStyle(SkPaint::kStroke_Style); 181 fg_paint.setStyle(cc::PaintFlags::kStroke_Style);
182 fg_paint.setColor(kShelfIconColor); 182 fg_paint.setColor(kShelfIconColor);
183 const float thickness = std::ceil(kRingThicknessDp * dsf); 183 const float thickness = std::ceil(kRingThicknessDp * dsf);
184 const float radius = std::ceil(kRingOuterRadiusDp * dsf) - thickness / 2; 184 const float radius = std::ceil(kRingOuterRadiusDp * dsf) - thickness / 2;
185 fg_paint.setStrokeWidth(thickness); 185 fg_paint.setStrokeWidth(thickness);
186 // Make sure the center of the circle lands on pixel centers. 186 // Make sure the center of the circle lands on pixel centers.
187 canvas->DrawCircle(circle_center, radius, fg_paint); 187 canvas->DrawCircle(circle_center, radius, fg_paint);
188 } 188 }
189 189
190 void AppListButton::PaintAppListButton(gfx::Canvas* canvas, 190 void AppListButton::PaintAppListButton(gfx::Canvas* canvas,
191 const gfx::ImageSkia& foreground_image) { 191 const gfx::ImageSkia& foreground_image) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return gfx::Point(x_mid, x_mid); 301 return gfx::Point(x_mid, x_mid);
302 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { 302 } else if (alignment == SHELF_ALIGNMENT_RIGHT) {
303 return gfx::Point(y_mid, y_mid); 303 return gfx::Point(y_mid, y_mid);
304 } else { 304 } else {
305 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); 305 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT);
306 return gfx::Point(width() - y_mid, y_mid); 306 return gfx::Point(width() - y_mid, y_mid);
307 } 307 }
308 } 308 }
309 309
310 } // namespace ash 310 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698