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

Side by Side Diff: ui/gfx/canvas.cc

Issue 568343002: Removed a few manual roundrect path creations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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/gfx/canvas.h" 5 #include "ui/gfx/canvas.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 SkIntToScalar(center_point.y()), SkIntToScalar(radius), paint); 290 SkIntToScalar(center_point.y()), SkIntToScalar(radius), paint);
291 } 291 }
292 292
293 void Canvas::DrawRoundRect(const Rect& rect, 293 void Canvas::DrawRoundRect(const Rect& rect,
294 int radius, 294 int radius,
295 const SkPaint& paint) { 295 const SkPaint& paint) {
296 canvas_->drawRoundRect(RectToSkRect(rect), SkIntToScalar(radius), 296 canvas_->drawRoundRect(RectToSkRect(rect), SkIntToScalar(radius),
297 SkIntToScalar(radius), paint); 297 SkIntToScalar(radius), paint);
298 } 298 }
299 299
300 void Canvas::DrawRoundRect(const Rect& rect,
301 int radTL,
302 int radTR,
303 int radBL,
304 int radBR,
305 const SkPaint& paint) {
306 SkScalar rad[8] = {SkIntToScalar(radTL), SkIntToScalar(radTL),
307 SkIntToScalar(radTR), SkIntToScalar(radTR),
308 SkIntToScalar(radBR), SkIntToScalar(radBR),
309 SkIntToScalar(radBL), SkIntToScalar(radBL)};
310 SkRRect rrect;
311 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad);
312 canvas_->drawRRect(rrect, paint);
313 }
314
300 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) { 315 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) {
301 canvas_->drawPath(path, paint); 316 canvas_->drawPath(path, paint);
302 } 317 }
303 318
304 void Canvas::DrawFocusRect(const Rect& rect) { 319 void Canvas::DrawFocusRect(const Rect& rect) {
305 DrawDashedRect(rect, SK_ColorGRAY); 320 DrawDashedRect(rect, SK_ColorGRAY);
306 } 321 }
307 322
308 void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) { 323 void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) {
309 SkPaint paint; 324 SkPaint paint;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 SkPaint p(paint); 646 SkPaint p(paint);
632 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel 647 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel
633 : SkPaint::kNone_FilterLevel); 648 : SkPaint::kNone_FilterLevel);
634 p.setShader(shader.get()); 649 p.setShader(shader.get());
635 650
636 // The rect will be filled by the bitmap. 651 // The rect will be filled by the bitmap.
637 canvas_->drawRect(dest_rect, p); 652 canvas_->drawRect(dest_rect, p);
638 } 653 }
639 654
640 } // namespace gfx 655 } // namespace gfx
OLDNEW
« ui/gfx/canvas.h ('K') | « ui/gfx/canvas.h ('k') | ui/views/bubble/bubble_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698