michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef SkOperandInterpolator_DEFINED michael@0: #define SkOperandInterpolator_DEFINED michael@0: michael@0: #include "SkDisplayType.h" michael@0: #include "SkInterpolator.h" michael@0: #include "SkOperand.h" michael@0: michael@0: class SkOperandInterpolator : public SkInterpolatorBase { michael@0: public: michael@0: SkOperandInterpolator(); michael@0: SkOperandInterpolator(int elemCount, int frameCount, SkDisplayTypes type); michael@0: SkOperand* getValues() { return fValues; } michael@0: int getValuesCount() { return fFrameCount * fElemCount; } michael@0: void reset(int elemCount, int frameCount, SkDisplayTypes type); michael@0: michael@0: /** Add or replace a key frame, copying the values[] data into the interpolator. michael@0: @param index The index of this frame (frames must be ordered by time) michael@0: @param time The millisecond time for this frame michael@0: @param values The array of values [elemCount] for this frame. The data is copied michael@0: into the interpolator. michael@0: @param blend A positive scalar specifying how to blend between this and the next key frame. michael@0: [0...1) is a cubic lag/log/lag blend (slow to change at the beginning and end) michael@0: 1 is a linear blend (default) michael@0: (1...inf) is a cubic log/lag/log blend (fast to change at the beginning and end) michael@0: */ michael@0: bool setKeyFrame(int index, SkMSec time, const SkOperand values[], SkScalar blend = SK_Scalar1); michael@0: Result timeToValues(SkMSec time, SkOperand values[]) const; michael@0: SkDEBUGCODE(static void UnitTest();) michael@0: private: michael@0: SkDisplayTypes fType; michael@0: SkOperand* fValues; // pointer into fStorage michael@0: #ifdef SK_DEBUG michael@0: SkOperand(* fValuesArray)[10]; michael@0: #endif michael@0: typedef SkInterpolatorBase INHERITED; michael@0: }; michael@0: michael@0: #endif // SkOperandInterpolator_DEFINED