| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 p1.Scale(dsf); | 327 p1.Scale(dsf); |
| 328 p2.Scale(dsf); | 328 p2.Scale(dsf); |
| 329 | 329 |
| 330 cc::PaintFlags flags; | 330 cc::PaintFlags flags; |
| 331 flags.setColor(color); | 331 flags.setColor(color); |
| 332 flags.setStrokeWidth(SkFloatToScalar(std::floor(dsf))); | 332 flags.setStrokeWidth(SkFloatToScalar(std::floor(dsf))); |
| 333 | 333 |
| 334 DrawLine(p1, p2, flags); | 334 DrawLine(p1, p2, flags); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void Canvas::Draw1pxLine(PointF p1, PointF p2, SkColor color) { |
| 338 ScopedCanvas scoped(this); |
| 339 float dsf = UndoDeviceScaleFactor(); |
| 340 p1.Scale(dsf); |
| 341 p2.Scale(dsf); |
| 342 |
| 343 DrawLine(p1, p2, color); |
| 344 } |
| 345 |
| 337 void Canvas::DrawCircle(const Point& center_point, | 346 void Canvas::DrawCircle(const Point& center_point, |
| 338 int radius, | 347 int radius, |
| 339 const cc::PaintFlags& flags) { | 348 const cc::PaintFlags& flags) { |
| 340 DrawCircle(PointF(center_point), radius, flags); | 349 DrawCircle(PointF(center_point), radius, flags); |
| 341 } | 350 } |
| 342 | 351 |
| 343 void Canvas::DrawCircle(const PointF& center_point, | 352 void Canvas::DrawCircle(const PointF& center_point, |
| 344 float radius, | 353 float radius, |
| 345 const cc::PaintFlags& flags) { | 354 const cc::PaintFlags& flags) { |
| 346 canvas_->drawCircle(SkFloatToScalar(center_point.x()), | 355 canvas_->drawCircle(SkFloatToScalar(center_point.x()), |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); | 619 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
| 611 flags.setShader(CreateImageRepShaderForScale( | 620 flags.setShader(CreateImageRepShaderForScale( |
| 612 image_rep, SkShader::kRepeat_TileMode, shader_scale, | 621 image_rep, SkShader::kRepeat_TileMode, shader_scale, |
| 613 remove_image_scale ? image_rep.scale() : 1.f)); | 622 remove_image_scale ? image_rep.scale() : 1.f)); |
| 614 | 623 |
| 615 // The rect will be filled by the bitmap. | 624 // The rect will be filled by the bitmap. |
| 616 canvas_->drawRect(dest_rect, flags); | 625 canvas_->drawRect(dest_rect, flags); |
| 617 } | 626 } |
| 618 | 627 |
| 619 } // namespace gfx | 628 } // namespace gfx |
| OLD | NEW |