1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkDisplayable.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,112 @@ 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 SkDisplayable_DEFINED 1.14 +#define SkDisplayable_DEFINED 1.15 + 1.16 +#include "SkOperand.h" 1.17 +#ifdef SK_DEBUG 1.18 +#include "SkString.h" 1.19 +#endif 1.20 +#include "SkIntArray.h" 1.21 +#include "SkRect.h" 1.22 +#include "SkTDArray.h" 1.23 + 1.24 +class SkAnimateMaker; 1.25 +class SkApply; 1.26 +class SkEvents; 1.27 +struct SkMemberInfo; 1.28 +struct SkScriptValue; 1.29 +class SkOpArray; // compiled scripting experiment 1.30 +union SkOperand2; // compiled scripting experiment 1.31 + 1.32 +class SkDisplayable { 1.33 +public: 1.34 +#ifdef SK_DEBUG 1.35 + SkDisplayable(); 1.36 +#endif 1.37 + virtual ~SkDisplayable(); 1.38 + virtual bool addChild(SkAnimateMaker& , SkDisplayable* child); 1.39 + virtual bool canContainDependents() const; 1.40 + virtual bool childrenNeedDisposing() const; 1.41 + virtual void clearBounder(); 1.42 + virtual bool contains(SkDisplayable* ); 1.43 + virtual SkDisplayable* contains(const SkString& ); 1.44 + virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 1.45 + virtual void dirty(); 1.46 +#ifdef SK_DUMP_ENABLED 1.47 + virtual void dump(SkAnimateMaker* ); 1.48 + void dumpAttrs(SkAnimateMaker* ); 1.49 + void dumpBase(SkAnimateMaker* ); 1.50 + void dumpChildren(SkAnimateMaker* maker, bool closedAngle = false ); 1.51 + void dumpEnd(SkAnimateMaker* ); 1.52 + virtual void dumpEvents(); 1.53 +#endif 1.54 + virtual bool enable( SkAnimateMaker& ); 1.55 + virtual void enableBounder(); 1.56 + virtual void executeFunction(SkDisplayable* , int functionIndex, 1.57 + SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* ); 1.58 + void executeFunction(SkDisplayable* , const SkMemberInfo* , 1.59 + SkTypedArray* , SkScriptValue* ); 1.60 + virtual void executeFunction2(SkDisplayable* , int functionIndex, 1.61 + SkOpArray* params , SkDisplayTypes , SkOperand2* ); // compiled scripting experiment 1.62 + virtual void getBounds(SkRect* ); 1.63 + virtual const SkFunctionParamType* getFunctionsParameters(); 1.64 + virtual const SkMemberInfo* getMember(int index); 1.65 + virtual const SkMemberInfo* getMember(const char name[]); 1.66 + const SkFunctionParamType* getParameters(const SkMemberInfo* info, 1.67 + int* paramCount); 1.68 + virtual SkDisplayable* getParent() const; 1.69 + virtual bool getProperty(int index, SkScriptValue* value) const; 1.70 + virtual bool getProperty2(int index, SkOperand2* value) const; // compiled scripting experiment 1.71 + virtual SkDisplayTypes getType() const; 1.72 + virtual bool hasEnable() const; 1.73 + bool isAnimate() const { 1.74 + SkDisplayTypes type = getType(); 1.75 + return type == SkType_Animate || type == SkType_Set; } 1.76 + bool isApply() const { return getType() == SkType_Apply; } 1.77 + bool isColor() const { return getType() == SkType_Color; } 1.78 + virtual bool isDrawable() const; 1.79 + bool isGroup() const { return getType() == SkType_Group || 1.80 + getType() == SkType_Save || getType() == SkType_DrawTo || 1.81 + getType() == SkType_SaveLayer; } 1.82 + bool isMatrix() const { return getType() == SkType_Matrix; } 1.83 + virtual bool isPaint() const { return getType() == SkType_Paint; } 1.84 + virtual bool isPath() const { return false; } 1.85 + bool isPost() const { return getType() == SkType_Post; } 1.86 + virtual void onEndElement(SkAnimateMaker& ); 1.87 + virtual const SkMemberInfo* preferredChild(SkDisplayTypes type); 1.88 + virtual bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ); 1.89 + virtual void setChildHasID(); 1.90 + virtual bool setParent(SkDisplayable* ); 1.91 + virtual bool setProperty(int index, SkScriptValue& ); 1.92 + void setReference(const SkMemberInfo* info, SkDisplayable* ref); 1.93 +#ifdef SK_DEBUG 1.94 + bool isDataInput() const { return getType() == SkType_DataInput; }; 1.95 + bool isEvent() const { return getType() == SkType_Event; } 1.96 + virtual bool isMatrixPart() const { return false; } 1.97 + bool isPatch() const { return getType() == SkType_3D_Patch; } 1.98 + virtual bool isPaintPart() const { return false; } 1.99 + virtual bool isPathPart() const { return false; } 1.100 + virtual void validate(); 1.101 + SkString _id; 1.102 + const char* id; 1.103 +// static int fAllocationCount; 1.104 + static SkTDDisplayableArray fAllocations; 1.105 +#else 1.106 + void validate() {} 1.107 +#endif 1.108 +#ifdef SK_DUMP_ENABLED 1.109 +private: 1.110 + void dumpValues(const SkMemberInfo* info, SkDisplayTypes type, SkOperand op, SkOperand blankOp, 1.111 + SkOperand op2, SkOperand blankOp2); 1.112 +#endif 1.113 +}; 1.114 + 1.115 +#endif // SkDisplayable_DEFINED