blob: 31a3371408e8e129d1619ba286a6f15903bbb3d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSGGeometryTransform_DEFINED
#define SkSGGeometryTransform_DEFINED
#include "SkSGGeometryNode.h"
#include "SkPath.h"
#include "SkSGTransform.h"
class SkMatrix;
namespace sksg {
/**
* Concrete Effect node, binding a Matrix to a GeometryNode.
*/
class GeometryTransform final : public GeometryNode {
public:
static sk_sp<GeometryTransform> Make(sk_sp<GeometryNode> child, sk_sp<Matrix> matrix) {
return child && matrix
? sk_sp<GeometryTransform>(new GeometryTransform(std::move(child), std::move(matrix)))
: nullptr;
}
static sk_sp<GeometryTransform> Make(sk_sp<GeometryNode> child, const SkMatrix& m) {
return Make(std::move(child), Matrix::Make(m));
}
~GeometryTransform() override;
const sk_sp<Matrix>& getMatrix() const { return fMatrix; }
protected:
SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
SkPath onAsPath() const override;
void onDraw(SkCanvas*, const SkPaint&) const override;
private:
GeometryTransform(sk_sp<GeometryNode>, sk_sp<Matrix>);
const sk_sp<GeometryNode> fChild;
const sk_sp<Matrix> fMatrix;
SkPath fTransformed;
typedef GeometryNode INHERITED;
};
}
#endif // SkSGGeometryTransform_DEFINED
|