1/* libs/graphics/animator/SkDisplayInput.cpp 2** 3** Copyright 2006, The Android Open Source Project 4** 5** Licensed under the Apache License, Version 2.0 (the "License"); 6** you may not use this file except in compliance with the License. 7** You may obtain a copy of the License at 8** 9** http://www.apache.org/licenses/LICENSE-2.0 10** 11** Unless required by applicable law or agreed to in writing, software 12** distributed under the License is distributed on an "AS IS" BASIS, 13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14** See the License for the specific language governing permissions and 15** limitations under the License. 16*/ 17 18#include "SkDisplayInput.h" 19 20enum SkInput_Properties { 21 SK_PROPERTY(initialized) 22}; 23 24#if SK_USE_CONDENSED_INFO == 0 25 26const SkMemberInfo SkInput::fInfo[] = { 27 SK_MEMBER_ALIAS(float, fFloat, Float), 28 SK_MEMBER_PROPERTY(initialized, Boolean), 29 SK_MEMBER_ALIAS(int, fInt, Int), 30 SK_MEMBER(name, String), 31 SK_MEMBER(string, String) 32}; 33 34#endif 35 36DEFINE_GET_MEMBER(SkInput); 37 38SkInput::SkInput() : fInt((int) SK_NaN32), fFloat(SK_ScalarNaN) {} 39 40SkDisplayable* SkInput::contains(const SkString& string) { 41 return string.equals(name) ? this : NULL; 42} 43 44bool SkInput::enable(SkAnimateMaker & ) { 45 return true; 46} 47 48bool SkInput::getProperty(int index, SkScriptValue* value) const { 49 switch (index) { 50 case SK_PROPERTY(initialized): 51 value->fType = SkType_Boolean; 52 value->fOperand.fS32 = fInt != (int) SK_NaN32 || 53 SkScalarIsNaN(fFloat) == false || string.size() > 0; 54 break; 55 default: 56 return false; 57 } 58 return true; 59} 60 61bool SkInput::hasEnable() const { 62 return true; 63} 64