• 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 SkSVGSVG_DEFINED
9 #define SkSVGSVG_DEFINED
10 
11 #include "SkSVGContainer.h"
12 #include "SkSVGTypes.h"
13 #include "SkTLazy.h"
14 
15 class SkSVGLengthContext;
16 
17 class SkSVGSVG : public SkSVGContainer {
18 public:
19     ~SkSVGSVG() override = default;
20 
Make()21     static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); }
22 
23     void setX(const SkSVGLength&);
24     void setY(const SkSVGLength&);
25     void setWidth(const SkSVGLength&);
26     void setHeight(const SkSVGLength&);
27     void setViewBox(const SkSVGViewBoxType&);
28 
29     SkSize intrinsicSize(const SkSVGLengthContext&) const;
30 
31 protected:
32     bool onPrepareToRender(SkSVGRenderContext*) const override;
33 
34     void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
35 
36 private:
37     SkSVGSVG();
38 
39     SkSVGLength fX      = SkSVGLength(0);
40     SkSVGLength fY      = SkSVGLength(0);
41     SkSVGLength fWidth  = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
42     SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
43 
44     SkTLazy<SkSVGViewBoxType> fViewBox;
45 
46     typedef SkSVGContainer INHERITED;
47 };
48 
49 #endif // SkSVGSVG_DEFINED
50