OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkSVGEllipse.h" | 9 #include "SkSVGEllipse.h" |
10 #include "SkSVGRenderContext.h" | 10 #include "SkSVGRenderContext.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void SkSVGEllipse::onDraw(SkCanvas* canvas, const SkSVGLengthContext& lctx, | 58 void SkSVGEllipse::onDraw(SkCanvas* canvas, const SkSVGLengthContext& lctx, |
59 const SkPaint& paint) const { | 59 const SkPaint& paint) const { |
60 const auto cx = lctx.resolve(fCx, SkSVGLengthContext::LengthType::kHorizonta
l); | 60 const auto cx = lctx.resolve(fCx, SkSVGLengthContext::LengthType::kHorizonta
l); |
61 const auto cy = lctx.resolve(fCy, SkSVGLengthContext::LengthType::kVertical)
; | 61 const auto cy = lctx.resolve(fCy, SkSVGLengthContext::LengthType::kVertical)
; |
62 const auto rx = lctx.resolve(fRx, SkSVGLengthContext::LengthType::kHorizonta
l); | 62 const auto rx = lctx.resolve(fRx, SkSVGLengthContext::LengthType::kHorizonta
l); |
63 const auto ry = lctx.resolve(fRy, SkSVGLengthContext::LengthType::kVertical)
; | 63 const auto ry = lctx.resolve(fRy, SkSVGLengthContext::LengthType::kVertical)
; |
64 | 64 |
65 if (rx > 0 && ry > 0) { | 65 if (rx > 0 && ry > 0) { |
66 canvas->drawOval(SkRect::MakeXYWH(cx - rx / 2, cy - ry / 2, rx * 2, ry *
2), paint); | 66 canvas->drawOval(SkRect::MakeXYWH(cx - rx, cy - ry, rx * 2, ry * 2), pai
nt); |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |