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 private: 38 // FIXME: should be sparse 39 SkSVGTransformType fTransform; 40 41 using INHERITED = SkSVGNode; 42 }; 43 44 #endif // SkSVGTransformableNode_DEFINED 45