Florin Malita | 047ae27 | 2017-12-27 11:13:13 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "SkSGPath.h" |
| 9 | |
| 10 | #include "SkCanvas.h" |
| 11 | #include "SkPaint.h" |
| 12 | |
| 13 | namespace sksg { |
| 14 | |
| 15 | Path::Path(const SkPath& path) : fPath(path) {} |
| 16 | |
| 17 | void Path::onDraw(SkCanvas* canvas, const SkPaint& paint) const { |
| 18 | canvas->drawPath(fPath, paint); |
| 19 | } |
| 20 | |
Florin Malita | c14f144 | 2018-01-05 11:32:31 -0500 | [diff] [blame^] | 21 | SkRect Path::onRevalidate(InvalidationController*, const SkMatrix&) { |
| 22 | SkASSERT(this->hasInval()); |
Florin Malita | c75e240 | 2018-01-03 16:17:29 -0500 | [diff] [blame] | 23 | |
Florin Malita | c14f144 | 2018-01-05 11:32:31 -0500 | [diff] [blame^] | 24 | return fPath.computeTightBounds(); |
Florin Malita | 047ae27 | 2017-12-27 11:13:13 -0500 | [diff] [blame] | 25 | } |
| 26 | |
Florin Malita | e6345d9 | 2018-01-03 23:37:54 -0500 | [diff] [blame] | 27 | SkPath Path::onAsPath() const { |
| 28 | return fPath; |
| 29 | } |
| 30 | |
Florin Malita | 047ae27 | 2017-12-27 11:13:13 -0500 | [diff] [blame] | 31 | } // namespace sksg |