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