Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / views / round_rect_painter.cc
blob1b96a125c43fa151b92b190831af35574a11739e
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
3 // found in the LICENSE file.
5 #include "ui/views/round_rect_painter.h"
7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/path.h"
9 #include "ui/gfx/skia_util.h"
11 namespace views {
13 RoundRectPainter::RoundRectPainter(SkColor border_color, int corner_radius)
14 : border_color_(border_color),
15 corner_radius_(corner_radius) {
18 RoundRectPainter::~RoundRectPainter() {
21 gfx::Size RoundRectPainter::GetMinimumSize() const {
22 return gfx::Size(1, 1);
25 void RoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) {
26 SkPaint paint;
27 paint.setColor(border_color_);
28 paint.setStyle(SkPaint::kStroke_Style);
29 paint.setStrokeWidth(1);
30 paint.setFlags(SkPaint::kAntiAlias_Flag);
31 gfx::Rect rect(size);
32 rect.Inset(0, 0, 1, 1);
33 SkRect skia_rect = gfx::RectToSkRect(rect);
34 skia_rect.offset(.5, .5);
35 canvas->sk_canvas()->drawRoundRect(skia_rect, SkIntToScalar(corner_radius_),
36 SkIntToScalar(corner_radius_), paint);
39 } // namespace views