1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkOperand_DEFINED
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkOperand_DEFINED
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayType.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkTypedArray;
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkDisplayable;
17986ca61cf7be3ec590f8820e9b7ba042ac2948fereedclass SkADrawable;
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkString;
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comunion SkOperand {
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//  SkOperand() {}
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//  SkOperand(SkScalar scalar) : fScalar(scalar) {}
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTypedArray* fArray;
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayable* fDisplayable;
25986ca61cf7be3ec590f8820e9b7ba042ac2948fereed    SkADrawable* fDrawable;
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void* fObject;
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int32_t fS32;
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec fMSec;
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar fScalar;
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString* fString;
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct SkScriptValue {
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkOperand fOperand;
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayTypes fType;
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTypedArray* getArray() { SkASSERT(fType == SkType_Array); return fOperand.fArray; }
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayable* getDisplayable() { SkASSERT(fType == SkType_Displayable); return fOperand.fDisplayable; }
38986ca61cf7be3ec590f8820e9b7ba042ac2948fereed    SkADrawable* getDrawable() { SkASSERT(fType == SkType_Drawable); return fOperand.fDrawable; }
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int32_t getS32(SkAnimateMaker* maker) { SkASSERT(fType == SkType_Int || fType == SkType_Boolean ||
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayType::IsEnum(maker, fType)); return fOperand.fS32; }
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec getMSec() { SkASSERT(fType == SkType_MSec); return fOperand.fMSec; }
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar getScalar() { SkASSERT(fType == SkType_Float); return fOperand.fScalar; }
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString* getString() { SkASSERT(fType == SkType_String); return fOperand.fString; }
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SkOperand_DEFINED
47