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 SkDisplayable_DEFINED 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkDisplayable_DEFINED 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkOperand.h" 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DEBUG 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkString.h" 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkIntArray.h" 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkRect.h" 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkTDArray.h" 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkAnimateMaker; 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkApply; 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkEvents; 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustruct SkMemberInfo; 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustruct SkScriptValue; 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkOpArray; // compiled scripting experiment 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruunion SkOperand2; // compiled scripting experiment 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkDisplayable { 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DEBUG 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkDisplayable(); 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual ~SkDisplayable(); 35363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger virtual bool addChild(SkAnimateMaker& , SkDisplayable* child); 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool canContainDependents() const; 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool childrenNeedDisposing() const; 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void clearBounder(); 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool contains(SkDisplayable* ); 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual SkDisplayable* contains(const SkString& ); 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void dirty(); 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DUMP_ENABLED 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void dump(SkAnimateMaker* ); 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void dumpAttrs(SkAnimateMaker* ); 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void dumpBase(SkAnimateMaker* ); 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void dumpChildren(SkAnimateMaker* maker, bool closedAngle = false ); 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void dumpEnd(SkAnimateMaker* ); 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void dumpEvents(); 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool enable( SkAnimateMaker& ); 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void enableBounder(); 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void executeFunction(SkDisplayable* , int functionIndex, 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* ); 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void executeFunction(SkDisplayable* , const SkMemberInfo* , 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkTypedArray* , SkScriptValue* ); 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void executeFunction2(SkDisplayable* , int functionIndex, 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkOpArray* params , SkDisplayTypes , SkOperand2* ); // compiled scripting experiment 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void getBounds(SkRect* ); 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual const SkFunctionParamType* getFunctionsParameters(); 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual const SkMemberInfo* getMember(int index); 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual const SkMemberInfo* getMember(const char name[]); 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const SkFunctionParamType* getParameters(const SkMemberInfo* info, 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru int* paramCount); 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual SkDisplayable* getParent() const; 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool getProperty(int index, SkScriptValue* value) const; 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool getProperty2(int index, SkOperand2* value) const; // compiled scripting experiment 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual SkDisplayTypes getType() const; 6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool hasEnable() const; 7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isAnimate() const { 7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkDisplayTypes type = getType(); 7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return type == SkType_Animate || type == SkType_Set; } 7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isApply() const { return getType() == SkType_Apply; } 7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isColor() const { return getType() == SkType_Color; } 7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isDrawable() const; 7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isGroup() const { return getType() == SkType_Group || 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru getType() == SkType_Save || getType() == SkType_DrawTo || 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru getType() == SkType_SaveLayer; } 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isMatrix() const { return getType() == SkType_Matrix; } 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isPaint() const { return getType() == SkType_Paint; } 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isPath() const { return false; } 8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isPost() const { return getType() == SkType_Post; } 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void onEndElement(SkAnimateMaker& ); 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual const SkMemberInfo* preferredChild(SkDisplayTypes type); 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ); 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void setChildHasID(); 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool setParent(SkDisplayable* ); 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool setProperty(int index, SkScriptValue& ); 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void setReference(const SkMemberInfo* info, SkDisplayable* ref); 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DEBUG 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isDataInput() const { return getType() == SkType_DataInput; }; 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isEvent() const { return getType() == SkType_Event; } 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isMatrixPart() const { return false; } 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isPatch() const { return getType() == SkType_3D_Patch; } 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isPaintPart() const { return false; } 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool isPathPart() const { return false; } 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void validate(); 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkString _id; 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* id; 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// static int fAllocationCount; 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkTDDisplayableArray fAllocations; 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void validate() {} 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DUMP_ENABLED 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate: 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void dumpValues(const SkMemberInfo* info, SkDisplayTypes type, SkOperand op, SkOperand blankOp, 10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkOperand op2, SkOperand blankOp2); 10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}; 11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkDisplayable_DEFINED 113