Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: skia/animator/SkDump.cpp

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/animator/SkDump.h ('k') | skia/animator/SkExtraPathEffects.xsd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* libs/graphics/animator/SkDump.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 "SkDump.h"
19
20 #ifdef SK_DUMP_ENABLED
21
22 #include "SkAnimateMaker.h"
23 #include "SkAnimatorScript.h"
24 #include "SkDisplayEvents.h"
25 #include "SkDisplayList.h"
26 #include "SkString.h"
27
28 #if SK_USE_CONDENSED_INFO == 0
29
30 const SkMemberInfo SkDump::fInfo[] = {
31 SK_MEMBER(displayList, Boolean),
32 SK_MEMBER(eventList, Boolean),
33 SK_MEMBER(events, Boolean),
34 SK_MEMBER(groups, Boolean),
35 SK_MEMBER(name, String),
36 SK_MEMBER(posts, Boolean),
37 SK_MEMBER(script, String)
38 };
39
40 #endif
41
42 DEFINE_GET_MEMBER(SkDump);
43
44 SkDump::SkDump() : displayList(-1), eventList(-1), events(-1), groups(-1), posts (-1) {
45 }
46
47 bool SkDump::enable(SkAnimateMaker& maker ) {
48 if (script.size() > 0)
49 return evaluate(maker);
50 bool hasAttr = false;
51 if (events > 0)
52 hasAttr |= maker.fDumpEvents = true;
53 if (posts > 0)
54 hasAttr |= maker.fDumpPosts = true;
55 if (groups > 0)
56 hasAttr |= maker.fDumpGConditions = true;
57 if ((hasAttr |= (eventList > 0)) == true)
58 maker.fEvents.dump(maker);
59 if ((hasAttr |= (name.size() > 0)) == true)
60 maker.dump(name.c_str());
61 if (displayList > 0 || displayList != 0 && hasAttr == false)
62 maker.fDisplayList.dump(&maker);
63 return true;
64 }
65
66 bool SkDump::evaluate(SkAnimateMaker &maker) {
67 SkAnimatorScript scriptEngine(maker, NULL, SkType_Int);
68 SkScriptValue value;
69 const char* cScript = script.c_str();
70 bool success = scriptEngine.evaluateScript(&cScript, &value);
71 SkDebugf("%*s<dump script=\"%s\" answer=\" ", SkDisplayList::fIndent, "", sc ript.c_str());
72 if (success == false) {
73 SkDebugf("INVALID\" />\n");
74 return false;
75 }
76 switch (value.fType) {
77 case SkType_Float:
78 SkDebugf("%g\" />\n", SkScalarToFloat(value.fOperand.fScalar));
79 break;
80 case SkType_Int:
81 SkDebugf("%d\" />\n", value.fOperand.fS32);
82 break;
83 case SkType_String:
84 SkDebugf("%s\" />\n", value.fOperand.fString->c_str());
85 break;
86 default:
87 return false;
88 }
89 return true;
90 }
91
92 bool SkDump::hasEnable() const {
93 return true;
94 }
95
96 void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) {
97 int badEnum = index;
98 const SkDisplayEnumMap& map = SkAnimatorScript::GetEnumValues(type);
99 const char* str = map.fValues;
100 while (--index >= 0) {
101 str = strchr(str, '|');
102 if (str == NULL) {
103 result->reset();
104 result->appendS32(badEnum);
105 return;
106 }
107 str += 1;
108 }
109 const char* end = strchr(str, '|');
110 if (end == NULL)
111 end = str + strlen(str);
112 result->set(str, end - str);
113 }
114
115 #else
116
117 // in the release version, <dump> is allowed, and its attributes are defined, bu t
118 // are not stored and have no effect
119
120 #if SK_USE_CONDENSED_INFO == 0
121
122 enum SkDump_Properties {
123 SK_PROPERTY(displayList),
124 SK_PROPERTY(eventList),
125 SK_PROPERTY(events),
126 SK_PROPERTY(groups),
127 SK_PROPERTY(name),
128 SK_PROPERTY(posts),
129 SK_PROPERTY(script)
130 };
131
132 const SkMemberInfo SkDump::fInfo[] = {
133 SK_MEMBER_PROPERTY(displayList, Boolean),
134 SK_MEMBER_PROPERTY(eventList, Boolean),
135 SK_MEMBER_PROPERTY(events, Boolean),
136 SK_MEMBER_PROPERTY(groups, Boolean),
137 SK_MEMBER_PROPERTY(name, String),
138 SK_MEMBER_PROPERTY(posts, Boolean),
139 SK_MEMBER_PROPERTY(script, String)
140 };
141
142 #endif
143
144 DEFINE_GET_MEMBER(SkDump);
145
146 bool SkDump::enable(SkAnimateMaker& maker ) {
147 return true;
148 }
149
150 bool SkDump::hasEnable() const {
151 return true;
152 }
153
154 bool SkDump::setProperty(int index, SkScriptValue& ) {
155 return index <= SK_PROPERTY(posts);
156 }
157
158 #endif
OLDNEW
« no previous file with comments | « skia/animator/SkDump.h ('k') | skia/animator/SkExtraPathEffects.xsd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698