Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #include "SkDisplayInput.h" |
michael@0 | 11 | |
michael@0 | 12 | enum SkInput_Properties { |
michael@0 | 13 | SK_PROPERTY(initialized) |
michael@0 | 14 | }; |
michael@0 | 15 | |
michael@0 | 16 | #if SK_USE_CONDENSED_INFO == 0 |
michael@0 | 17 | |
michael@0 | 18 | const SkMemberInfo SkInput::fInfo[] = { |
michael@0 | 19 | SK_MEMBER_ALIAS(float, fFloat, Float), |
michael@0 | 20 | SK_MEMBER_PROPERTY(initialized, Boolean), |
michael@0 | 21 | SK_MEMBER_ALIAS(int, fInt, Int), |
michael@0 | 22 | SK_MEMBER(name, String), |
michael@0 | 23 | SK_MEMBER(string, String) |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | #endif |
michael@0 | 27 | |
michael@0 | 28 | DEFINE_GET_MEMBER(SkInput); |
michael@0 | 29 | |
michael@0 | 30 | SkInput::SkInput() : fInt((int) SK_NaN32), fFloat(SK_ScalarNaN) {} |
michael@0 | 31 | |
michael@0 | 32 | SkDisplayable* SkInput::contains(const SkString& string) { |
michael@0 | 33 | return string.equals(name) ? this : NULL; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | bool SkInput::enable(SkAnimateMaker & ) { |
michael@0 | 37 | return true; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | bool SkInput::getProperty(int index, SkScriptValue* value) const { |
michael@0 | 41 | switch (index) { |
michael@0 | 42 | case SK_PROPERTY(initialized): |
michael@0 | 43 | value->fType = SkType_Boolean; |
michael@0 | 44 | value->fOperand.fS32 = fInt != (int) SK_NaN32 || |
michael@0 | 45 | SkScalarIsNaN(fFloat) == false || string.size() > 0; |
michael@0 | 46 | break; |
michael@0 | 47 | default: |
michael@0 | 48 | return false; |
michael@0 | 49 | } |
michael@0 | 50 | return true; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | bool SkInput::hasEnable() const { |
michael@0 | 54 | return true; |
michael@0 | 55 | } |