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

Unified Diff: ui/views/round_rect_painter.cc

Issue 12041085: Fix menu corners: the menu background was being painted as a rect when in fact, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/round_rect_painter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/round_rect_painter.cc
diff --git a/ui/views/round_rect_painter.cc b/ui/views/round_rect_painter.cc
index 2492e924444d4e14880f391a6180d40f9ffada00..007fb1b06fc68e828320d8ff52f7cbdde0b39997 100644
--- a/ui/views/round_rect_painter.cc
+++ b/ui/views/round_rect_painter.cc
@@ -10,10 +10,9 @@
namespace views {
-static const int kRadius = 2;
-
-RoundRectPainter::RoundRectPainter(SkColor border_color)
- : border_color_(border_color) {
+RoundRectPainter::RoundRectPainter(SkColor border_color, int corner_radius)
+ : border_color_(border_color),
+ corner_radius_(corner_radius) {
}
RoundRectPainter::~RoundRectPainter() {
@@ -29,19 +28,8 @@ void RoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) {
rect.Inset(0, 0, 1, 1);
SkRect skia_rect = gfx::RectToSkRect(rect);
skia_rect.offset(.5, .5);
- canvas->sk_canvas()->drawRoundRect(skia_rect, SkIntToScalar(kRadius),
- SkIntToScalar(kRadius), paint);
-}
-
-// static
-void RoundRectPainter::CreateRoundRectPath(const gfx::Rect& bounds,
- gfx::Path* path) {
- SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()),
- SkIntToScalar(bounds.height()));
- SkScalar radius = SkIntToScalar(kRadius);
- SkScalar radii[8] = {radius, radius, radius, radius,
- radius, radius, radius, radius};
- path->addRoundRect(rect, radii);
+ canvas->sk_canvas()->drawRoundRect(skia_rect, SkIntToScalar(corner_radius_),
+ SkIntToScalar(corner_radius_), paint);
}
} // namespace views
« no previous file with comments | « ui/views/round_rect_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698