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

Side by Side Diff: src/animator/SkAnimateMaker.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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
« no previous file with comments | « src/animator/SkAnimateField.cpp ('k') | src/animator/SkAnimateSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkAnimateMaker.h" 10 #include "SkAnimateMaker.h"
(...skipping 10 matching lines...) Expand all
21 #include "SkSystemEventTypes.h" 21 #include "SkSystemEventTypes.h"
22 #include "SkTime.h" 22 #include "SkTime.h"
23 23
24 class DefaultTimeline : public SkAnimator::Timeline { 24 class DefaultTimeline : public SkAnimator::Timeline {
25 virtual SkMSec getMSecs() const { 25 virtual SkMSec getMSecs() const {
26 return SkTime::GetMSecs(); 26 return SkTime::GetMSecs();
27 } 27 }
28 } gDefaultTimeline; 28 } gDefaultTimeline;
29 29
30 SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint) 30 SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint)
31 : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0), 31 : fActiveEvent(nullptr), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
32 fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fPare ntMaker(NULL), 32 fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fPare ntMaker(nullptr),
33 fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false), 33 fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false),
34 fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator) 34 fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator)
35 { 35 {
36 fScreenplay.time = 0; 36 fScreenplay.time = 0;
37 #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING 37 #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING
38 fDebugTimeBase = (SkMSec) -1; 38 fDebugTimeBase = (SkMSec) -1;
39 #endif 39 #endif
40 #ifdef SK_DUMP_ENABLED 40 #ifdef SK_DUMP_ENABLED
41 fDumpEvents = fDumpGConditions = fDumpPosts = false; 41 fDumpEvents = fDumpGConditions = fDumpPosts = false;
42 #endif 42 #endif
(...skipping 16 matching lines...) Expand all
59 59
60 void SkAnimateMaker::appendActive(SkActive* active) { 60 void SkAnimateMaker::appendActive(SkActive* active) {
61 fDisplayList.append(active); 61 fDisplayList.append(active);
62 } 62 }
63 63
64 void SkAnimateMaker::clearExtraPropertyCallBack(SkDisplayTypes type) { 64 void SkAnimateMaker::clearExtraPropertyCallBack(SkDisplayTypes type) {
65 SkExtras** end = fExtras.end(); 65 SkExtras** end = fExtras.end();
66 for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) { 66 for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) {
67 SkExtras* extra = *extraPtr; 67 SkExtras* extra = *extraPtr;
68 if (extra->definesType(type)) { 68 if (extra->definesType(type)) {
69 extra->fExtraCallBack = NULL; 69 extra->fExtraCallBack = nullptr;
70 extra->fExtraStorage = NULL; 70 extra->fExtraStorage = nullptr;
71 break; 71 break;
72 } 72 }
73 } 73 }
74 } 74 }
75 75
76 bool SkAnimateMaker::computeID(SkDisplayable* displayable, SkDisplayable* parent , SkString* newID) { 76 bool SkAnimateMaker::computeID(SkDisplayable* displayable, SkDisplayable* parent , SkString* newID) {
77 const char* script; 77 const char* script;
78 if (findKey(displayable, &script) == false) 78 if (findKey(displayable, &script) == false)
79 return true; 79 return true;
80 return SkAnimatorScript::EvaluateString(*this, displayable, parent, script, newID); 80 return SkAnimatorScript::EvaluateString(*this, displayable, parent, script, newID);
81 } 81 }
82 82
83 SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) { 83 SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) {
84 SkDisplayTypes type = SkDisplayType::GetType(this, name, len ); 84 SkDisplayTypes type = SkDisplayType::GetType(this, name, len );
85 if ((int)type >= 0) 85 if ((int)type >= 0)
86 return SkDisplayType::CreateInstance(this, type); 86 return SkDisplayType::CreateInstance(this, type);
87 return NULL; 87 return nullptr;
88 } 88 }
89 89
90 // differs from SkAnimator::decodeStream in that it does not reset error state 90 // differs from SkAnimator::decodeStream in that it does not reset error state
91 bool SkAnimateMaker::decodeStream(SkStream* stream) 91 bool SkAnimateMaker::decodeStream(SkStream* stream)
92 { 92 {
93 SkDisplayXMLParser parser(*this); 93 SkDisplayXMLParser parser(*this);
94 return parser.parse(*stream); 94 return parser.parse(*stream);
95 } 95 }
96 96
97 // differs from SkAnimator::decodeURI in that it does not set URI base 97 // differs from SkAnimator::decodeURI in that it does not set URI base
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 bool SkAnimateMaker::doEvent(const SkEvent& event) { 175 bool SkAnimateMaker::doEvent(const SkEvent& event) {
176 return (!fInMovie || fLoaded) && fAnimator->doEvent(event); 176 return (!fInMovie || fLoaded) && fAnimator->doEvent(event);
177 } 177 }
178 178
179 #ifdef SK_DUMP_ENABLED 179 #ifdef SK_DUMP_ENABLED
180 void SkAnimateMaker::dump(const char* match) { 180 void SkAnimateMaker::dump(const char* match) {
181 SkTDict<SkDisplayable*>::Iter iter(fIDs); 181 SkTDict<SkDisplayable*>::Iter iter(fIDs);
182 const char* name; 182 const char* name;
183 SkDisplayable* result; 183 SkDisplayable* result;
184 while ((name = iter.next(&result)) != NULL) { 184 while ((name = iter.next(&result)) != nullptr) {
185 if (strcmp(match,name) == 0) 185 if (strcmp(match,name) == 0)
186 result->dump(this); 186 result->dump(this);
187 } 187 }
188 } 188 }
189 #endif 189 #endif
190 190
191 int SkAnimateMaker::dynamicProperty(SkString& nameStr, SkDisplayable** displayab lePtr ) { 191 int SkAnimateMaker::dynamicProperty(SkString& nameStr, SkDisplayable** displayab lePtr ) {
192 const char* name = nameStr.c_str(); 192 const char* name = nameStr.c_str();
193 const char* dot = strchr(name, '.'); 193 const char* dot = strchr(name, '.');
194 SkASSERT(dot); 194 SkASSERT(dot);
(...skipping 11 matching lines...) Expand all
206 SkMSec SkAnimateMaker::getAppTime() const { 206 SkMSec SkAnimateMaker::getAppTime() const {
207 return fTimeline->getMSecs(); 207 return fTimeline->getMSecs();
208 } 208 }
209 209
210 #ifdef SK_DEBUG 210 #ifdef SK_DEBUG
211 SkAnimator* SkAnimateMaker::getRoot() 211 SkAnimator* SkAnimateMaker::getRoot()
212 { 212 {
213 SkAnimateMaker* maker = this; 213 SkAnimateMaker* maker = this;
214 while (maker->fParentMaker) 214 while (maker->fParentMaker)
215 maker = maker->fParentMaker; 215 maker = maker->fParentMaker;
216 return maker == this ? NULL : maker->fAnimator; 216 return maker == this ? nullptr : maker->fAnimator;
217 } 217 }
218 #endif 218 #endif
219 219
220 void SkAnimateMaker::helperAdd(SkDisplayable* trackMe) { 220 void SkAnimateMaker::helperAdd(SkDisplayable* trackMe) {
221 SkASSERT(fHelpers.find(trackMe) < 0); 221 SkASSERT(fHelpers.find(trackMe) < 0);
222 *fHelpers.append() = trackMe; 222 *fHelpers.append() = trackMe;
223 } 223 }
224 224
225 void SkAnimateMaker::helperRemove(SkDisplayable* alreadyTracked) { 225 void SkAnimateMaker::helperRemove(SkDisplayable* alreadyTracked) {
226 int helperIndex = fHelpers.find(alreadyTracked); 226 int helperIndex = fHelpers.find(alreadyTracked);
227 if (helperIndex >= 0) 227 if (helperIndex >= 0)
228 fHelpers.remove(helperIndex); 228 fHelpers.remove(helperIndex);
229 } 229 }
230 230
231 #if 0 231 #if 0
232 void SkAnimateMaker::loadMovies() { 232 void SkAnimateMaker::loadMovies() {
233 for (SkDisplayable** dispPtr = fMovies.begin(); dispPtr < fMovies.end(); dis pPtr++) { 233 for (SkDisplayable** dispPtr = fMovies.begin(); dispPtr < fMovies.end(); dis pPtr++) {
234 SkDisplayable* displayable = *dispPtr; 234 SkDisplayable* displayable = *dispPtr;
235 SkASSERT(displayable->getType() == SkType_Movie); 235 SkASSERT(displayable->getType() == SkType_Movie);
236 SkDisplayMovie* movie = (SkDisplayMovie*) displayable; 236 SkDisplayMovie* movie = (SkDisplayMovie*) displayable;
237 SkAnimateMaker* movieMaker = movie->fMovie.fMaker; 237 SkAnimateMaker* movieMaker = movie->fMovie.fMaker;
238 movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL); 238 movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, nullpt r);
239 movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL); 239 movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr);
240 movieMaker->loadMovies(); 240 movieMaker->loadMovies();
241 } 241 }
242 } 242 }
243 #endif 243 #endif
244 244
245 void SkAnimateMaker::notifyInval() { 245 void SkAnimateMaker::notifyInval() {
246 if (fHostEventSinkID) 246 if (fHostEventSinkID)
247 fAnimator->onEventPost(new SkEvent(SK_EventType_Inval), fHostEventSinkID ); 247 fAnimator->onEventPost(new SkEvent(SK_EventType_Inval), fHostEventSinkID );
248 } 248 }
249 249
(...skipping 14 matching lines...) Expand all
264 void SkAnimateMaker::reset() { 264 void SkAnimateMaker::reset() {
265 deleteMembers(); 265 deleteMembers();
266 fChildren.reset(); 266 fChildren.reset();
267 fHelpers.reset(); 267 fHelpers.reset();
268 fIDs.reset(); 268 fIDs.reset();
269 fEvents.reset(); 269 fEvents.reset();
270 fDisplayList.hardReset(); 270 fDisplayList.hardReset();
271 } 271 }
272 272
273 void SkAnimateMaker::removeActive(SkActive* active) { 273 void SkAnimateMaker::removeActive(SkActive* active) {
274 if (active == NULL) 274 if (active == nullptr)
275 return; 275 return;
276 fDisplayList.remove(active); 276 fDisplayList.remove(active);
277 } 277 }
278 278
279 bool SkAnimateMaker::resolveID(SkDisplayable* displayable, SkDisplayable* origin al) { 279 bool SkAnimateMaker::resolveID(SkDisplayable* displayable, SkDisplayable* origin al) {
280 SkString newID; 280 SkString newID;
281 bool success = computeID(original, NULL, &newID); 281 bool success = computeID(original, nullptr, &newID);
282 if (success) 282 if (success)
283 setID(displayable, newID); 283 setID(displayable, newID);
284 return success; 284 return success;
285 } 285 }
286 286
287 void SkAnimateMaker::setErrorString() { 287 void SkAnimateMaker::setErrorString() {
288 fErrorString.reset(); 288 fErrorString.reset();
289 if (fError.hasError()) { 289 if (fError.hasError()) {
290 SkString err; 290 SkString err;
291 if (fFileName.size() > 0) 291 if (fFileName.size() > 0)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 bool SkAnimateMaker::GetStep(const char* token, size_t len, void* stepPtr, SkScr iptValue* value) { 365 bool SkAnimateMaker::GetStep(const char* token, size_t len, void* stepPtr, SkScr iptValue* value) {
366 if (SK_LITERAL_STR_EQUAL("step", token, len)) { 366 if (SK_LITERAL_STR_EQUAL("step", token, len)) {
367 value->fOperand.fS32 = *(int32_t*) stepPtr; 367 value->fOperand.fS32 = *(int32_t*) stepPtr;
368 value->fType = SkType_Int; 368 value->fType = SkType_Int;
369 return true; 369 return true;
370 } 370 }
371 return false; 371 return false;
372 } 372 }
OLDNEW
« no previous file with comments | « src/animator/SkAnimateField.cpp ('k') | src/animator/SkAnimateSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698