michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #include "SkPostParts.h" michael@0: #include "SkDisplayPost.h" michael@0: michael@0: #if SK_USE_CONDENSED_INFO == 0 michael@0: michael@0: const SkMemberInfo SkDataInput::fInfo[] = { michael@0: SK_MEMBER_INHERITED michael@0: }; michael@0: michael@0: #endif michael@0: michael@0: DEFINE_GET_MEMBER(SkDataInput); michael@0: michael@0: SkDataInput::SkDataInput() : fParent(NULL) {} michael@0: michael@0: bool SkDataInput::add() { michael@0: SkASSERT(name.size() > 0); michael@0: const char* dataName = name.c_str(); michael@0: if (fInt != (int) SK_NaN32) michael@0: fParent->fEvent.setS32(dataName, fInt); michael@0: else if (SkScalarIsNaN(fFloat) == false) michael@0: fParent->fEvent.setScalar(dataName, fFloat); michael@0: else if (string.size() > 0) michael@0: fParent->fEvent.setString(dataName, string); michael@0: // else michael@0: // SkASSERT(0); michael@0: return false; michael@0: } michael@0: michael@0: void SkDataInput::dirty() { michael@0: fParent->dirty(); michael@0: } michael@0: michael@0: SkDisplayable* SkDataInput::getParent() const { michael@0: return fParent; michael@0: } michael@0: michael@0: bool SkDataInput::setParent(SkDisplayable* displayable) { michael@0: if (displayable->isPost() == false) michael@0: return true; michael@0: fParent = (SkPost*) displayable; michael@0: return false; michael@0: } michael@0: michael@0: void SkDataInput::onEndElement(SkAnimateMaker&) { michael@0: add(); michael@0: }