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
13namespace sksg {
14
15Path::Path(const SkPath& path) : fPath(path) {}
16
17void Path::onClip(SkCanvas* canvas, bool antiAlias) const {
18    canvas->clipPath(fPath, SkClipOp::kIntersect, antiAlias);
19}
20
21void Path::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
22    canvas->drawPath(fPath, paint);
23}
24
25SkRect Path::onRevalidate(InvalidationController*, const SkMatrix&) {
26    SkASSERT(this->hasInval());
27
28    return fPath.computeTightBounds();
29}
30
31SkPath Path::onAsPath() const {
32    return fPath;
33}
34
35} // namespace sksg
36