blob: 7c0931eaa0785108751aa07738660d5b76ee0e5f [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkPostParts.h"
11#include "SkDisplayPost.h"
12
13#if SK_USE_CONDENSED_INFO == 0
14
reed@google.com8d0b5772011-06-24 13:07:31 +000015const SkMemberInfo SkDataInput::fInfo[] = {
reed@android.com8a1c16f2008-12-17 15:59:43 +000016 SK_MEMBER_INHERITED
17};
18
19#endif
20
reed@google.com8d0b5772011-06-24 13:07:31 +000021DEFINE_GET_MEMBER(SkDataInput);
reed@android.com8a1c16f2008-12-17 15:59:43 +000022
reed@google.com8d0b5772011-06-24 13:07:31 +000023SkDataInput::SkDataInput() : fParent(NULL) {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000024
reed@google.com8d0b5772011-06-24 13:07:31 +000025bool SkDataInput::add() {
reed@android.com8a1c16f2008-12-17 15:59:43 +000026 SkASSERT(name.size() > 0);
27 const char* dataName = name.c_str();
28 if (fInt != (int) SK_NaN32)
29 fParent->fEvent.setS32(dataName, fInt);
30 else if (SkScalarIsNaN(fFloat) == false)
31 fParent->fEvent.setScalar(dataName, fFloat);
rmistry@google.comd6176b02012-08-23 18:14:13 +000032 else if (string.size() > 0)
reed@android.com8a1c16f2008-12-17 15:59:43 +000033 fParent->fEvent.setString(dataName, string);
34// else
35// SkASSERT(0);
36 return false;
37}
38
reed@google.com8d0b5772011-06-24 13:07:31 +000039void SkDataInput::dirty() {
reed@android.com8a1c16f2008-12-17 15:59:43 +000040 fParent->dirty();
41}
42
reed@google.com8d0b5772011-06-24 13:07:31 +000043SkDisplayable* SkDataInput::getParent() const {
reed@android.com8a1c16f2008-12-17 15:59:43 +000044 return fParent;
45}
46
reed@google.com8d0b5772011-06-24 13:07:31 +000047bool SkDataInput::setParent(SkDisplayable* displayable) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 if (displayable->isPost() == false)
49 return true;
50 fParent = (SkPost*) displayable;
51 return false;
52}
53
reed@google.com8d0b5772011-06-24 13:07:31 +000054void SkDataInput::onEndElement(SkAnimateMaker&) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000055 add();
56}