gfx/skia/trunk/src/svg/SkSVGElements.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial