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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkOperand.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     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 SkOperand_DEFINED
    1.14 +#define SkOperand_DEFINED
    1.15 +
    1.16 +#include "SkDisplayType.h"
    1.17 +
    1.18 +class SkTypedArray;
    1.19 +class SkDisplayable;
    1.20 +class SkDrawable;
    1.21 +class SkString;
    1.22 +
    1.23 +union SkOperand {
    1.24 +//  SkOperand() {}
    1.25 +//  SkOperand(SkScalar scalar) : fScalar(scalar) {}
    1.26 +    SkTypedArray* fArray;
    1.27 +    SkDisplayable* fDisplayable;
    1.28 +    SkDrawable* fDrawable;
    1.29 +    void* fObject;
    1.30 +    int32_t fS32;
    1.31 +    SkMSec fMSec;
    1.32 +    SkScalar fScalar;
    1.33 +    SkString* fString;
    1.34 +};
    1.35 +
    1.36 +struct SkScriptValue {
    1.37 +    SkOperand fOperand;
    1.38 +    SkDisplayTypes fType;
    1.39 +    SkTypedArray* getArray() { SkASSERT(fType == SkType_Array); return fOperand.fArray; }
    1.40 +    SkDisplayable* getDisplayable() { SkASSERT(fType == SkType_Displayable); return fOperand.fDisplayable; }
    1.41 +    SkDrawable* getDrawable() { SkASSERT(fType == SkType_Drawable); return fOperand.fDrawable; }
    1.42 +    int32_t getS32(SkAnimateMaker* maker) { SkASSERT(fType == SkType_Int || fType == SkType_Boolean ||
    1.43 +        SkDisplayType::IsEnum(maker, fType)); return fOperand.fS32; }
    1.44 +    SkMSec getMSec() { SkASSERT(fType == SkType_MSec); return fOperand.fMSec; }
    1.45 +    SkScalar getScalar() { SkASSERT(fType == SkType_Float); return fOperand.fScalar; }
    1.46 +    SkString* getString() { SkASSERT(fType == SkType_String); return fOperand.fString; }
    1.47 +};
    1.48 +
    1.49 +#endif // SkOperand_DEFINED

mercurial