gfx/skia/trunk/src/animator/SkDisplayInput.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkDisplayInput.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     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 +#include "SkDisplayInput.h"
    1.14 +
    1.15 +enum SkInput_Properties {
    1.16 +    SK_PROPERTY(initialized)
    1.17 +};
    1.18 +
    1.19 +#if SK_USE_CONDENSED_INFO == 0
    1.20 +
    1.21 +const SkMemberInfo SkInput::fInfo[] = {
    1.22 +    SK_MEMBER_ALIAS(float, fFloat, Float),
    1.23 +    SK_MEMBER_PROPERTY(initialized, Boolean),
    1.24 +    SK_MEMBER_ALIAS(int, fInt, Int),
    1.25 +    SK_MEMBER(name, String),
    1.26 +    SK_MEMBER(string, String)
    1.27 +};
    1.28 +
    1.29 +#endif
    1.30 +
    1.31 +DEFINE_GET_MEMBER(SkInput);
    1.32 +
    1.33 +SkInput::SkInput() : fInt((int) SK_NaN32), fFloat(SK_ScalarNaN) {}
    1.34 +
    1.35 +SkDisplayable* SkInput::contains(const SkString& string) {
    1.36 +    return string.equals(name) ? this : NULL;
    1.37 +}
    1.38 +
    1.39 +bool SkInput::enable(SkAnimateMaker & ) {
    1.40 +    return true;
    1.41 +}
    1.42 +
    1.43 +bool SkInput::getProperty(int index, SkScriptValue* value) const {
    1.44 +    switch (index) {
    1.45 +        case SK_PROPERTY(initialized):
    1.46 +            value->fType = SkType_Boolean;
    1.47 +            value->fOperand.fS32 = fInt != (int) SK_NaN32 ||
    1.48 +                SkScalarIsNaN(fFloat) == false || string.size() > 0;
    1.49 +            break;
    1.50 +        default:
    1.51 +            return false;
    1.52 +    }
    1.53 +    return true;
    1.54 +}
    1.55 +
    1.56 +bool SkInput::hasEnable() const {
    1.57 +    return true;
    1.58 +}

mercurial