blob: ce1ff392acf8ae292242668160538fca4e3d4263 [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
17void Path::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
18 canvas->drawPath(fPath, paint);
19}
20
Florin Malita0ebf4192018-01-04 19:21:58 -050021Node::RevalidationResult Path::onRevalidate(InvalidationController*, const SkMatrix&) {
Florin Malitac75e2402018-01-03 16:17:29 -050022 SkASSERT(this->hasSelfInval());
23
Florin Malita0ebf4192018-01-04 19:21:58 -050024 // Geometry does not contribute damage directly.
25 return { fPath.computeTightBounds(), Damage::kBlockSelf };
Florin Malita047ae272017-12-27 11:13:13 -050026}
27
Florin Malitae6345d92018-01-03 23:37:54 -050028SkPath Path::onAsPath() const {
29 return fPath;
30}
31
Florin Malita047ae272017-12-27 11:13:13 -050032} // namespace sksg