• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 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 SkSVGTransformableNode_DEFINED
9 #define SkSVGTransformableNode_DEFINED
10 
11 #include "include/core/SkMatrix.h"
12 #include "include/core/SkPath.h"
13 #include "include/private/base/SkAPI.h"
14 #include "modules/svg/include/SkSVGNode.h"
15 #include "modules/svg/include/SkSVGTypes.h"
16 #include "modules/svg/include/SkSVGValue.h"
17 
18 class SkSVGRenderContext;
19 enum class SkSVGAttribute;
20 struct SkRect;
21 
22 class SK_API SkSVGTransformableNode : public SkSVGNode {
23 public:
setTransform(const SkSVGTransformType & t)24     void setTransform(const SkSVGTransformType& t) { fTransform = t; }
25 
26 protected:
27     SkSVGTransformableNode(SkSVGTag);
28 
29     bool onPrepareToRender(SkSVGRenderContext*) const override;
30 
31     void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
32 
33     void mapToParent(SkPath*) const;
34 
35     void mapToParent(SkRect*) const;
36 
37     SkRect onObjectBoundingBox(const SkSVGRenderContext& ) const final;
38 
39     virtual SkRect onTransformableObjectBoundingBox(const SkSVGRenderContext&) const;
40 
41 private:
42     // FIXME: should be sparse
43     SkSVGTransformType fTransform;
44 
45     using INHERITED = SkSVGNode;
46 };
47 
48 #endif // SkSVGTransformableNode_DEFINED
49