gfx/skia/trunk/src/animator/SkAnimateActive.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkAnimateActive.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     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 SkAnimateActive_DEFINED
    1.14 +#define SkAnimateActive_DEFINED
    1.15 +
    1.16 +#include "SkDisplayApply.h"
    1.17 +#include "SkOperandInterpolator.h"
    1.18 +#include "SkIntArray.h"
    1.19 +
    1.20 +class SkAnimateMaker;
    1.21 +
    1.22 +class SkActive {
    1.23 +public:
    1.24 +    SkActive(SkApply& , SkAnimateMaker& );
    1.25 +    ~SkActive();
    1.26 +    void advance();
    1.27 +    void append(SkApply* );
    1.28 +    void calcDurations(int index);
    1.29 +    void create(SkDrawable* scope, SkMSec time);
    1.30 +    bool draw() { return immediate(false); }
    1.31 +    bool enable() { return immediate(true); }
    1.32 +    void init( );
    1.33 +    SkMSec getTime(SkMSec inTime, int animatorIndex);
    1.34 +    void pickUp(SkActive* existing);
    1.35 +    void reset() { fDrawIndex = 0; }
    1.36 +    void setInterpolator(int index, SkOperand* from);
    1.37 +    void start();
    1.38 +#ifdef SK_DEBUG
    1.39 +    void validate();
    1.40 +#endif
    1.41 +private:
    1.42 +    void appendSave(int oldCount);
    1.43 +    void fixInterpolator(SkBool save);
    1.44 +    bool immediate(bool enable);
    1.45 +    bool initializeSave();
    1.46 +    void initState(SkApply* , int offset);
    1.47 +    void resetInterpolators();
    1.48 +    void resetState();
    1.49 +    void restoreInterpolatorValues(int index);
    1.50 +    void saveInterpolatorValues(int index);
    1.51 +    void setSteps(int steps);
    1.52 +    struct SkState {
    1.53 +//      void bumpSave();
    1.54 +        SkMSec getRelativeTime(SkMSec time);
    1.55 +        SkApply::Mode fMode;
    1.56 +        SkApply::Transition fTransition;
    1.57 +        SkBool8 fPickup;
    1.58 +        SkBool8 fRestore;
    1.59 +        SkBool8 fStarted;
    1.60 +        SkBool8 fUnpostedEndEvent;
    1.61 +        int32_t fSteps;
    1.62 +        SkMSec fBegin;
    1.63 +        SkMSec fStartTime;
    1.64 +        SkMSec fDuration;
    1.65 +        SkMSec fSave;
    1.66 +        SkMSec fTicks;
    1.67 +    };
    1.68 +    SkActive& operator= (const SkActive& );
    1.69 +    SkTDArray<SkOperandInterpolator*> fInterpolators;
    1.70 +    SkApply& fApply;
    1.71 +    SkTDArray<SkState> fState;  // one per animator
    1.72 +    SkTDOperandPtrArray fSaveRestore;   // if apply has restore="true"
    1.73 +    SkTDOperandPtrArray fSaveInterpolators;
    1.74 +    SkTDAnimateArray fAnimators;
    1.75 +    SkMSec fMaxTime;    // greatest of all animation durations; only used by immediate mode
    1.76 +    SkAnimateMaker& fMaker;
    1.77 +    int fDrawIndex;
    1.78 +    int fDrawMax;
    1.79 +    friend class SkApply;
    1.80 +};
    1.81 +
    1.82 +#endif // SkAnimateActive_DEFINED

mercurial