Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
RgnOper Class Reference

Public Member Functions

 RgnOper (int top, RunArray *array, SkRegion::Op op)
 
void addSpan (int bottom, const SkRegionPriv::RunType a_runs[], const SkRegionPriv::RunType b_runs[])
 
int flush ()
 
bool isEmpty () const
 

Public Attributes

uint8_t fMin
 
uint8_t fMax
 

Detailed Description

Definition at line 839 of file SkRegion.cpp.

Constructor & Destructor Documentation

◆ RgnOper()

RgnOper::RgnOper ( int  top,
RunArray array,
SkRegion::Op  op 
)
inline

Definition at line 841 of file SkRegion.cpp.

842 : fMin(gOpMinMax[op].fMin)
843 , fMax(gOpMinMax[op].fMax)
844 , fArray(array)
845 , fTop((SkRegionPriv::RunType)top) // just a first guess, we might update this
846 { SkASSERT((unsigned)op <= 3); }
#define SkASSERT(cond)
Definition SkAssert.h:116
static const struct @341 gOpMinMax[]
uint8_t fMax
Definition SkRegion.cpp:888
uint8_t fMin
Definition SkRegion.cpp:888
SkRegion::RunType RunType

Member Function Documentation

◆ addSpan()

void RgnOper::addSpan ( int  bottom,
const SkRegionPriv::RunType  a_runs[],
const SkRegionPriv::RunType  b_runs[] 
)
inline

Definition at line 848 of file SkRegion.cpp.

849 {
850 // skip X values and slots for the next Y+intervalCount
851 int start = fPrevDst + fPrevLen + 2;
852 // start points to beginning of dst interval
853 int stop = operate_on_span(a_runs, b_runs, fArray, start, fMin, fMax);
854 size_t len = SkToSizeT(stop - start);
855 SkASSERT(len >= 1 && (len & 1) == 1);
856 SkASSERT(SkRegion_kRunTypeSentinel == (*fArray)[stop - 1]);
857
858 // Assert memcmp won't exceed fArray->count().
859 SkASSERT(fArray->count() >= SkToInt(start + len - 1));
860 if (fPrevLen == len &&
861 (1 == len || !memcmp(&(*fArray)[fPrevDst],
862 &(*fArray)[start],
863 (len - 1) * sizeof(SkRegionPriv::RunType)))) {
864 // update Y value
865 (*fArray)[fPrevDst - 2] = (SkRegionPriv::RunType)bottom;
866 } else { // accept the new span
867 if (len == 1 && fPrevLen == 0) {
868 fTop = (SkRegionPriv::RunType)bottom; // just update our bottom
869 } else {
870 (*fArray)[start - 2] = (SkRegionPriv::RunType)bottom;
871 (*fArray)[start - 1] = SkToS32(len >> 1);
872 fPrevDst = start;
873 fPrevLen = len;
874 }
875 }
876 }
static constexpr int SkRegion_kRunTypeSentinel
static int operate_on_span(const SkRegionPriv::RunType a_runs[], const SkRegionPriv::RunType b_runs[], RunArray *array, int dstOffset, int min, int max)
Definition SkRegion.cpp:782
constexpr size_t SkToSizeT(S x)
Definition SkTo.h:31
constexpr int32_t SkToS32(S x)
Definition SkTo.h:25
constexpr int SkToInt(S x)
Definition SkTo.h:29

◆ flush()

int RgnOper::flush ( )
inline

Definition at line 878 of file SkRegion.cpp.

878 {
879 (*fArray)[fStartDst] = fTop;
880 // Previously reserved enough for TWO sentinals.
881 SkASSERT(fArray->count() > SkToInt(fPrevDst + fPrevLen));
882 (*fArray)[fPrevDst + fPrevLen] = SkRegion_kRunTypeSentinel;
883 return (int)(fPrevDst - fStartDst + fPrevLen + 1);
884 }

◆ isEmpty()

bool RgnOper::isEmpty ( ) const
inline

Definition at line 886 of file SkRegion.cpp.

886{ return 0 == fPrevLen; }

Member Data Documentation

◆ fMax

uint8_t RgnOper::fMax

Definition at line 888 of file SkRegion.cpp.

◆ fMin

uint8_t RgnOper::fMin

Definition at line 888 of file SkRegion.cpp.


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