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

Side by Side Diff: src/core/SkPathRef.cpp

Issue 762313002: Force path bounds in recording. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused Created 6 years 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 | « include/core/SkPathRef.h ('k') | src/core/SkRecorder.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * them as "known", rather than force the transformed path to have to 80 * them as "known", rather than force the transformed path to have to
81 * recompute them. 81 * recompute them.
82 * 82 *
83 * Special gotchas if the path is effectively empty (<= 1 point) or 83 * Special gotchas if the path is effectively empty (<= 1 point) or
84 * if it is non-finite. In those cases bounds need to stay empty, 84 * if it is non-finite. In those cases bounds need to stay empty,
85 * regardless of the matrix. 85 * regardless of the matrix.
86 */ 86 */
87 if (canXformBounds) { 87 if (canXformBounds) {
88 (*dst)->fBoundsIsDirty = false; 88 (*dst)->fBoundsIsDirty = false;
89 if (src.fIsFinite) { 89 if (src.fIsFinite) {
90 matrix.mapRect((*dst)->fBounds.get(), src.fBounds); 90 matrix.mapRect(&(*dst)->fBounds, src.fBounds);
91 if (!((*dst)->fIsFinite = (*dst)->fBounds->isFinite())) { 91 if (!((*dst)->fIsFinite = (*dst)->fBounds.isFinite())) {
92 (*dst)->fBounds->setEmpty(); 92 (*dst)->fBounds.setEmpty();
93 } 93 }
94 } else { 94 } else {
95 (*dst)->fIsFinite = false; 95 (*dst)->fIsFinite = false;
96 (*dst)->fBounds->setEmpty(); 96 (*dst)->fBounds.setEmpty();
97 } 97 }
98 } else { 98 } else {
99 (*dst)->fBoundsIsDirty = true; 99 (*dst)->fBoundsIsDirty = true;
100 } 100 }
101 101
102 (*dst)->fSegmentMask = src.fSegmentMask; 102 (*dst)->fSegmentMask = src.fSegmentMask;
103 103
104 // It's an oval only if it stays a rect. 104 // It's an oval only if it stays a rect.
105 (*dst)->fIsOval = src.fIsOval && matrix.rectStaysRect(); 105 (*dst)->fIsOval = src.fIsOval && matrix.rectStaysRect();
106 106
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0); 442 SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0);
443 SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPo ints) >= 0); 443 SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPo ints) >= 0);
444 SkASSERT((NULL == fPoints) == (NULL == fVerbs)); 444 SkASSERT((NULL == fPoints) == (NULL == fVerbs));
445 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace)); 445 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
446 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace)); 446 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
447 SkASSERT(!(NULL == fPoints && fPointCnt)); 447 SkASSERT(!(NULL == fPoints && fPointCnt));
448 SkASSERT(!(NULL == fVerbs && fVerbCnt)); 448 SkASSERT(!(NULL == fVerbs && fVerbCnt));
449 SkASSERT(this->currSize() == 449 SkASSERT(this->currSize() ==
450 fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVe rbCnt); 450 fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVe rbCnt);
451 451
452 if (!fBoundsIsDirty && !fBounds->isEmpty()) { 452 if (!fBoundsIsDirty && !fBounds.isEmpty()) {
453 bool isFinite = true; 453 bool isFinite = true;
454 for (int i = 0; i < fPointCnt; ++i) { 454 for (int i = 0; i < fPointCnt; ++i) {
455 SkASSERT(!fPoints[i].isFinite() || ( 455 SkASSERT(!fPoints[i].isFinite() || (
456 fBounds->fLeft - fPoints[i].fX < SK_ScalarNearlyZero && 456 fBounds.fLeft - fPoints[i].fX < SK_ScalarNearlyZero &&
457 fPoints[i].fX - fBounds->fRight < SK_ScalarNearlyZero && 457 fPoints[i].fX - fBounds.fRight < SK_ScalarNearlyZero &&
458 fBounds->fTop - fPoints[i].fY < SK_ScalarNearlyZero && 458 fBounds.fTop - fPoints[i].fY < SK_ScalarNearlyZero &&
459 fPoints[i].fY - fBounds->fBottom < SK_ScalarNearlyZero)); 459 fPoints[i].fY - fBounds.fBottom < SK_ScalarNearlyZero));
460 if (!fPoints[i].isFinite()) { 460 if (!fPoints[i].isFinite()) {
461 isFinite = false; 461 isFinite = false;
462 } 462 }
463 } 463 }
464 SkASSERT(SkToBool(fIsFinite) == isFinite); 464 SkASSERT(SkToBool(fIsFinite) == isFinite);
465 } 465 }
466 466
467 #ifdef SK_DEBUG_PATH 467 #ifdef SK_DEBUG_PATH
468 uint32_t mask = 0; 468 uint32_t mask = 0;
469 for (int i = 0; i < fVerbCnt; ++i) { 469 for (int i = 0; i < fVerbCnt; ++i) {
(...skipping 19 matching lines...) Expand all
489 break; 489 break;
490 default: 490 default:
491 SkDEBUGFAIL("Unknown Verb"); 491 SkDEBUGFAIL("Unknown Verb");
492 break; 492 break;
493 } 493 }
494 } 494 }
495 SkASSERT(mask == fSegmentMask); 495 SkASSERT(mask == fSegmentMask);
496 #endif // SK_DEBUG_PATH 496 #endif // SK_DEBUG_PATH
497 } 497 }
498 #endif 498 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698