blob: a49fcf131503ad07b2cdce737442a3774ec9cc65 [file] [log] [blame]
Florin Malita4aa44412017-12-19 12:21:02 -05001/*
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
13namespace sksg {
14
15Rect::Rect(const SkRect& rect) : fRect(rect) {}
16
17void Rect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
18 canvas->drawRect(fRect, paint);
19}
20
Florin Malitac75e2402018-01-03 16:17:29 -050021SkRect Rect::onRevalidate(InvalidationController*, const SkMatrix&) {
22 SkASSERT(this->hasSelfInval());
23
Florin Malita4aa44412017-12-19 12:21:02 -050024 return fRect;
25}
26
Florin Malita2e1d7e22018-01-02 10:40:00 -050027RRect::RRect(const SkRRect& rr) : fRRect(rr) {}
28
29void RRect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
30 canvas->drawRRect(fRRect, paint);
31}
32
Florin Malitac75e2402018-01-03 16:17:29 -050033SkRect RRect::onRevalidate(InvalidationController*, const SkMatrix&) {
34 SkASSERT(this->hasSelfInval());
35
Florin Malita2e1d7e22018-01-02 10:40:00 -050036 return fRRect.getBounds();
37}
38
Florin Malita4aa44412017-12-19 12:21:02 -050039} // namespace sksg