OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2006 The Android Open Source Project | |
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 | |
9 #ifndef SkSVGElements_DEFINED | |
10 #define SkSVGElements_DEFINED | |
11 | |
12 #include "SkSVGPaintState.h" | |
13 #include "SkSVGTypes.h" | |
14 #include "SkTDArray.h" | |
15 | |
16 class SkSVGParser; | |
17 | |
18 #define DECLARE_SVG_INFO(_type) \ | |
19 public: \ | |
20 virtual ~SkSVG##_type(); \ | |
21 static const SkSVGAttribute gAttributes[]; \ | |
22 virtual int getAttributes(const SkSVGAttribute** attrPtr); \ | |
23 virtual SkSVGTypes getType() const; \ | |
24 virtual void translate(SkSVGParser& parser, bool defState); \ | |
25 typedef SkSVG##_type BASE_CLASS | |
26 | |
27 #define DEFINE_SVG_INFO(_type) \ | |
28 SkSVG##_type::~SkSVG##_type() {} \ | |
29 int SkSVG##_type::getAttributes(const SkSVGAttribute** attrPtr) { \ | |
30 *attrPtr = gAttributes; \ | |
31 return SK_ARRAY_COUNT(gAttributes); \ | |
32 } \ | |
33 SkSVGTypes SkSVG##_type::getType() const { return SkSVGType_##_type; } | |
34 | |
35 #define DEFINE_SVG_NO_INFO(_type) \ | |
36 SkSVG##_type::~SkSVG##_type() {} \ | |
37 int SkSVG##_type::getAttributes(const SkSVGAttribute** ) { return 0; } \ | |
38 SkSVGTypes SkSVG##_type::getType() const { return SkSVGType_##_type; } | |
39 | |
40 | |
41 struct SkSVGTypeName { | |
42 const char* fName; | |
43 SkSVGTypes fType; | |
44 }; | |
45 | |
46 class SkSVGElement : public SkSVGBase { | |
47 public: | |
48 SkSVGElement(); | |
49 virtual ~SkSVGElement(); | |
50 virtual SkSVGElement* getGradient(); | |
51 virtual SkSVGTypes getType() const = 0; | |
52 virtual bool isDef(); | |
53 virtual bool isFlushable(); | |
54 virtual bool isGroup(); | |
55 virtual bool isNotDef(); | |
56 virtual bool onEndElement(SkSVGParser& parser); | |
57 virtual bool onStartElement(SkSVGElement* child); | |
58 void setIsDef(); | |
59 // void setIsNotDef(); | |
60 virtual void translate(SkSVGParser& parser, bool defState); | |
61 virtual void write(SkSVGParser& , SkString& color); | |
62 SkString f_id; | |
63 SkSVGPaint fPaintState; | |
64 SkTDArray<SkSVGElement*> fChildren; | |
65 SkSVGElement* fParent; | |
66 bool fIsDef; | |
67 bool fIsNotDef; | |
68 private: | |
69 bool isGroupParent(); | |
70 }; | |
71 | |
72 #endif // SkSVGElements_DEFINED | |
OLD | NEW |