2017-12-27 16:13:13 +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 "SkSGPath.h"
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkPaint.h"
|
|
|
|
|
|
|
|
namespace sksg {
|
|
|
|
|
|
|
|
Path::Path(const SkPath& path) : fPath(path) {}
|
|
|
|
|
2018-01-29 21:31:14 +00:00
|
|
|
void Path::onClip(SkCanvas* canvas, bool antiAlias) const {
|
|
|
|
canvas->clipPath(fPath, SkClipOp::kIntersect, antiAlias);
|
|
|
|
}
|
|
|
|
|
2017-12-27 16:13:13 +00:00
|
|
|
void Path::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
|
|
|
|
canvas->drawPath(fPath, paint);
|
|
|
|
}
|
|
|
|
|
2018-01-05 16:32:31 +00:00
|
|
|
SkRect Path::onRevalidate(InvalidationController*, const SkMatrix&) {
|
|
|
|
SkASSERT(this->hasInval());
|
2018-01-03 21:17:29 +00:00
|
|
|
|
2018-01-05 16:32:31 +00:00
|
|
|
return fPath.computeTightBounds();
|
2017-12-27 16:13:13 +00:00
|
|
|
}
|
|
|
|
|
2018-01-04 04:37:54 +00:00
|
|
|
SkPath Path::onAsPath() const {
|
|
|
|
return fPath;
|
|
|
|
}
|
|
|
|
|
2017-12-27 16:13:13 +00:00
|
|
|
} // namespace sksg
|