blob: d7bc5d4fc887d9b682830bd1629f152e1ed64c0f [file] [log] [blame]
Florin Malita4aa44412017-12-19 12:21:02 -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#ifndef SkSGTransform_DEFINED
9#define SkSGTransform_DEFINED
10
11#include "SkSGEffectNode.h"
12
13#include "SkMatrix.h"
14
15namespace sksg {
16
17/**
18 * Concrete Effect node, wrapping an SkMatrix.
19 */
20class Transform : public EffectNode {
21public:
22 static sk_sp<Transform> Make(sk_sp<RenderNode> child, const SkMatrix& matrix) {
23 return sk_sp<Transform>(new Transform(std::move(child), matrix));
24 }
25
26 SG_ATTRIBUTE(Matrix, SkMatrix, fMatrix)
27
28protected:
29 Transform(sk_sp<RenderNode>, const SkMatrix&);
30
31 void onRender(SkCanvas*) const override;
32
33 void onRevalidate(InvalidationController*, const SkMatrix&) override;
34
35private:
36 SkMatrix fMatrix;
37
38 typedef EffectNode INHERITED;
39};
40
41} // namespace sksg
42
43#endif // SkSGTransform_DEFINED