180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkDrawPath_DEFINED
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkDrawPath_DEFINED
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBoundable.h"
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkIntArray.h"
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkMemberInfo.h"
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkPath.h"
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkDrawPath : public SkBoundable {
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    DECLARE_DRAW_MEMBER_INFO(Path);
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDrawPath();
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual ~SkDrawPath();
22363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger    virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE;
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool childHasID() { return SkToBool(fChildHasID); }
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool childrenNeedDisposing() const;
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dirty();
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool draw(SkAnimateMaker& );
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayable* getParent() const;
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DUMP_ENABLED
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dump(SkAnimateMaker* );
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPath& getPath();
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool getProperty(int index, SkScriptValue* value) const;
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool setProperty(int index, SkScriptValue& value);
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void onEndElement(SkAnimateMaker& );
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void setChildHasID();
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool setParent(SkDisplayable* parent);
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool isPath() const { return true; }
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPath fPath;
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void parseSVG();
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkString d;
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDPathPartArray fParts;
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    mutable SkScalar fLength;
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayable* fParent; // SkPolyToPoly or SkFromPath, for instance
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool8 fChildHasID;
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool8 fDirty;
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkBoundable INHERITED;
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkPolyline : public SkDrawPath {
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    DECLARE_MEMBER_INFO(Polyline);
54363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger    virtual bool addChild(SkAnimateMaker& , SkDisplayable*) SK_OVERRIDE;
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void onEndElement(SkAnimateMaker& );
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDScalarArray points;
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDrawPath INHERITED;
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkPolygon : public SkPolyline {
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    DECLARE_MEMBER_INFO(Polygon);
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void onEndElement(SkAnimateMaker& );
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkPolyline INHERITED;
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkDrawPath_DEFINED
70