blob: 8d5a25373a96e7f5bcdd95ffecb0eb60f2d4010e [file] [log] [blame]
Florin Malita047ae272017-12-27 11:13:13 -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 "SkSGPath.h"
9
10#include "SkCanvas.h"
11#include "SkPaint.h"
12
13namespace sksg {
14
15Path::Path(const SkPath& path) : fPath(path) {}
16
Florin Malita38ea40e2018-01-29 16:31:14 -050017void Path::onClip(SkCanvas* canvas, bool antiAlias) const {
18 canvas->clipPath(fPath, SkClipOp::kIntersect, antiAlias);
19}
20
Florin Malita047ae272017-12-27 11:13:13 -050021void Path::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
22 canvas->drawPath(fPath, paint);
23}
24
Florin Malitac14f1442018-01-05 11:32:31 -050025SkRect Path::onRevalidate(InvalidationController*, const SkMatrix&) {
26 SkASSERT(this->hasInval());
Florin Malitac75e2402018-01-03 16:17:29 -050027
Florin Malitac14f1442018-01-05 11:32:31 -050028 return fPath.computeTightBounds();
Florin Malita047ae272017-12-27 11:13:13 -050029}
30
Florin Malitae6345d92018-01-03 23:37:54 -050031SkPath Path::onAsPath() const {
32 return fPath;
33}
34
Florin Malita047ae272017-12-27 11:13:13 -050035} // namespace sksg