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

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

Issue 12817011: Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierar… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « src/core/SkRTree.h ('k') | src/core/SkTileGrid.h » ('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 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 #include "SkRTree.h" 9 #include "SkRTree.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 int childCount = 0; 427 int childCount = 0;
428 for (int i = 0; i < root->fNumChildren; ++i) { 428 for (int i = 0; i < root->fNumChildren; ++i) {
429 SkASSERT(root->child(i)->fChild.subtree->fLevel == root->fLevel - 1) ; 429 SkASSERT(root->child(i)->fChild.subtree->fLevel == root->fLevel - 1) ;
430 childCount += this->validateSubtree(root->child(i)->fChild.subtree, 430 childCount += this->validateSubtree(root->child(i)->fChild.subtree,
431 root->child(i)->fBounds); 431 root->child(i)->fBounds);
432 } 432 }
433 return childCount; 433 return childCount;
434 } 434 }
435 } 435 }
436 436
437 void SkRTree::rewindInserts() {
438 SkASSERT(this->isEmpty()); // Currently only supports deferred inserts
439 while (!fDeferredInserts.isEmpty() &&
440 fClient->shouldRewind(fDeferredInserts.top().fChild.data)) {
441 fDeferredInserts.pop();
442 }
443 }
444
437 //////////////////////////////////////////////////////////////////////////////// /////////////////// 445 //////////////////////////////////////////////////////////////////////////////// ///////////////////
438 446
439 static inline uint32_t get_area(const SkIRect& rect) { 447 static inline uint32_t get_area(const SkIRect& rect) {
440 return rect.width() * rect.height(); 448 return rect.width() * rect.height();
441 } 449 }
442 450
443 static inline uint32_t get_overlap(const SkIRect& rect1, const SkIRect& rect2) { 451 static inline uint32_t get_overlap(const SkIRect& rect1, const SkIRect& rect2) {
444 // I suspect there's a more efficient way of computing this... 452 // I suspect there's a more efficient way of computing this...
445 return SkMax32(0, SkMin32(rect1.fRight, rect2.fRight) - SkMax32(rect1.fLeft, rect2.fLeft)) * 453 return SkMax32(0, SkMin32(rect1.fRight, rect2.fRight) - SkMax32(rect1.fLeft, rect2.fLeft)) *
446 SkMax32(0, SkMin32(rect1.fBottom, rect2.fBottom) - SkMax32(rect1.fTop , rect2.fTop)); 454 SkMax32(0, SkMin32(rect1.fBottom, rect2.fBottom) - SkMax32(rect1.fTop , rect2.fTop));
(...skipping 17 matching lines...) Expand all
464 472
465 // Expand 'out' to include 'joinWith' 473 // Expand 'out' to include 'joinWith'
466 static inline void join_no_empty_check(const SkIRect& joinWith, SkIRect* out) { 474 static inline void join_no_empty_check(const SkIRect& joinWith, SkIRect* out) {
467 // since we check for empty bounds on insert, we know we'll never have empty rects 475 // since we check for empty bounds on insert, we know we'll never have empty rects
468 // and we can save the empty check that SkIRect::join requires 476 // and we can save the empty check that SkIRect::join requires
469 if (joinWith.fLeft < out->fLeft) { out->fLeft = joinWith.fLeft; } 477 if (joinWith.fLeft < out->fLeft) { out->fLeft = joinWith.fLeft; }
470 if (joinWith.fTop < out->fTop) { out->fTop = joinWith.fTop; } 478 if (joinWith.fTop < out->fTop) { out->fTop = joinWith.fTop; }
471 if (joinWith.fRight > out->fRight) { out->fRight = joinWith.fRight; } 479 if (joinWith.fRight > out->fRight) { out->fRight = joinWith.fRight; }
472 if (joinWith.fBottom > out->fBottom) { out->fBottom = joinWith.fBottom; } 480 if (joinWith.fBottom > out->fBottom) { out->fBottom = joinWith.fBottom; }
473 } 481 }
OLDNEW
« no previous file with comments | « src/core/SkRTree.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698