1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkDrawPath.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 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 SkDrawPath_DEFINED 1.14 +#define SkDrawPath_DEFINED 1.15 + 1.16 +#include "SkBoundable.h" 1.17 +#include "SkIntArray.h" 1.18 +#include "SkMemberInfo.h" 1.19 +#include "SkPath.h" 1.20 + 1.21 +class SkDrawPath : public SkBoundable { 1.22 + DECLARE_DRAW_MEMBER_INFO(Path); 1.23 + SkDrawPath(); 1.24 + virtual ~SkDrawPath(); 1.25 + virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE; 1.26 + bool childHasID() { return SkToBool(fChildHasID); } 1.27 + virtual bool childrenNeedDisposing() const; 1.28 + virtual void dirty(); 1.29 + virtual bool draw(SkAnimateMaker& ); 1.30 + virtual SkDisplayable* getParent() const; 1.31 +#ifdef SK_DUMP_ENABLED 1.32 + virtual void dump(SkAnimateMaker* ); 1.33 +#endif 1.34 + SkPath& getPath(); 1.35 + virtual bool getProperty(int index, SkScriptValue* value) const; 1.36 + virtual bool setProperty(int index, SkScriptValue& value); 1.37 + virtual void onEndElement(SkAnimateMaker& ); 1.38 + virtual void setChildHasID(); 1.39 + virtual bool setParent(SkDisplayable* parent); 1.40 + virtual bool isPath() const { return true; } 1.41 +public: 1.42 + SkPath fPath; 1.43 +protected: 1.44 + void parseSVG(); 1.45 + SkString d; 1.46 + SkTDPathPartArray fParts; 1.47 + mutable SkScalar fLength; 1.48 + SkDisplayable* fParent; // SkPolyToPoly or SkFromPath, for instance 1.49 + SkBool8 fChildHasID; 1.50 + SkBool8 fDirty; 1.51 +private: 1.52 + typedef SkBoundable INHERITED; 1.53 +}; 1.54 + 1.55 +class SkPolyline : public SkDrawPath { 1.56 + DECLARE_MEMBER_INFO(Polyline); 1.57 + virtual bool addChild(SkAnimateMaker& , SkDisplayable*) SK_OVERRIDE; 1.58 + virtual void onEndElement(SkAnimateMaker& ); 1.59 +protected: 1.60 + SkTDScalarArray points; 1.61 +private: 1.62 + typedef SkDrawPath INHERITED; 1.63 +}; 1.64 + 1.65 +class SkPolygon : public SkPolyline { 1.66 + DECLARE_MEMBER_INFO(Polygon); 1.67 + virtual void onEndElement(SkAnimateMaker& ); 1.68 +private: 1.69 + typedef SkPolyline INHERITED; 1.70 +}; 1.71 + 1.72 +#endif // SkDrawPath_DEFINED