Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkAnimateMaker_DEFINED |
michael@0 | 11 | #define SkAnimateMaker_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | // #define SK_DEBUG_ANIMATION_TIMING |
michael@0 | 14 | |
michael@0 | 15 | #include "SkAnimator.h" |
michael@0 | 16 | #include "SkBitmap.h" |
michael@0 | 17 | #include "SkIntArray.h" |
michael@0 | 18 | #include "SkDisplayEvents.h" |
michael@0 | 19 | #include "SkDisplayList.h" |
michael@0 | 20 | #include "SkDisplayScreenplay.h" |
michael@0 | 21 | #include "SkDisplayXMLParser.h" |
michael@0 | 22 | #include "SkScript.h" |
michael@0 | 23 | #include "SkString.h" |
michael@0 | 24 | #include "SkTDict.h" |
michael@0 | 25 | |
michael@0 | 26 | // not sure where this little helper macro should go |
michael@0 | 27 | |
michael@0 | 28 | |
michael@0 | 29 | class SkActive; |
michael@0 | 30 | class SkAnimate; |
michael@0 | 31 | class SkCanvas; |
michael@0 | 32 | class SkDisplayable; |
michael@0 | 33 | class SkDrawable; |
michael@0 | 34 | class SkDump; |
michael@0 | 35 | class SkEvent; |
michael@0 | 36 | class SkEventSink; |
michael@0 | 37 | class SkExtras; |
michael@0 | 38 | class SkGroup; |
michael@0 | 39 | class SkPaint; |
michael@0 | 40 | class SkStream; |
michael@0 | 41 | |
michael@0 | 42 | class SkAnimateMaker { |
michael@0 | 43 | public: |
michael@0 | 44 | SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint); |
michael@0 | 45 | ~SkAnimateMaker(); |
michael@0 | 46 | void appendActive(SkActive* ); |
michael@0 | 47 | void childrenAdd(SkDisplayable* child) { *fChildren.append() = child; } |
michael@0 | 48 | void clearExtraPropertyCallBack(SkDisplayTypes type); |
michael@0 | 49 | bool computeID(SkDisplayable* displayable, SkDisplayable* parent, SkString* newID); |
michael@0 | 50 | SkDisplayable* createInstance(const char name[], size_t len); |
michael@0 | 51 | bool decodeStream(SkStream* stream); |
michael@0 | 52 | bool decodeURI(const char uri[]); |
michael@0 | 53 | void delayEnable(SkApply* apply, SkMSec time); |
michael@0 | 54 | void doDelayedEvent(); |
michael@0 | 55 | bool doEvent(const SkEvent& event); |
michael@0 | 56 | #ifdef SK_DUMP_ENABLED |
michael@0 | 57 | void dump(const char* match); |
michael@0 | 58 | #endif |
michael@0 | 59 | int dynamicProperty(SkString& nameStr, SkDisplayable** ); |
michael@0 | 60 | bool find(const char* str, SkDisplayable** displayablePtr) const { |
michael@0 | 61 | return fIDs.find(str, displayablePtr); |
michael@0 | 62 | } |
michael@0 | 63 | bool find(const char* str, size_t len, SkDisplayable** displayablePtr) const { |
michael@0 | 64 | return fIDs.find(str, len, displayablePtr); |
michael@0 | 65 | } |
michael@0 | 66 | bool findKey(SkDisplayable* displayable, const char** string) const { |
michael@0 | 67 | return fIDs.findKey(displayable, string); |
michael@0 | 68 | } |
michael@0 | 69 | // bool find(SkString& string, SkDisplayable** displayablePtr) { |
michael@0 | 70 | // return fIDs.find(string.c_str(), displayablePtr); |
michael@0 | 71 | // } |
michael@0 | 72 | SkAnimator* getAnimator() { return fAnimator; } |
michael@0 | 73 | SkMSec getAppTime() const; // call caller to get current time |
michael@0 | 74 | #ifdef SK_DEBUG |
michael@0 | 75 | SkAnimator* getRoot(); |
michael@0 | 76 | #endif |
michael@0 | 77 | SkXMLParserError::ErrorCode getErrorCode() const { return fError.getErrorCode(); } |
michael@0 | 78 | SkMSec getInTime() { return fDisplayList.getTime(); } |
michael@0 | 79 | int getNativeCode() const { return fError.getNativeCode(); } |
michael@0 | 80 | bool hasError() { return fError.hasError(); } |
michael@0 | 81 | void helperAdd(SkDisplayable* trackMe); |
michael@0 | 82 | void helperRemove(SkDisplayable* alreadyTracked); |
michael@0 | 83 | void idsSet(const char* attrValue, size_t len, SkDisplayable* displayable) { |
michael@0 | 84 | fIDs.set(attrValue, len, displayable); } |
michael@0 | 85 | // void loadMovies(); |
michael@0 | 86 | void notifyInval(); |
michael@0 | 87 | void notifyInvalTime(SkMSec time); |
michael@0 | 88 | void postOnEnd(SkAnimateBase* animate, SkMSec end); |
michael@0 | 89 | void removeActive(SkActive* ); |
michael@0 | 90 | void reset(); |
michael@0 | 91 | bool resolveID(SkDisplayable* displayable, SkDisplayable* original); |
michael@0 | 92 | void setEnableTime(SkMSec appTime, SkMSec expectedTime); |
michael@0 | 93 | void setErrorCode(SkXMLParserError::ErrorCode err) { if (fError.hasError() == false) fError.INHERITED::setCode(err); } |
michael@0 | 94 | void setErrorCode(SkDisplayXMLParserError::ErrorCode err) { if (fError.hasError() == false) fError.setCode(err); } |
michael@0 | 95 | void setErrorNoun(const SkString& str) { if (fError.hasError() == false) fError.setNoun(str); } |
michael@0 | 96 | void setErrorString(); |
michael@0 | 97 | void setExtraPropertyCallBack(SkDisplayTypes type, SkScriptEngine::_propertyCallBack , void* userStorage); |
michael@0 | 98 | void setID(SkDisplayable* displayable, const SkString& newID); |
michael@0 | 99 | void setInnerError(SkAnimateMaker* maker, const SkString& str) { fError.setInnerError(maker, str); } |
michael@0 | 100 | void setScriptError(const SkScriptEngine& ); |
michael@0 | 101 | #ifdef SK_DEBUG |
michael@0 | 102 | void validate() { fDisplayList.validate(); } |
michael@0 | 103 | #else |
michael@0 | 104 | void validate() {} |
michael@0 | 105 | #endif |
michael@0 | 106 | SkDisplayEvent* fActiveEvent; |
michael@0 | 107 | SkMSec fAdjustedStart; |
michael@0 | 108 | SkCanvas* fCanvas; |
michael@0 | 109 | SkMSec fEnableTime; |
michael@0 | 110 | int fEndDepth; // passed parameter to onEndElement |
michael@0 | 111 | SkEvents fEvents; |
michael@0 | 112 | SkDisplayList fDisplayList; |
michael@0 | 113 | SkEventSinkID fHostEventSinkID; |
michael@0 | 114 | SkMSec fMinimumInterval; |
michael@0 | 115 | SkPaint* fPaint; |
michael@0 | 116 | SkAnimateMaker* fParentMaker; |
michael@0 | 117 | SkString fPrefix; |
michael@0 | 118 | SkDisplayScreenplay fScreenplay; |
michael@0 | 119 | const SkAnimator::Timeline* fTimeline; |
michael@0 | 120 | SkBool8 fInInclude; |
michael@0 | 121 | SkBool8 fInMovie; |
michael@0 | 122 | SkBool8 fFirstScriptError; |
michael@0 | 123 | #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING |
michael@0 | 124 | SkMSec fDebugTimeBase; |
michael@0 | 125 | #endif |
michael@0 | 126 | #ifdef SK_DUMP_ENABLED |
michael@0 | 127 | SkString fDumpAnimated; |
michael@0 | 128 | SkBool8 fDumpEvents; |
michael@0 | 129 | SkBool8 fDumpGConditions; |
michael@0 | 130 | SkBool8 fDumpPosts; |
michael@0 | 131 | #endif |
michael@0 | 132 | private: |
michael@0 | 133 | void deleteMembers(); |
michael@0 | 134 | static bool GetStep(const char* token, size_t len, void* stepPtr, SkScriptValue* ); |
michael@0 | 135 | SkAnimateMaker& operator=(SkAnimateMaker& ); |
michael@0 | 136 | SkTDDisplayableArray fChildren; |
michael@0 | 137 | SkTDDisplayableArray fDelayed; // SkApply that contain delayed enable events |
michael@0 | 138 | SkDisplayXMLParserError fError; |
michael@0 | 139 | SkString fErrorString; |
michael@0 | 140 | SkTDArray<SkExtras*> fExtras; |
michael@0 | 141 | SkString fFileName; |
michael@0 | 142 | SkTDDisplayableArray fHelpers; // helper displayables |
michael@0 | 143 | SkBool8 fLoaded; |
michael@0 | 144 | SkTDDisplayableArray fMovies; |
michael@0 | 145 | SkTDict<SkDisplayable*> fIDs; |
michael@0 | 146 | SkAnimator* fAnimator; |
michael@0 | 147 | friend class SkAdd; |
michael@0 | 148 | friend class SkAnimateBase; |
michael@0 | 149 | friend class SkDisplayXMLParser; |
michael@0 | 150 | friend class SkAnimator; |
michael@0 | 151 | friend class SkAnimatorScript; |
michael@0 | 152 | friend class SkApply; |
michael@0 | 153 | friend class SkDisplayMovie; |
michael@0 | 154 | friend class SkDisplayType; |
michael@0 | 155 | friend class SkEvents; |
michael@0 | 156 | friend class SkGroup; |
michael@0 | 157 | friend struct SkMemberInfo; |
michael@0 | 158 | }; |
michael@0 | 159 | |
michael@0 | 160 | #endif // SkAnimateMaker_DEFINED |