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 SkDisplayApply_DEFINED
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkDisplayApply_DEFINED
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkAnimateBase.h"
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkDrawable.h"
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkIntArray.h"
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkActive;
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkApply : public SkDrawable {
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    DECLARE_MEMBER_INFO(Apply);
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkApply();
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual ~SkApply();
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum Transition {
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kTransition_normal,
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kTransition_reverse
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum Mode {
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kMode_create,
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kMode_immediate,
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        //kMode_once
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void activate(SkAnimateMaker& );
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void append(SkApply* apply);
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void appendActive(SkActive* );
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void applyValues(int animatorIndex, SkOperand* values, int count,
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkDisplayTypes , SkMSec time);
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool contains(SkDisplayable*);
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  void createActive(SkAnimateMaker& );
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayable* deepCopy(SkAnimateMaker* );
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void disable();
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool draw(SkAnimateMaker& );
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DUMP_ENABLED
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dump(SkAnimateMaker* );
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool enable(SkAnimateMaker& );
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void enableCreate(SkAnimateMaker& );
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void enableDynamic(SkAnimateMaker& );
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void endSave(int index);
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    Mode getMode() { return mode; }
5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool getProperty(int index, SkScriptValue* value) const;
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDrawable* getScope() { return scope; }
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void getStep(SkScriptValue* );
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDrawable* getTarget(SkAnimateBase* );
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool hasDelayedAnimator() const;
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool hasEnable() const;
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool inactivate(SkAnimateMaker& maker);
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void initialize();
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool interpolate(SkAnimateMaker& , SkMSec time);
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void onEndElement(SkAnimateMaker& );
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* preferredChild(SkDisplayTypes type);
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void refresh(SkAnimateMaker& );
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void reset();
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* );
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool resolveField(SkAnimateMaker& , SkDisplayable* parent, SkString* str);
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void save(int index);
7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setEmbedded() { fEmbedded = true; }
7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual bool setProperty(int index, SkScriptValue& );
7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void setSteps(int _steps);
7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  virtual void setTime(SkMSec time);
7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DEBUG
7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void validate();
7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMSec begin;
7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool dontDraw;
8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkString dynamicScope;
8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMSec interval;
8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    Mode mode;
8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if 0
8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool pickup;
8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool restore;
8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDrawable* scope;
8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int32_t steps;
8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    Transition transition;
9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkActive* fActive;
9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDAnimateArray fAnimators;
9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  SkDrawable* fCurrentScope;
9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMSec fLastTime;   // used only to return script property time
9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDDrawableArray fScopes;
9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fAppended : 1;
9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fContainsScope : 1;
9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fDeleteScope : 1;
9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fEmbedded : 1;
9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fEnabled : 1;
10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBool fEnabling : 1; // set if calling interpolate from enable
10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    friend class SkActive;
10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    friend class SkDisplayList;
10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDrawable INHERITED;
10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkDisplayApply_DEFINED
107