| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 void Canvas::DrawRect(const Rect& rect, const SkPaint& paint) { | 264 void Canvas::DrawRect(const Rect& rect, const SkPaint& paint) { |
| 265 canvas_->drawIRect(RectToSkIRect(rect), paint); | 265 canvas_->drawIRect(RectToSkIRect(rect), paint); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void Canvas::DrawPoint(const Point& p1, const SkPaint& paint) { | 268 void Canvas::DrawPoint(const Point& p1, const SkPaint& paint) { |
| 269 canvas_->drawPoint(SkIntToScalar(p1.x()), SkIntToScalar(p1.y()), paint); | 269 canvas_->drawPoint(SkIntToScalar(p1.x()), SkIntToScalar(p1.y()), paint); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void Canvas::DrawLine(const Point& p1, const Point& p2, SkColor color) { | 272 void Canvas::DrawLine(const Point& p1, const Point& p2, SkColor color) { |
| 273 DrawLine(PointF(p1), PointF(p2), color); |
| 274 } |
| 275 |
| 276 void Canvas::DrawLine(const PointF& p1, const PointF& p2, SkColor color) { |
| 273 SkPaint paint; | 277 SkPaint paint; |
| 274 paint.setColor(color); | 278 paint.setColor(color); |
| 275 paint.setStrokeWidth(SkIntToScalar(1)); | 279 paint.setStrokeWidth(SkIntToScalar(1)); |
| 276 DrawLine(p1, p2, paint); | 280 DrawLine(p1, p2, paint); |
| 277 } | 281 } |
| 278 | 282 |
| 279 void Canvas::DrawLine(const Point& p1, const Point& p2, const SkPaint& paint) { | 283 void Canvas::DrawLine(const Point& p1, const Point& p2, const SkPaint& paint) { |
| 280 canvas_->drawLine(SkIntToScalar(p1.x()), SkIntToScalar(p1.y()), | 284 DrawLine(PointF(p1), PointF(p2), paint); |
| 281 SkIntToScalar(p2.x()), SkIntToScalar(p2.y()), paint); | 285 } |
| 286 |
| 287 void Canvas::DrawLine(const PointF& p1, |
| 288 const PointF& p2, |
| 289 const SkPaint& paint) { |
| 290 canvas_->drawLine(SkFloatToScalar(p1.x()), SkFloatToScalar(p1.y()), |
| 291 SkFloatToScalar(p2.x()), SkFloatToScalar(p2.y()), paint); |
| 282 } | 292 } |
| 283 | 293 |
| 284 void Canvas::DrawCircle(const Point& center_point, | 294 void Canvas::DrawCircle(const Point& center_point, |
| 285 int radius, | 295 int radius, |
| 286 const SkPaint& paint) { | 296 const SkPaint& paint) { |
| 287 canvas_->drawCircle(SkIntToScalar(center_point.x()), | 297 canvas_->drawCircle(SkIntToScalar(center_point.x()), |
| 288 SkIntToScalar(center_point.y()), SkIntToScalar(radius), paint); | 298 SkIntToScalar(center_point.y()), SkIntToScalar(radius), paint); |
| 289 } | 299 } |
| 290 | 300 |
| 291 void Canvas::DrawRoundRect(const Rect& rect, | 301 void Canvas::DrawRoundRect(const Rect& rect, |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); | 569 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
| 560 p.setShader(CreateImageRepShaderForScale( | 570 p.setShader(CreateImageRepShaderForScale( |
| 561 image_rep, SkShader::kRepeat_TileMode, shader_scale, | 571 image_rep, SkShader::kRepeat_TileMode, shader_scale, |
| 562 remove_image_scale ? image_rep.scale() : 1.f)); | 572 remove_image_scale ? image_rep.scale() : 1.f)); |
| 563 | 573 |
| 564 // The rect will be filled by the bitmap. | 574 // The rect will be filled by the bitmap. |
| 565 canvas_->drawRect(dest_rect, p); | 575 canvas_->drawRect(dest_rect, p); |
| 566 } | 576 } |
| 567 | 577 |
| 568 } // namespace gfx | 578 } // namespace gfx |
| OLD | NEW |