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 SkSVGDOM_DEFINED 9 #define SkSVGDOM_DEFINED 10 11 #include "SkRefCnt.h" 12 #include "SkSize.h" 13 #include "SkSVGIDMapper.h" 14 #include "SkTemplates.h" 15 16 class SkCanvas; 17 class SkDOM; 18 class SkStream; 19 class SkSVGNode; 20 21 class SkSVGDOM : public SkRefCnt { 22 public: 23 SkSVGDOM(); 24 ~SkSVGDOM() = default; 25 26 static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&); 27 static sk_sp<SkSVGDOM> MakeFromStream(SkStream&); 28 29 const SkSize& containerSize() const; 30 void setContainerSize(const SkSize&); 31 32 void setRoot(sk_sp<SkSVGNode>); 33 34 void render(SkCanvas*) const; 35 36 private: 37 SkSize intrinsicSize() const; 38 39 SkSize fContainerSize; 40 sk_sp<SkSVGNode> fRoot; 41 SkSVGIDMapper fIDMapper; 42 43 typedef SkRefCnt INHERITED; 44 }; 45 46 #endif // SkSVGDOM_DEFINED 47