• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
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 
9 
10 #include "SkPostParts.h"
11 #include "SkDisplayPost.h"
12 
13 #if SK_USE_CONDENSED_INFO == 0
14 
15 const SkMemberInfo SkDataInput::fInfo[] = {
16     SK_MEMBER_INHERITED
17 };
18 
19 #endif
20 
21 DEFINE_GET_MEMBER(SkDataInput);
22 
SkDataInput()23 SkDataInput::SkDataInput() : fParent(nullptr) {}
24 
add()25 bool SkDataInput::add() {
26     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);
32     else if (string.size() > 0)
33         fParent->fEvent.setString(dataName, string);
34 //  else
35 //      SkASSERT(0);
36     return false;
37 }
38 
dirty()39 void SkDataInput::dirty() {
40     fParent->dirty();
41 }
42 
getParent() const43 SkDisplayable* SkDataInput::getParent() const {
44     return fParent;
45 }
46 
setParent(SkDisplayable * displayable)47 bool SkDataInput::setParent(SkDisplayable* displayable) {
48     if (displayable->isPost() == false)
49         return true;
50     fParent = (SkPost*) displayable;
51     return false;
52 }
53 
onEndElement(SkAnimateMaker &)54 void SkDataInput::onEndElement(SkAnimateMaker&) {
55     add();
56 }
57