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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/svg/SkSVGElements.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2006 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#ifndef SkSVGElements_DEFINED
    1.14 +#define SkSVGElements_DEFINED
    1.15 +
    1.16 +#include "SkSVGPaintState.h"
    1.17 +#include "SkSVGTypes.h"
    1.18 +#include "SkTDArray.h"
    1.19 +
    1.20 +class SkSVGParser;
    1.21 +
    1.22 +#define DECLARE_SVG_INFO(_type) \
    1.23 +public: \
    1.24 +    virtual ~SkSVG##_type(); \
    1.25 +    static const SkSVGAttribute gAttributes[]; \
    1.26 +    virtual int getAttributes(const SkSVGAttribute** attrPtr); \
    1.27 +    virtual SkSVGTypes getType() const; \
    1.28 +    virtual void translate(SkSVGParser& parser, bool defState); \
    1.29 +    typedef SkSVG##_type BASE_CLASS
    1.30 +
    1.31 +#define DEFINE_SVG_INFO(_type) \
    1.32 +    SkSVG##_type::~SkSVG##_type() {} \
    1.33 +    int SkSVG##_type::getAttributes(const SkSVGAttribute** attrPtr) { \
    1.34 +        *attrPtr = gAttributes; \
    1.35 +        return SK_ARRAY_COUNT(gAttributes); \
    1.36 +    } \
    1.37 +    SkSVGTypes SkSVG##_type::getType() const { return SkSVGType_##_type; }
    1.38 +
    1.39 +#define DEFINE_SVG_NO_INFO(_type) \
    1.40 +    SkSVG##_type::~SkSVG##_type() {} \
    1.41 +    int SkSVG##_type::getAttributes(const SkSVGAttribute** ) { return 0; } \
    1.42 +    SkSVGTypes SkSVG##_type::getType() const { return SkSVGType_##_type; }
    1.43 +
    1.44 +
    1.45 +struct SkSVGTypeName {
    1.46 +    const char* fName;
    1.47 +    SkSVGTypes fType;
    1.48 +};
    1.49 +
    1.50 +class SkSVGElement : public SkSVGBase {
    1.51 +public:
    1.52 +    SkSVGElement();
    1.53 +    virtual ~SkSVGElement();
    1.54 +    virtual SkSVGElement* getGradient();
    1.55 +    virtual SkSVGTypes getType() const  = 0;
    1.56 +    virtual bool isDef();
    1.57 +    virtual bool isFlushable();
    1.58 +    virtual bool isGroup();
    1.59 +    virtual bool isNotDef();
    1.60 +    virtual bool onEndElement(SkSVGParser& parser);
    1.61 +    virtual bool onStartElement(SkSVGElement* child);
    1.62 +    void setIsDef();
    1.63 +//  void setIsNotDef();
    1.64 +    virtual void translate(SkSVGParser& parser, bool defState);
    1.65 +    virtual void write(SkSVGParser& , SkString& color);
    1.66 +    SkString f_id;
    1.67 +    SkSVGPaint fPaintState;
    1.68 +    SkTDArray<SkSVGElement*> fChildren;
    1.69 +    SkSVGElement* fParent;
    1.70 +    bool fIsDef;
    1.71 +    bool fIsNotDef;
    1.72 +private:
    1.73 +    bool isGroupParent();
    1.74 +};
    1.75 +
    1.76 +#endif // SkSVGElements_DEFINED

mercurial