OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkDump.h" | 10 #include "SkDump.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if ((hasAttr |= (eventList > 0)) == true) | 49 if ((hasAttr |= (eventList > 0)) == true) |
50 maker.fEvents.dump(maker); | 50 maker.fEvents.dump(maker); |
51 if ((hasAttr |= (name.size() > 0)) == true) | 51 if ((hasAttr |= (name.size() > 0)) == true) |
52 maker.dump(name.c_str()); | 52 maker.dump(name.c_str()); |
53 if (displayList > 0 || (displayList != 0 && hasAttr == false)) | 53 if (displayList > 0 || (displayList != 0 && hasAttr == false)) |
54 maker.fDisplayList.dump(&maker); | 54 maker.fDisplayList.dump(&maker); |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 bool SkDump::evaluate(SkAnimateMaker &maker) { | 58 bool SkDump::evaluate(SkAnimateMaker &maker) { |
59 SkAnimatorScript scriptEngine(maker, NULL, SkType_Int); | 59 SkAnimatorScript scriptEngine(maker, nullptr, SkType_Int); |
60 SkScriptValue value; | 60 SkScriptValue value; |
61 const char* cScript = script.c_str(); | 61 const char* cScript = script.c_str(); |
62 bool success = scriptEngine.evaluateScript(&cScript, &value); | 62 bool success = scriptEngine.evaluateScript(&cScript, &value); |
63 SkDebugf("%*s<dump script=\"%s\" answer=\" ", SkDisplayList::fIndent, "", sc
ript.c_str()); | 63 SkDebugf("%*s<dump script=\"%s\" answer=\" ", SkDisplayList::fIndent, "", sc
ript.c_str()); |
64 if (success == false) { | 64 if (success == false) { |
65 SkDebugf("INVALID\" />\n"); | 65 SkDebugf("INVALID\" />\n"); |
66 return false; | 66 return false; |
67 } | 67 } |
68 switch (value.fType) { | 68 switch (value.fType) { |
69 case SkType_Float: | 69 case SkType_Float: |
(...skipping 14 matching lines...) Expand all Loading... |
84 bool SkDump::hasEnable() const { | 84 bool SkDump::hasEnable() const { |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) { | 88 void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) { |
89 int badEnum = index; | 89 int badEnum = index; |
90 const SkDisplayEnumMap& map = SkAnimatorScript::GetEnumValues(type); | 90 const SkDisplayEnumMap& map = SkAnimatorScript::GetEnumValues(type); |
91 const char* str = map.fValues; | 91 const char* str = map.fValues; |
92 while (--index >= 0) { | 92 while (--index >= 0) { |
93 str = strchr(str, '|'); | 93 str = strchr(str, '|'); |
94 if (str == NULL) { | 94 if (str == nullptr) { |
95 result->reset(); | 95 result->reset(); |
96 result->appendS32(badEnum); | 96 result->appendS32(badEnum); |
97 return; | 97 return; |
98 } | 98 } |
99 str += 1; | 99 str += 1; |
100 } | 100 } |
101 const char* end = strchr(str, '|'); | 101 const char* end = strchr(str, '|'); |
102 if (end == NULL) | 102 if (end == nullptr) |
103 end = str + strlen(str); | 103 end = str + strlen(str); |
104 result->set(str, end - str); | 104 result->set(str, end - str); |
105 } | 105 } |
106 | 106 |
107 #else | 107 #else |
108 | 108 |
109 // in the release version, <dump> is allowed, and its attributes are defined, bu
t | 109 // in the release version, <dump> is allowed, and its attributes are defined, bu
t |
110 // are not stored and have no effect | 110 // are not stored and have no effect |
111 | 111 |
112 #if SK_USE_CONDENSED_INFO == 0 | 112 #if SK_USE_CONDENSED_INFO == 0 |
(...skipping 28 matching lines...) Expand all Loading... |
141 | 141 |
142 bool SkDump::hasEnable() const { | 142 bool SkDump::hasEnable() const { |
143 return true; | 143 return true; |
144 } | 144 } |
145 | 145 |
146 bool SkDump::setProperty(int index, SkScriptValue&) { | 146 bool SkDump::setProperty(int index, SkScriptValue&) { |
147 return index <= SK_PROPERTY(posts); | 147 return index <= SK_PROPERTY(posts); |
148 } | 148 } |
149 | 149 |
150 #endif | 150 #endif |
OLD | NEW |