#include "src/gpu/graphite/ClipStack_graphite.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkShader.h"
#include "include/core/SkStrokeRec.h"
#include "src/base/SkTLazy.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkRRectPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/gpu/graphite/Device.h"
#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/geom/BoundsManager.h"
#include "src/gpu/graphite/geom/Geometry.h"
namespace skgpu::graphite {
namespace {
Rect subtract(const Rect& a, const Rect& b, bool exact) { … }
bool oriented_bbox_intersection(const Rect& a, const Transform& aXform,
const Rect& b, const Transform& bXform) { … }
static constexpr Transform kIdentity = …;
}
struct ClipStack::TransformedShape { … };
bool ClipStack::TransformedShape::intersects(const TransformedShape& o) const { … }
bool ClipStack::TransformedShape::contains(const TransformedShape& o) const { … }
ClipStack::SimplifyResult ClipStack::Simplify(const TransformedShape& a,
const TransformedShape& b) { … }
ClipStack::RawElement::RawElement(const Rect& deviceBounds,
const Transform& localToDevice,
const Shape& shape,
SkClipOp op,
PixelSnapping snapping)
: … { … }
operator TransformedShape()
void ClipStack::RawElement::drawClip(Device* device) { … }
void ClipStack::RawElement::validate() const { … }
void ClipStack::RawElement::markInvalid(const SaveRecord& current) { … }
void ClipStack::RawElement::restoreValid(const SaveRecord& current) { … }
bool ClipStack::RawElement::combine(const RawElement& other, const SaveRecord& current) { … }
void ClipStack::RawElement::updateForElement(RawElement* added, const SaveRecord& current) { … }
ClipStack::RawElement::DrawInfluence
ClipStack::RawElement::testForDraw(const TransformedShape& draw) const { … }
CompressedPaintersOrder ClipStack::RawElement::updateForDraw(const BoundsManager* boundsManager,
const Rect& drawBounds,
PaintersDepth drawZ) { … }
ClipStack::ClipState ClipStack::RawElement::clipType() const { … }
ClipStack::SaveRecord::SaveRecord(const Rect& deviceBounds)
: … { … }
ClipStack::SaveRecord::SaveRecord(const SaveRecord& prior,
int startingElementIndex)
: … { … }
ClipStack::ClipState ClipStack::SaveRecord::state() const { … }
Rect ClipStack::SaveRecord::scissor(const Rect& deviceBounds, const Rect& drawBounds) const { … }
void ClipStack::SaveRecord::removeElements(RawElement::Stack* elements, Device* device) { … }
void ClipStack::SaveRecord::restoreElements(RawElement::Stack* elements) { … }
void ClipStack::SaveRecord::addShader(sk_sp<SkShader> shader) { … }
bool ClipStack::SaveRecord::addElement(RawElement&& toAdd,
RawElement::Stack* elements,
Device* device) { … }
bool ClipStack::SaveRecord::appendElement(RawElement&& toAdd,
RawElement::Stack* elements,
Device* device) { … }
void ClipStack::SaveRecord::replaceWithElement(RawElement&& toAdd,
RawElement::Stack* elements,
Device* device) { … }
static constexpr int kElementStackIncrement = …;
static constexpr int kSaveStackIncrement = …;
ClipStack::ClipStack(Device* owningDevice)
: … { … }
ClipStack::~ClipStack() = default;
void ClipStack::save() { … }
void ClipStack::restore() { … }
Rect ClipStack::deviceBounds() const { … }
Rect ClipStack::conservativeBounds() const { … }
ClipStack::SaveRecord& ClipStack::writableSaveRecord(bool* wasDeferred) { … }
void ClipStack::clipShader(sk_sp<SkShader> shader) { … }
void ClipStack::clipShape(const Transform& localToDevice,
const Shape& shape,
SkClipOp op,
PixelSnapping snapping) { … }
Clip ClipStack::visitClipStackForDraw(const Transform& localToDevice,
const Geometry& geometry,
const SkStrokeRec& style,
bool outsetBoundsForAA,
ClipStack::ElementList* outEffectiveElements) const { … }
CompressedPaintersOrder ClipStack::updateClipStateForDraw(const Clip& clip,
const ElementList& effectiveElements,
const BoundsManager* boundsManager,
PaintersDepth z) { … }
void ClipStack::recordDeferredClipDraws() { … }
}