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

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

Issue 2241273003: Attempt to throw away rrect clips of rrects. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix int to scalar warnings Created 4 years, 4 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 | « include/gpu/GrClip.h ('k') | src/gpu/GrClipStackClip.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 * 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {
650
651 Iter iter(*this, Iter::kTop_IterStart);
652 const Element* element = iter.prev();
653 while (element != nullptr) {
654 if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
655 return false;
656 if (element->isInverseFilled()) {
657 // Part of 'rrect' could be trimmed off by the inverse-filled clip e lement
658 if (SkRect::Intersects(element->getBounds(), rrect.getBounds())) {
659 return false;
660 }
661 } else {
662 if (!element->contains(rrect)) {
663 return false;
664 }
665 }
666 if (SkRegion::kReplace_Op == element->getOp()) {
667 break;
668 }
669 element = iter.prev();
670 }
671 return true;
672 }
673
649 bool SkClipStack::asPath(SkPath *path) const { 674 bool SkClipStack::asPath(SkPath *path) const {
650 bool isAA = false; 675 bool isAA = false;
651 676
652 path->reset(); 677 path->reset();
653 path->setFillType(SkPath::kInverseEvenOdd_FillType); 678 path->setFillType(SkPath::kInverseEvenOdd_FillType);
654 679
655 SkClipStack::Iter iter(*this, SkClipStack::Iter::kBottom_IterStart); 680 SkClipStack::Iter iter(*this, SkClipStack::Iter::kBottom_IterStart);
656 while (const SkClipStack::Element* element = iter.next()) { 681 while (const SkClipStack::Element* element = iter.next()) {
657 SkPath operand; 682 SkPath operand;
658 if (element->getType() != SkClipStack::Element::kEmpty_Type) { 683 if (element->getType() != SkClipStack::Element::kEmpty_Type) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 936
912 void SkClipStack::dump() const { 937 void SkClipStack::dump() const {
913 B2TIter iter(*this); 938 B2TIter iter(*this);
914 const Element* e; 939 const Element* e;
915 while ((e = iter.next())) { 940 while ((e = iter.next())) {
916 e->dump(); 941 e->dump();
917 SkDebugf("\n"); 942 SkDebugf("\n");
918 } 943 }
919 } 944 }
920 #endif 945 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrClip.h ('k') | src/gpu/GrClipStackClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698