| OLD | NEW |
| 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 Loading... |
| 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 rad_top_left, |
| 302 int rad_top_right, |
| 303 int rad_bottom_left, |
| 304 int rad_bottom_right, |
| 305 const SkPaint& paint) { |
| 306 SkScalar rad[8] = { |
| 307 SkIntToScalar(rad_top_left), SkIntToScalar(rad_top_left), |
| 308 SkIntToScalar(rad_top_right), SkIntToScalar(rad_top_right), |
| 309 SkIntToScalar(rad_bottom_left), SkIntToScalar(rad_bottom_left), |
| 310 SkIntToScalar(rad_bottom_right), SkIntToScalar(rad_bottom_right)}; |
| 311 SkRRect rrect; |
| 312 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); |
| 313 canvas_->drawRRect(rrect, paint); |
| 314 } |
| 315 |
| 300 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) { | 316 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) { |
| 301 canvas_->drawPath(path, paint); | 317 canvas_->drawPath(path, paint); |
| 302 } | 318 } |
| 303 | 319 |
| 304 void Canvas::DrawFocusRect(const Rect& rect) { | 320 void Canvas::DrawFocusRect(const Rect& rect) { |
| 305 DrawDashedRect(rect, SK_ColorGRAY); | 321 DrawDashedRect(rect, SK_ColorGRAY); |
| 306 } | 322 } |
| 307 | 323 |
| 308 void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) { | 324 void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) { |
| 309 SkPaint paint; | 325 SkPaint paint; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 SkPaint p(paint); | 647 SkPaint p(paint); |
| 632 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel | 648 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel |
| 633 : SkPaint::kNone_FilterLevel); | 649 : SkPaint::kNone_FilterLevel); |
| 634 p.setShader(shader.get()); | 650 p.setShader(shader.get()); |
| 635 | 651 |
| 636 // The rect will be filled by the bitmap. | 652 // The rect will be filled by the bitmap. |
| 637 canvas_->drawRect(dest_rect, p); | 653 canvas_->drawRect(dest_rect, p); |
| 638 } | 654 } |
| 639 | 655 |
| 640 } // namespace gfx | 656 } // namespace gfx |
| OLD | NEW |