blob: 01eb23c0f040f48dbaedbf798eb9148d4c751b8d [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/* libs/graphics/animator/SkPostParts.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 "SkPostParts.h"
19#include "SkDisplayPost.h"
20
21#if SK_USE_CONDENSED_INFO == 0
22
reed@google.com8d0b5772011-06-24 13:07:31 +000023const SkMemberInfo SkDataInput::fInfo[] = {
reed@android.com8a1c16f2008-12-17 15:59:43 +000024 SK_MEMBER_INHERITED
25};
26
27#endif
28
reed@google.com8d0b5772011-06-24 13:07:31 +000029DEFINE_GET_MEMBER(SkDataInput);
reed@android.com8a1c16f2008-12-17 15:59:43 +000030
reed@google.com8d0b5772011-06-24 13:07:31 +000031SkDataInput::SkDataInput() : fParent(NULL) {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000032
reed@google.com8d0b5772011-06-24 13:07:31 +000033bool SkDataInput::add() {
reed@android.com8a1c16f2008-12-17 15:59:43 +000034 SkASSERT(name.size() > 0);
35 const char* dataName = name.c_str();
36 if (fInt != (int) SK_NaN32)
37 fParent->fEvent.setS32(dataName, fInt);
38 else if (SkScalarIsNaN(fFloat) == false)
39 fParent->fEvent.setScalar(dataName, fFloat);
40 else if (string.size() > 0)
41 fParent->fEvent.setString(dataName, string);
42// else
43// SkASSERT(0);
44 return false;
45}
46
reed@google.com8d0b5772011-06-24 13:07:31 +000047void SkDataInput::dirty() {
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 fParent->dirty();
49}
50
reed@google.com8d0b5772011-06-24 13:07:31 +000051SkDisplayable* SkDataInput::getParent() const {
reed@android.com8a1c16f2008-12-17 15:59:43 +000052 return fParent;
53}
54
reed@google.com8d0b5772011-06-24 13:07:31 +000055bool SkDataInput::setParent(SkDisplayable* displayable) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000056 if (displayable->isPost() == false)
57 return true;
58 fParent = (SkPost*) displayable;
59 return false;
60}
61
reed@google.com8d0b5772011-06-24 13:07:31 +000062void SkDataInput::onEndElement(SkAnimateMaker&) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000063 add();
64}
65