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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 (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/border.h" 5 #include "ui/views/border.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 DISALLOW_COPY_AND_ASSIGN(RoundedRectBorder); 82 DISALLOW_COPY_AND_ASSIGN(RoundedRectBorder);
83 }; 83 };
84 84
85 RoundedRectBorder::RoundedRectBorder(int thickness, 85 RoundedRectBorder::RoundedRectBorder(int thickness,
86 int corner_radius, 86 int corner_radius,
87 SkColor color) 87 SkColor color)
88 : thickness_(thickness), corner_radius_(corner_radius), color_(color) {} 88 : thickness_(thickness), corner_radius_(corner_radius), color_(color) {}
89 89
90 void RoundedRectBorder::Paint(const View& view, gfx::Canvas* canvas) { 90 void RoundedRectBorder::Paint(const View& view, gfx::Canvas* canvas) {
91 SkPaint paint; 91 CdlPaint paint;
92 paint.setStrokeWidth(thickness_); 92 paint.setStrokeWidth(thickness_);
93 paint.setColor(color_); 93 paint.setColor(color_);
94 paint.setStyle(SkPaint::kStroke_Style); 94 paint.setStyle(CdlPaint::kStroke_Style);
95 paint.setAntiAlias(true); 95 paint.setAntiAlias(true);
96 96
97 float half_thickness = thickness_ / 2.0f; 97 float half_thickness = thickness_ / 2.0f;
98 gfx::RectF bounds(view.GetLocalBounds()); 98 gfx::RectF bounds(view.GetLocalBounds());
99 bounds.Inset(half_thickness, half_thickness); 99 bounds.Inset(half_thickness, half_thickness);
100 canvas->DrawRoundRect(bounds, corner_radius_, paint); 100 canvas->DrawRoundRect(bounds, corner_radius_, paint);
101 } 101 }
102 102
103 gfx::Insets RoundedRectBorder::GetInsets() const { 103 gfx::Insets RoundedRectBorder::GetInsets() const {
104 return gfx::Insets(thickness_); 104 return gfx::Insets(thickness_);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return base::MakeUnique<ExtraInsetsBorder>(std::move(border), insets); 251 return base::MakeUnique<ExtraInsetsBorder>(std::move(border), insets);
252 } 252 }
253 253
254 // static 254 // static
255 std::unique_ptr<Border> CreateBorderPainter(std::unique_ptr<Painter> painter, 255 std::unique_ptr<Border> CreateBorderPainter(std::unique_ptr<Painter> painter,
256 const gfx::Insets& insets) { 256 const gfx::Insets& insets) {
257 return base::WrapUnique(new BorderPainter(std::move(painter), insets)); 257 return base::WrapUnique(new BorderPainter(std::move(painter), insets));
258 } 258 }
259 259
260 } // namespace views 260 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_painted_layer_delegates.cc ('k') | ui/views/bubble/bubble_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698