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

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

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

Powered by Google App Engine
This is Rietveld 408576698