8#ifndef ClipStack_DEFINED
9#define ClipStack_DEFINED
67 inline ElementIter
begin()
const;
68 inline ElementIter
end()
const;
93 SkRect* bounds)
const override;
97#if defined(GR_TEST_UTILS)
98 UniqueKey testingOnly_getLastSWMaskKey()
const {
116 class RawElement :
private Element {
124 const SkIRect& outerBounds()
const {
return fOuterBounds; }
125 bool contains(
const SaveRecord&
s)
const;
127 bool contains(
const RawElement& e)
const;
130 const Element& asElement()
const {
return *
this; }
134 const SkIRect& innerBounds()
const {
return fInnerBounds; }
135 GrAA aa()
const {
return fAA; }
142 bool isInvalid()
const {
return fInvalidatedByIndex >= 0; }
143 void markInvalid(
const SaveRecord& current);
144 void restoreValid(
const SaveRecord& current);
158 void updateForElement(RawElement* added,
const SaveRecord& current);
160 void simplify(
const SkIRect& deviceBounds,
bool forceAA);
163 bool combine(
const RawElement& other,
const SaveRecord& current);
176 int fInvalidatedByIndex;
187 Mask(
const SaveRecord& current,
const SkIRect& bounds);
194 const UniqueKey&
key()
const {
return fKey; }
196 uint32_t genID()
const {
return fGenID; }
198 bool appliesToDraw(
const SaveRecord& current,
const SkIRect& drawBounds)
const;
201 SkDEBUGCODE(
const SaveRecord* owner()
const {
return fOwner; })
221 explicit SaveRecord(
const SkIRect& deviceBounds);
223 SaveRecord(
const SaveRecord& prior,
int startingMaskIndex,
int startingElementIndex);
226 SkClipOp op()
const {
return fStackOp; }
227 const SkIRect& outerBounds()
const {
return fOuterBounds; }
229 bool contains(
const RawElement& e)
const;
232 const SkShader* shader()
const {
return fShader.get(); }
233 const SkIRect& innerBounds()
const {
return fInnerBounds; }
234 int firstActiveElementIndex()
const {
return fStartingElementIndex; }
235 int oldestElementIndex()
const {
return fOldestValidIndex; }
236 bool canBeUpdated()
const {
return (fDeferredSaveCount == 0); }
239 uint32_t genID()
const;
244 fDeferredSaveCount++;
248 fDeferredSaveCount--;
250 return fDeferredSaveCount >= 0;
255 bool addElement(RawElement&& toAdd, RawElement::Stack* elements);
262 void removeElements(RawElement::Stack* elements);
265 void restoreElements(RawElement::Stack* elements);
267 void invalidateMasks(
GrProxyProvider* proxyProvider, Mask::Stack* masks);
272 bool appendElement(RawElement&& toAdd, RawElement::Stack* elements);
273 void replaceWithElement(RawElement&& toAdd, RawElement::Stack* elements);
283 const int fStartingMaskIndex;
284 const int fStartingElementIndex;
285 int fOldestValidIndex;
287 int fDeferredSaveCount;
298 void clip(RawElement&& element);
300 const SaveRecord& currentSaveRecord()
const {
302 return fSaves.
back();
307 SaveRecord& writableSaveRecord(
bool* wasDeferred);
312 const SaveRecord& current,
const SkIRect& bounds,
314 std::unique_ptr<GrFragmentProcessor> clipFP);
316 RawElement::Stack fElements;
317 SaveRecord::Stack fSaves;
322 mutable Mask::Stack fMasks;
348 }
while(
fRemaining > 0 && (*fItem).isInvalid());
355 RawElement::Stack::CRIter::Item
fItem;
367 int count = fElements.
count() - this->currentSaveRecord().oldestElementIndex();
std::tuple< bool, std::unique_ptr< GrFragmentProcessor > > GrFPResult
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
ElementIter(RawElement::Stack::CRIter::Item item, int r)
bool operator!=(const ElementIter &o) const
const Element & operator*() const
RawElement::Stack::CRIter::Item fItem
ElementIter & operator++()
ClipStack(const ClipStack &)=delete
GrClip::Effect apply(GrRecordingContext *, skgpu::ganesh::SurfaceDrawContext *, GrDrawOp *, GrAAType, GrAppliedClip *, SkRect *bounds) const override
ClipStack & operator=(const ClipStack &)=delete
GrClip::PreClipResult preApply(const SkRect &drawBounds, GrAA aa) const override
ElementIter begin() const
void clipRRect(const SkMatrix &ctm, const SkRRect &rrect, GrAA aa, SkClipOp op)
void clipPath(const SkMatrix &ctm, const SkPath &path, GrAA aa, SkClipOp op)
void clipShader(sk_sp< SkShader > shader)
void clipRect(const SkMatrix &ctm, const SkRect &rect, GrAA aa, SkClipOp op)
ClipState clipState() const
SkIRect getConservativeBounds() const override
void replaceClip(const SkIRect &rect)
static void Draw(SkCanvas *canvas, const SkRect &rect)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Optional< SkRect > bounds
constexpr bool contains(std::string_view str, std::string_view needle)
std::true_type sk_is_trivially_relocatable