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

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

Issue 2263373002: check for wide-open inside quickContains (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkClipStack.h" 10 #include "SkClipStack.h"
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 return; 614 return;
615 } 615 }
616 616
617 *canvFiniteBound = element->fFiniteBound; 617 *canvFiniteBound = element->fFiniteBound;
618 *boundType = element->fFiniteBoundType; 618 *boundType = element->fFiniteBoundType;
619 if (isIntersectionOfRects) { 619 if (isIntersectionOfRects) {
620 *isIntersectionOfRects = element->fIsIntersectionOfRects; 620 *isIntersectionOfRects = element->fIsIntersectionOfRects;
621 } 621 }
622 } 622 }
623 623
624 bool SkClipStack::quickContains(const SkRect& rect) const { 624 bool SkClipStack::internalQuickContains(const SkRect& rect) const {
625 625
626 Iter iter(*this, Iter::kTop_IterStart); 626 Iter iter(*this, Iter::kTop_IterStart);
627 const Element* element = iter.prev(); 627 const Element* element = iter.prev();
628 while (element != nullptr) { 628 while (element != nullptr) {
629 if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp()) 629 if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
630 return false; 630 return false;
631 if (element->isInverseFilled()) { 631 if (element->isInverseFilled()) {
632 // Part of 'rect' could be trimmed off by the inverse-filled clip el ement 632 // Part of 'rect' could be trimmed off by the inverse-filled clip el ement
633 if (SkRect::Intersects(element->getBounds(), rect)) { 633 if (SkRect::Intersects(element->getBounds(), rect)) {
634 return false; 634 return false;
635 } 635 }
636 } else { 636 } else {
637 if (!element->contains(rect)) { 637 if (!element->contains(rect)) {
638 return false; 638 return false;
639 } 639 }
640 } 640 }
641 if (SkRegion::kReplace_Op == element->getOp()) { 641 if (SkRegion::kReplace_Op == element->getOp()) {
642 break; 642 break;
643 } 643 }
644 element = iter.prev(); 644 element = iter.prev();
645 } 645 }
646 return true; 646 return true;
647 } 647 }
648 648
649 bool SkClipStack::quickContains(const SkRRect& rrect) const { 649 bool SkClipStack::internalQuickContains(const SkRRect& rrect) const {
650 650
651 Iter iter(*this, Iter::kTop_IterStart); 651 Iter iter(*this, Iter::kTop_IterStart);
652 const Element* element = iter.prev(); 652 const Element* element = iter.prev();
653 while (element != nullptr) { 653 while (element != nullptr) {
654 if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp()) 654 if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
655 return false; 655 return false;
656 if (element->isInverseFilled()) { 656 if (element->isInverseFilled()) {
657 // Part of 'rrect' could be trimmed off by the inverse-filled clip e lement 657 // Part of 'rrect' could be trimmed off by the inverse-filled clip e lement
658 if (SkRect::Intersects(element->getBounds(), rrect.getBounds())) { 658 if (SkRect::Intersects(element->getBounds(), rrect.getBounds())) {
659 return false; 659 return false;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 Element* element = (Element*) fDeque.back(); 764 Element* element = (Element*) fDeque.back();
765 765
766 if (element && element->canBeIntersectedInPlace(fSaveCount, SkRegion::kInter sect_Op)) { 766 if (element && element->canBeIntersectedInPlace(fSaveCount, SkRegion::kInter sect_Op)) {
767 element->setEmpty(); 767 element->setEmpty();
768 } 768 }
769 new (fDeque.push_back()) Element(fSaveCount); 769 new (fDeque.push_back()) Element(fSaveCount);
770 770
771 ((Element*)fDeque.back())->fGenID = kEmptyGenID; 771 ((Element*)fDeque.back())->fGenID = kEmptyGenID;
772 } 772 }
773 773
774 bool SkClipStack::isWideOpen() const {
775 return this->getTopmostGenID() == kWideOpenGenID;
776 }
777
778 /////////////////////////////////////////////////////////////////////////////// 774 ///////////////////////////////////////////////////////////////////////////////
779 775
780 SkClipStack::Iter::Iter() : fStack(nullptr) { 776 SkClipStack::Iter::Iter() : fStack(nullptr) {
781 } 777 }
782 778
783 SkClipStack::Iter::Iter(const SkClipStack& stack, IterStart startLoc) 779 SkClipStack::Iter::Iter(const SkClipStack& stack, IterStart startLoc)
784 : fStack(&stack) { 780 : fStack(&stack) {
785 this->reset(stack, startLoc); 781 this->reset(stack, startLoc);
786 } 782 }
787 783
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 932
937 void SkClipStack::dump() const { 933 void SkClipStack::dump() const {
938 B2TIter iter(*this); 934 B2TIter iter(*this);
939 const Element* e; 935 const Element* e;
940 while ((e = iter.next())) { 936 while ((e = iter.next())) {
941 e->dump(); 937 e->dump();
942 SkDebugf("\n"); 938 SkDebugf("\n");
943 } 939 }
944 } 940 }
945 #endif 941 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698