Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
SkClipStack::Iter Class Reference

#include <SkClipStack.h>

Inheritance diagram for SkClipStack::Iter:
SkClipStack::B2TIter

Public Types

enum  IterStart { kBottom_IterStart = SkDeque::Iter::kFront_IterStart , kTop_IterStart = SkDeque::Iter::kBack_IterStart }
 

Public Member Functions

 Iter ()
 
 Iter (const SkClipStack &stack, IterStart startLoc)
 
const Elementnext ()
 
const Elementprev ()
 
const ElementskipToTopmost (SkClipOp op)
 
void reset (const SkClipStack &stack, IterStart startLoc)
 

Detailed Description

Definition at line 400 of file SkClipStack.h.

Member Enumeration Documentation

◆ IterStart

Enumerator
kBottom_IterStart 
kTop_IterStart 

Definition at line 402 of file SkClipStack.h.

Constructor & Destructor Documentation

◆ Iter() [1/2]

SkClipStack::Iter::Iter ( )

Creates an uninitialized iterator. Must be reset()

Definition at line 786 of file SkClipStack.cpp.

786 : fStack(nullptr) {
787}

◆ Iter() [2/2]

SkClipStack::Iter::Iter ( const SkClipStack stack,
IterStart  startLoc 
)

Definition at line 789 of file SkClipStack.cpp.

790 : fStack(&stack) {
791 this->reset(stack, startLoc);
792}
void reset(const SkClipStack &stack, IterStart startLoc)

Member Function Documentation

◆ next()

const SkClipStack::Element * SkClipStack::Iter::next ( )

Return the clip element for this iterator. If next()/prev() returns NULL, then the iterator is done.

Definition at line 794 of file SkClipStack.cpp.

794 {
795 return (const SkClipStack::Element*)fIter.next();
796}
void * next()
Definition: SkDeque.cpp:251

◆ prev()

const SkClipStack::Element * SkClipStack::Iter::prev ( )

Definition at line 798 of file SkClipStack.cpp.

798 {
799 return (const SkClipStack::Element*)fIter.prev();
800}
void * prev()
Definition: SkDeque.cpp:270

◆ reset()

void SkClipStack::Iter::reset ( const SkClipStack stack,
IterStart  startLoc 
)

Restarts the iterator on a clip stack.

Definition at line 840 of file SkClipStack.cpp.

840 {
841 fStack = &stack;
842 fIter.reset(stack.fDeque, static_cast<SkDeque::Iter::IterStart>(startLoc));
843}
void reset(const SkDeque &d, IterStart startLoc)
Definition: SkDeque.cpp:292

◆ skipToTopmost()

const SkClipStack::Element * SkClipStack::Iter::skipToTopmost ( SkClipOp  op)

Moves the iterator to the topmost element with the specified RegionOp and returns that element. If no clip element with that op is found, the first element is returned.

Definition at line 802 of file SkClipStack.cpp.

802 {
803 if (nullptr == fStack) {
804 return nullptr;
805 }
806
807 fIter.reset(fStack->fDeque, SkDeque::Iter::kBack_IterStart);
808
809 const SkClipStack::Element* element = nullptr;
810
811 for (element = (const SkClipStack::Element*) fIter.prev();
812 element;
813 element = (const SkClipStack::Element*) fIter.prev()) {
814
815 if (op == element->fOp) {
816 // The Deque's iterator is actually one pace ahead of the
817 // returned value. So while "element" is the element we want to
818 // return, the iterator is actually pointing at (and will
819 // return on the next "next" or "prev" call) the element
820 // in front of it in the deque. Bump the iterator forward a
821 // step so we get the expected result.
822 if (nullptr == fIter.next()) {
823 // The reverse iterator has run off the front of the deque
824 // (i.e., the "op" clip is the first clip) and can't
825 // recover. Reset the iterator to start at the front.
826 fIter.reset(fStack->fDeque, SkDeque::Iter::kFront_IterStart);
827 }
828 break;
829 }
830 }
831
832 if (nullptr == element) {
833 // There were no "op" clips
834 fIter.reset(fStack->fDeque, SkDeque::Iter::kFront_IterStart);
835 }
836
837 return this->next();
838}
const Element * next()

The documentation for this class was generated from the following files: