OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
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 #ifndef SkPathRef_DEFINED | 9 #ifndef SkPathRef_DEFINED |
10 #define SkPathRef_DEFINED | 10 #define SkPathRef_DEFINED |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 this->validate(); | 455 this->validate(); |
456 } | 456 } |
457 | 457 |
458 /** | 458 /** |
459 * Increases the verb count 1, records the new verb, and creates room for th e requisite number | 459 * Increases the verb count 1, records the new verb, and creates room for th e requisite number |
460 * of additional points. A pointer to the first point is returned. Any new p oints are | 460 * of additional points. A pointer to the first point is returned. Any new p oints are |
461 * uninitialized. | 461 * uninitialized. |
462 */ | 462 */ |
463 SkPoint* growForVerb(SkPath::Verb verb) { | 463 SkPoint* growForVerb(SkPath::Verb verb) { |
464 this->validate(); | 464 this->validate(); |
465 int pCnt; | 465 int pCnt = 0; |
466 switch (verb) { | 466 switch (verb) { |
467 case SkPath::kMove_Verb: | 467 case SkPath::kMove_Verb: |
468 pCnt = 1; | 468 pCnt = 1; |
469 break; | 469 break; |
470 case SkPath::kLine_Verb: | 470 case SkPath::kLine_Verb: |
471 pCnt = 1; | 471 pCnt = 1; |
472 break; | 472 break; |
473 case SkPath::kConic_Verb: | 473 case SkPath::kConic_Verb: |
474 case SkPath::kQuad_Verb: | 474 case SkPath::kQuad_Verb: |
475 pCnt = 2; | 475 pCnt = 2; |
476 break; | 476 break; |
477 case SkPath::kCubic_Verb: | 477 case SkPath::kCubic_Verb: |
478 pCnt = 3; | 478 pCnt = 3; |
479 break; | 479 break; |
480 case SkPath::kDone_Verb: | 480 case SkPath::kDone_Verb: |
481 SkASSERT(!"growForVerb called for kDone"); | 481 SkASSERT(!"growForVerb called for kDone"); |
482 // fall through | 482 // fall through |
483 case SkPath::kClose_Verb: | 483 case SkPath::kClose_Verb: |
484 pCnt = 0; | 484 pCnt = 0; |
bungeman-skia
2013/06/27 17:21:14
It may be better to put a default here to set pCnt
reed1
2013/06/27 17:34:14
Other than line 473 ?
dshwang
2013/06/27 17:54:33
Do you mean kClose_Verb must be not reached also?
bungeman-skia
2013/06/27 19:06:03
No, I suppose the change as stated is probably fin
bungeman-skia
2013/06/27 19:06:03
Oops, missed that fall through when scanning. My O
| |
485 } | 485 } |
486 size_t space = sizeof(uint8_t) + pCnt * sizeof (SkPoint); | 486 size_t space = sizeof(uint8_t) + pCnt * sizeof (SkPoint); |
487 this->makeSpace(space); | 487 this->makeSpace(space); |
488 this->fVerbs[~fVerbCnt] = verb; | 488 this->fVerbs[~fVerbCnt] = verb; |
489 SkPoint* ret = fPoints + fPointCnt; | 489 SkPoint* ret = fPoints + fPointCnt; |
490 fVerbCnt += 1; | 490 fVerbCnt += 1; |
491 fPointCnt += pCnt; | 491 fPointCnt += pCnt; |
492 fFreeSpace -= space; | 492 fFreeSpace -= space; |
493 this->validate(); | 493 this->validate(); |
494 return ret; | 494 return ret; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 #if SK_DEBUG_PATH_REF | 599 #if SK_DEBUG_PATH_REF |
600 SkTDArray<SkPath*> fOwners; | 600 SkTDArray<SkPath*> fOwners; |
601 #endif | 601 #endif |
602 | 602 |
603 typedef SkRefCnt INHERITED; | 603 typedef SkRefCnt INHERITED; |
604 }; | 604 }; |
605 | 605 |
606 SK_DEFINE_INST_COUNT(SkPathRef); | 606 SK_DEFINE_INST_COUNT(SkPathRef); |
607 | 607 |
608 #endif | 608 #endif |
OLD | NEW |