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

Side by Side Diff: ui/views/round_rect_painter.cc

Issue 2680943002: ui: Clean up naming of paint-related identifiers (Closed)
Patch Set: 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 | « ui/views/painter.cc ('k') | ui/views/shadow_border.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/round_rect_painter.h" 5 #include "ui/views/round_rect_painter.h"
6 6
7 #include "cc/paint/paint_canvas.h" 7 #include "cc/paint/paint_canvas.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/path.h" 9 #include "ui/gfx/path.h"
10 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 RoundRectPainter::RoundRectPainter(SkColor border_color, int corner_radius) 14 RoundRectPainter::RoundRectPainter(SkColor border_color, int corner_radius)
15 : border_color_(border_color), 15 : border_color_(border_color),
16 corner_radius_(corner_radius) { 16 corner_radius_(corner_radius) {
17 } 17 }
18 18
19 RoundRectPainter::~RoundRectPainter() { 19 RoundRectPainter::~RoundRectPainter() {
20 } 20 }
21 21
22 gfx::Size RoundRectPainter::GetMinimumSize() const { 22 gfx::Size RoundRectPainter::GetMinimumSize() const {
23 return gfx::Size(1, 1); 23 return gfx::Size(1, 1);
24 } 24 }
25 25
26 void RoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { 26 void RoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) {
27 cc::PaintFlags paint; 27 cc::PaintFlags flags;
28 paint.setColor(border_color_); 28 flags.setColor(border_color_);
29 paint.setStyle(cc::PaintFlags::kStroke_Style); 29 flags.setStyle(cc::PaintFlags::kStroke_Style);
30 paint.setStrokeWidth(kBorderWidth); 30 flags.setStrokeWidth(kBorderWidth);
31 paint.setAntiAlias(true); 31 flags.setAntiAlias(true);
32 gfx::Rect rect(size); 32 gfx::Rect rect(size);
33 rect.Inset(0, 0, kBorderWidth, kBorderWidth); 33 rect.Inset(0, 0, kBorderWidth, kBorderWidth);
34 SkRect skia_rect = gfx::RectToSkRect(rect); 34 SkRect skia_rect = gfx::RectToSkRect(rect);
35 skia_rect.offset(kBorderWidth / 2.f, kBorderWidth / 2.f); 35 skia_rect.offset(kBorderWidth / 2.f, kBorderWidth / 2.f);
36 canvas->sk_canvas()->drawRoundRect(skia_rect, SkIntToScalar(corner_radius_), 36 canvas->sk_canvas()->drawRoundRect(skia_rect, SkIntToScalar(corner_radius_),
37 SkIntToScalar(corner_radius_), paint); 37 SkIntToScalar(corner_radius_), flags);
38 } 38 }
39 39
40 } // namespace views 40 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/painter.cc ('k') | ui/views/shadow_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698