Florin Malita | 4aa4441 | 2017-12-19 12:21:02 -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 "SkSGRect.h" |
| 9 | |
| 10 | #include "SkCanvas.h" |
| 11 | #include "SkPaint.h" |
| 12 | |
| 13 | namespace sksg { |
| 14 | |
| 15 | Rect::Rect(const SkRect& rect) : fRect(rect) {} |
| 16 | |
| 17 | void Rect::onDraw(SkCanvas* canvas, const SkPaint& paint) const { |
| 18 | canvas->drawRect(fRect, paint); |
| 19 | } |
| 20 | |
Florin Malita | c75e240 | 2018-01-03 16:17:29 -0500 | [diff] [blame] | 21 | SkRect Rect::onRevalidate(InvalidationController*, const SkMatrix&) { |
| 22 | SkASSERT(this->hasSelfInval()); |
| 23 | |
Florin Malita | 4aa4441 | 2017-12-19 12:21:02 -0500 | [diff] [blame] | 24 | return fRect; |
| 25 | } |
| 26 | |
Florin Malita | 2e1d7e2 | 2018-01-02 10:40:00 -0500 | [diff] [blame] | 27 | RRect::RRect(const SkRRect& rr) : fRRect(rr) {} |
| 28 | |
| 29 | void RRect::onDraw(SkCanvas* canvas, const SkPaint& paint) const { |
| 30 | canvas->drawRRect(fRRect, paint); |
| 31 | } |
| 32 | |
Florin Malita | c75e240 | 2018-01-03 16:17:29 -0500 | [diff] [blame] | 33 | SkRect RRect::onRevalidate(InvalidationController*, const SkMatrix&) { |
| 34 | SkASSERT(this->hasSelfInval()); |
| 35 | |
Florin Malita | 2e1d7e2 | 2018-01-02 10:40:00 -0500 | [diff] [blame] | 36 | return fRRect.getBounds(); |
| 37 | } |
| 38 | |
Florin Malita | 4aa4441 | 2017-12-19 12:21:02 -0500 | [diff] [blame] | 39 | } // namespace sksg |