2017-12-19 17:21:02 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SkSGRect.h"
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkPaint.h"
|
|
|
|
|
|
|
|
namespace sksg {
|
|
|
|
|
|
|
|
Rect::Rect(const SkRect& rect) : fRect(rect) {}
|
|
|
|
|
|
|
|
void Rect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
|
|
|
|
canvas->drawRect(fRect, paint);
|
|
|
|
}
|
|
|
|
|
2018-01-03 21:17:29 +00:00
|
|
|
SkRect Rect::onRevalidate(InvalidationController*, const SkMatrix&) {
|
|
|
|
SkASSERT(this->hasSelfInval());
|
|
|
|
|
2017-12-19 17:21:02 +00:00
|
|
|
return fRect;
|
|
|
|
}
|
|
|
|
|
2018-01-02 15:40:00 +00:00
|
|
|
RRect::RRect(const SkRRect& rr) : fRRect(rr) {}
|
|
|
|
|
|
|
|
void RRect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
|
|
|
|
canvas->drawRRect(fRRect, paint);
|
|
|
|
}
|
|
|
|
|
2018-01-03 21:17:29 +00:00
|
|
|
SkRect RRect::onRevalidate(InvalidationController*, const SkMatrix&) {
|
|
|
|
SkASSERT(this->hasSelfInval());
|
|
|
|
|
2018-01-02 15:40:00 +00:00
|
|
|
return fRRect.getBounds();
|
|
|
|
}
|
|
|
|
|
2017-12-19 17:21:02 +00:00
|
|
|
} // namespace sksg
|