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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkOperandInterpolator.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     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 SkOperandInterpolator_DEFINED
    1.14 +#define SkOperandInterpolator_DEFINED
    1.15 +
    1.16 +#include "SkDisplayType.h"
    1.17 +#include "SkInterpolator.h"
    1.18 +#include "SkOperand.h"
    1.19 +
    1.20 +class SkOperandInterpolator : public SkInterpolatorBase {
    1.21 +public:
    1.22 +    SkOperandInterpolator();
    1.23 +    SkOperandInterpolator(int elemCount, int frameCount, SkDisplayTypes type);
    1.24 +    SkOperand* getValues() { return fValues; }
    1.25 +    int getValuesCount() { return fFrameCount * fElemCount; }
    1.26 +    void    reset(int elemCount, int frameCount, SkDisplayTypes type);
    1.27 +
    1.28 +    /** Add or replace a key frame, copying the values[] data into the interpolator.
    1.29 +        @param index    The index of this frame (frames must be ordered by time)
    1.30 +        @param time The millisecond time for this frame
    1.31 +        @param values   The array of values [elemCount] for this frame. The data is copied
    1.32 +                        into the interpolator.
    1.33 +        @param blend    A positive scalar specifying how to blend between this and the next key frame.
    1.34 +                        [0...1) is a cubic lag/log/lag blend (slow to change at the beginning and end)
    1.35 +                        1 is a linear blend (default)
    1.36 +                        (1...inf) is a cubic log/lag/log blend (fast to change at the beginning and end)
    1.37 +    */
    1.38 +    bool    setKeyFrame(int index, SkMSec time, const SkOperand values[], SkScalar blend = SK_Scalar1);
    1.39 +    Result timeToValues(SkMSec time, SkOperand values[]) const;
    1.40 +    SkDEBUGCODE(static void UnitTest();)
    1.41 +private:
    1.42 +    SkDisplayTypes fType;
    1.43 +    SkOperand* fValues;     // pointer into fStorage
    1.44 +#ifdef SK_DEBUG
    1.45 +    SkOperand(* fValuesArray)[10];
    1.46 +#endif
    1.47 +    typedef SkInterpolatorBase INHERITED;
    1.48 +};
    1.49 +
    1.50 +#endif // SkOperandInterpolator_DEFINED

mercurial