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

Side by Side Diff: src/animator/SkDisplayable.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/SkDisplayXMLParser.cpp ('k') | src/animator/SkDraw3D.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 "SkDisplayable.h" 10 #include "SkDisplayable.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 void SkDisplayable::clearBounder() { 59 void SkDisplayable::clearBounder() {
60 } 60 }
61 61
62 bool SkDisplayable::contains(SkDisplayable* ) { 62 bool SkDisplayable::contains(SkDisplayable* ) {
63 return false; 63 return false;
64 } 64 }
65 65
66 SkDisplayable* SkDisplayable::contains(const SkString& ) { 66 SkDisplayable* SkDisplayable::contains(const SkString& ) {
67 return NULL; 67 return nullptr;
68 } 68 }
69 69
70 SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { 70 SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) {
71 SkDisplayTypes type = getType(); 71 SkDisplayTypes type = getType();
72 if (type == SkType_Unknown) { 72 if (type == SkType_Unknown) {
73 SkASSERT(0); 73 SkASSERT(0);
74 return NULL; 74 return nullptr;
75 } 75 }
76 SkDisplayable* copy = SkDisplayType::CreateInstance(maker, type); 76 SkDisplayable* copy = SkDisplayType::CreateInstance(maker, type);
77 int index = -1; 77 int index = -1;
78 int propIndex = 0; 78 int propIndex = 0;
79 const SkMemberInfo* info; 79 const SkMemberInfo* info;
80 do { 80 do {
81 info = copy->getMember(++index); 81 info = copy->getMember(++index);
82 if (info == NULL) 82 if (info == nullptr)
83 break; 83 break;
84 if (info->fType == SkType_MemberProperty) { 84 if (info->fType == SkType_MemberProperty) {
85 SkScriptValue value; 85 SkScriptValue value;
86 if (getProperty(propIndex, &value)) 86 if (getProperty(propIndex, &value))
87 copy->setProperty(propIndex, value); 87 copy->setProperty(propIndex, value);
88 propIndex++; 88 propIndex++;
89 continue; 89 continue;
90 } 90 }
91 if (info->fType == SkType_MemberFunction) 91 if (info->fType == SkType_MemberFunction)
92 continue; 92 continue;
93 if (info->fType == SkType_Array) { 93 if (info->fType == SkType_Array) {
94 SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this) ; 94 SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this) ;
95 int arrayCount; 95 int arrayCount;
96 if (array == NULL || (arrayCount = array->count()) == 0) 96 if (array == nullptr || (arrayCount = array->count()) == 0)
97 continue; 97 continue;
98 SkTDOperandArray* copyArray = (SkTDOperandArray*) info->memberData(c opy); 98 SkTDOperandArray* copyArray = (SkTDOperandArray*) info->memberData(c opy);
99 copyArray->setCount(arrayCount); 99 copyArray->setCount(arrayCount);
100 SkDisplayTypes elementType; 100 SkDisplayTypes elementType;
101 if (type == SkType_Array) { 101 if (type == SkType_Array) {
102 SkDisplayArray* dispArray = (SkDisplayArray*) this; 102 SkDisplayArray* dispArray = (SkDisplayArray*) this;
103 elementType = dispArray->values.getType(); 103 elementType = dispArray->values.getType();
104 } else 104 } else
105 elementType = info->arrayType(); 105 elementType = info->arrayType();
106 size_t elementSize = SkMemberInfo::GetSize(elementType); 106 size_t elementSize = SkMemberInfo::GetSize(elementType);
107 size_t byteSize = elementSize * arrayCount; 107 size_t byteSize = elementSize * arrayCount;
108 memcpy(copyArray->begin(), array->begin(), byteSize); 108 memcpy(copyArray->begin(), array->begin(), byteSize);
109 continue; 109 continue;
110 } 110 }
111 if (SkDisplayType::IsDisplayable(maker, info->fType)) { 111 if (SkDisplayType::IsDisplayable(maker, info->fType)) {
112 SkDisplayable** displayable = (SkDisplayable**) info->memberData(thi s); 112 SkDisplayable** displayable = (SkDisplayable**) info->memberData(thi s);
113 if (*displayable == NULL || *displayable == (SkDisplayable*) -1) 113 if (*displayable == nullptr || *displayable == (SkDisplayable*) -1)
114 continue; 114 continue;
115 SkDisplayable* deeper = (*displayable)->deepCopy(maker); 115 SkDisplayable* deeper = (*displayable)->deepCopy(maker);
116 info->setMemberData(copy, deeper, sizeof(deeper)); 116 info->setMemberData(copy, deeper, sizeof(deeper));
117 continue; 117 continue;
118 } 118 }
119 if (info->fType == SkType_String || info->fType == SkType_DynamicString) { 119 if (info->fType == SkType_String || info->fType == SkType_DynamicString) {
120 SkString* string; 120 SkString* string;
121 info->getString(this, &string); 121 info->getString(this, &string);
122 info->setString(copy, string); 122 info->setString(copy, string);
123 continue; 123 continue;
(...skipping 29 matching lines...) Expand all
153 int index = -1; 153 int index = -1;
154 int propIndex = 0; 154 int propIndex = 0;
155 const SkMemberInfo* info; 155 const SkMemberInfo* info;
156 const SkMemberInfo* blankInfo; 156 const SkMemberInfo* blankInfo;
157 SkScriptValue value; 157 SkScriptValue value;
158 SkScriptValue blankValue; 158 SkScriptValue blankValue;
159 SkOperand values[2]; 159 SkOperand values[2];
160 SkOperand blankValues[2]; 160 SkOperand blankValues[2];
161 do { 161 do {
162 info = this->getMember(++index); 162 info = this->getMember(++index);
163 if (NULL == info) { 163 if (nullptr == info) {
164 //SkDebugf("\n"); 164 //SkDebugf("\n");
165 break; 165 break;
166 } 166 }
167 if (SkType_MemberProperty == info->fType) { 167 if (SkType_MemberProperty == info->fType) {
168 if (getProperty(propIndex, &value)) { 168 if (getProperty(propIndex, &value)) {
169 blankCopy->getProperty(propIndex, &blankValue); 169 blankCopy->getProperty(propIndex, &blankValue);
170 //last two are dummies 170 //last two are dummies
171 dumpValues(info, value.fType, value.fOperand, blankValue.fOperan d, value.fOperand, blankValue.fOperand); 171 dumpValues(info, value.fType, value.fOperand, blankValue.fOperan d, value.fOperand, blankValue.fOperand);
172 } 172 }
173 173
174 propIndex++; 174 propIndex++;
175 continue; 175 continue;
176 } 176 }
177 if (SkDisplayType::IsDisplayable(maker, info->fType)) { 177 if (SkDisplayType::IsDisplayable(maker, info->fType)) {
178 continue; 178 continue;
179 } 179 }
180 180
181 if (info->fType == SkType_MemberFunction) 181 if (info->fType == SkType_MemberFunction)
182 continue; 182 continue;
183 183
184 184
185 if (info->fType == SkType_Array) { 185 if (info->fType == SkType_Array) {
186 SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this) ; 186 SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this) ;
187 int arrayCount; 187 int arrayCount;
188 if (array == NULL || (arrayCount = array->count()) == 0) 188 if (array == nullptr || (arrayCount = array->count()) == 0)
189 continue; 189 continue;
190 SkDisplayTypes elementType; 190 SkDisplayTypes elementType;
191 if (type == SkType_Array) { 191 if (type == SkType_Array) {
192 SkDisplayArray* dispArray = (SkDisplayArray*) this; 192 SkDisplayArray* dispArray = (SkDisplayArray*) this;
193 elementType = dispArray->values.getType(); 193 elementType = dispArray->values.getType();
194 } else 194 } else
195 elementType = info->arrayType(); 195 elementType = info->arrayType();
196 bool firstElem = true; 196 bool firstElem = true;
197 SkDebugf("%s=\"[", info->fName); 197 SkDebugf("%s=\"[", info->fName);
198 for (SkOperand* op = array->begin(); op < array->end(); op++) { 198 for (SkOperand* op = array->begin(); op < array->end(); op++) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 252 }
253 253
254 void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) { 254 void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) {
255 255
256 int index = -1; 256 int index = -1;
257 const SkMemberInfo* info; 257 const SkMemberInfo* info;
258 index = -1; 258 index = -1;
259 SkDisplayList::fIndent += 4; 259 SkDisplayList::fIndent += 4;
260 do { 260 do {
261 info = this->getMember(++index); 261 info = this->getMember(++index);
262 if (NULL == info) { 262 if (nullptr == info) {
263 break; 263 break;
264 } 264 }
265 if (SkDisplayType::IsDisplayable(maker, info->fType)) { 265 if (SkDisplayType::IsDisplayable(maker, info->fType)) {
266 SkDisplayable** displayable = (SkDisplayable**) info->memberData(thi s); 266 SkDisplayable** displayable = (SkDisplayable**) info->memberData(thi s);
267 if (*displayable == NULL || *displayable == (SkDisplayable*) -1) 267 if (*displayable == nullptr || *displayable == (SkDisplayable*) -1)
268 continue; 268 continue;
269 if (closedAngle == false) { 269 if (closedAngle == false) {
270 SkDebugf(">\n"); 270 SkDebugf(">\n");
271 closedAngle = true; 271 closedAngle = true;
272 } 272 }
273 (*displayable)->dump(maker); 273 (*displayable)->dump(maker);
274 } 274 }
275 } while (true); 275 } while (true);
276 SkDisplayList::fIndent -= 4; 276 SkDisplayList::fIndent -= 4;
277 if (closedAngle) 277 if (closedAngle)
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 SkASSERT(0); 415 SkASSERT(0);
416 } 416 }
417 417
418 void SkDisplayable::getBounds(SkRect* rect) { 418 void SkDisplayable::getBounds(SkRect* rect) {
419 SkASSERT(rect); 419 SkASSERT(rect);
420 rect->fLeft = rect->fTop = SK_ScalarMax; 420 rect->fLeft = rect->fTop = SK_ScalarMax;
421 rect->fRight= rect->fBottom = -SK_ScalarMax; 421 rect->fRight= rect->fBottom = -SK_ScalarMax;
422 } 422 }
423 423
424 const SkFunctionParamType* SkDisplayable::getFunctionsParameters() { 424 const SkFunctionParamType* SkDisplayable::getFunctionsParameters() {
425 return NULL; 425 return nullptr;
426 } 426 }
427 427
428 const SkMemberInfo* SkDisplayable::getMember(int index) { 428 const SkMemberInfo* SkDisplayable::getMember(int index) {
429 return NULL; 429 return nullptr;
430 } 430 }
431 431
432 const SkMemberInfo* SkDisplayable::getMember(const char name[]) { 432 const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
433 return NULL; 433 return nullptr;
434 } 434 }
435 435
436 const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info , 436 const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info ,
437 int* paramCount) { 437 int* paramCount) {
438 const SkFunctionParamType* params = getFunctionsParameters(); 438 const SkFunctionParamType* params = getFunctionsParameters();
439 SkASSERT(params != NULL); 439 SkASSERT(params != nullptr);
440 int funcIndex = info->functionIndex(); 440 int funcIndex = info->functionIndex();
441 // !!! eventually break traversing params into an external function (maybe t his whole function) 441 // !!! eventually break traversing params into an external function (maybe t his whole function)
442 int index = funcIndex; 442 int index = funcIndex;
443 int offset = 0; 443 int offset = 0;
444 while (--index >= 0) { 444 while (--index >= 0) {
445 while (params[offset] != 0) 445 while (params[offset] != 0)
446 offset++; 446 offset++;
447 offset++; 447 offset++;
448 } 448 }
449 int count = 0; 449 int count = 0;
450 while (params[offset] != 0) { 450 while (params[offset] != 0) {
451 count++; 451 count++;
452 offset++; 452 offset++;
453 } 453 }
454 *paramCount = count; 454 *paramCount = count;
455 return &params[offset - count]; 455 return &params[offset - count];
456 } 456 }
457 457
458 SkDisplayable* SkDisplayable::getParent() const { 458 SkDisplayable* SkDisplayable::getParent() const {
459 return NULL; 459 return nullptr;
460 } 460 }
461 461
462 bool SkDisplayable::getProperty(int index, SkScriptValue* ) const { 462 bool SkDisplayable::getProperty(int index, SkScriptValue* ) const {
463 // SkASSERT(0); 463 // SkASSERT(0);
464 return false; 464 return false;
465 } 465 }
466 466
467 bool SkDisplayable::getProperty2(int index, SkOperand2* value) const { 467 bool SkDisplayable::getProperty2(int index, SkOperand2* value) const {
468 SkASSERT(0); 468 SkASSERT(0);
469 return false; 469 return false;
470 } 470 }
471 471
472 SkDisplayTypes SkDisplayable::getType() const { 472 SkDisplayTypes SkDisplayable::getType() const {
473 return SkType_Unknown; 473 return SkType_Unknown;
474 } 474 }
475 475
476 bool SkDisplayable::hasEnable() const { 476 bool SkDisplayable::hasEnable() const {
477 return false; 477 return false;
478 } 478 }
479 479
480 bool SkDisplayable::isDrawable() const { 480 bool SkDisplayable::isDrawable() const {
481 return false; 481 return false;
482 } 482 }
483 483
484 void SkDisplayable::onEndElement(SkAnimateMaker& ) {} 484 void SkDisplayable::onEndElement(SkAnimateMaker& ) {}
485 485
486 const SkMemberInfo* SkDisplayable::preferredChild(SkDisplayTypes type) { 486 const SkMemberInfo* SkDisplayable::preferredChild(SkDisplayTypes type) {
487 return NULL; 487 return nullptr;
488 } 488 }
489 489
490 bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, S kApply* apply) { 490 bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, S kApply* apply) {
491 return false; 491 return false;
492 } 492 }
493 493
494 //SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) { 494 //SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) {
495 // return this; 495 // return this;
496 //} 496 //}
497 497
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 // !!! unclear why displayable is dirtied here 532 // !!! unclear why displayable is dirtied here
533 // if this is called, this breaks fromPath.xml 533 // if this is called, this breaks fromPath.xml
534 // displayable->dirty(); 534 // displayable->dirty();
535 } 535 }
536 536
537 #ifdef SK_DEBUG 537 #ifdef SK_DEBUG
538 void SkDisplayable::validate() { 538 void SkDisplayable::validate() {
539 } 539 }
540 #endif 540 #endif
OLDNEW
« no previous file with comments | « src/animator/SkDisplayXMLParser.cpp ('k') | src/animator/SkDraw3D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698