50 bool init(
int maxHeight,
int maxTransitions,
bool pathIsInverse);
53 if (fCurrScanline !=
nullptr) {
54 fCurrScanline->fXCount = (SkRegion::RunType)((
int)(fCurrXPtr - fCurrScanline->firstX()));
55 if (!this->collapsWithPrev()) {
56 fCurrScanline = fCurrScanline->nextScanline();
63 void copyToRgn(SkRegion::RunType runs[])
const;
72 SkDebugf(
"SkRgnBuilder: Top = %d\n", fTop);
73 Scanline*
line = (Scanline*)fStorage;
74 while (
line < fCurrScanline) {
75 SkDebugf(
"SkRgnBuilder::Scanline: LastY=%d, fXCount=%d",
line->fLastY,
line->fXCount);
76 for (
int i = 0;
i <
line->fXCount;
i++) {
99 SkRegion::RunType fLastY;
100 SkRegion::RunType fXCount;
102 SkRegion::RunType* firstX() {
return (SkRegion::RunType*)(
this + 1); }
103 Scanline* nextScanline() {
105 return (Scanline*)((SkRegion::RunType*)(
this + 1) + fXCount + 1);
108 SkRegion::RunType* fStorage;
109 Scanline* fCurrScanline;
110 Scanline* fPrevScanline;
112 SkRegion::RunType* fCurrXPtr;
113 SkRegion::RunType fTop;
117 bool collapsWithPrev() {
118 if (fPrevScanline !=
nullptr &&
119 fPrevScanline->fLastY + 1 == fCurrScanline->fLastY &&
120 fPrevScanline->fXCount == fCurrScanline->fXCount &&
121 sk_memeq32(fPrevScanline->firstX(), fCurrScanline->firstX(), fCurrScanline->fXCount))
124 fPrevScanline->fLastY = fCurrScanline->fLastY;
132 : fStorage(nullptr) {
140 if ((maxHeight | maxTransitions) < 0) {
150 maxTransitions = safe.
addInt(maxTransitions, 2);
162 if (!safe || !SkTFitsIn<int32_t>(
count)) {
167 fStorage = (SkRegion::RunType*)
sk_malloc_canfail(fStorageCount,
sizeof(SkRegion::RunType));
168 if (
nullptr == fStorage) {
172 fCurrScanline =
nullptr;
173 fPrevScanline =
nullptr;
178 if (fCurrScanline ==
nullptr) {
179 fTop = (SkRegion::RunType)(
y);
180 fCurrScanline = (Scanline*)fStorage;
181 fCurrScanline->fLastY = (SkRegion::RunType)(
y);
182 fCurrXPtr = fCurrScanline->firstX();
186 if (
y > fCurrScanline->fLastY) {
188 fCurrScanline->fXCount = (SkRegion::RunType)((
int)(fCurrXPtr - fCurrScanline->firstX()));
190 int prevLastY = fCurrScanline->fLastY;
191 if (!this->collapsWithPrev()) {
192 fPrevScanline = fCurrScanline;
193 fCurrScanline = fCurrScanline->nextScanline();
196 if (
y - 1 > prevLastY) {
197 fCurrScanline->fLastY = (SkRegion::RunType)(
y - 1);
198 fCurrScanline->fXCount = 0;
199 fCurrScanline = fCurrScanline->nextScanline();
202 fCurrScanline->fLastY = (SkRegion::RunType)(
y);
203 fCurrXPtr = fCurrScanline->firstX();
207 if (fCurrXPtr > fCurrScanline->firstX() && fCurrXPtr[-1] ==
x) {
208 fCurrXPtr[-1] = (SkRegion::RunType)(
x +
width);
210 fCurrXPtr[0] = (SkRegion::RunType)(
x);
211 fCurrXPtr[1] = (SkRegion::RunType)(
x +
width);
214 SkASSERT(fCurrXPtr - fStorage < fStorageCount);
218 if (fCurrScanline ==
nullptr) {
222 const SkRegion::RunType*
line = fStorage;
223 const SkRegion::RunType* stop = (
const SkRegion::RunType*)fCurrScanline;
231 SkASSERT((
const SkRegion::RunType*)fCurrScanline - fStorage == 5);
233 Scanline*
line = (Scanline*)fStorage;
241 SkASSERT((
const SkRegion::RunType*)fCurrScanline - fStorage > 4);
243 Scanline*
line = (Scanline*)fStorage;
244 const Scanline* stop = fCurrScanline;
248 *runs++ = (SkRegion::RunType)(
line->fLastY + 1);
250 *runs++ =
count >> 1;
252 memcpy(runs,
line->firstX(),
count *
sizeof(SkRegion::RunType));
257 }
while (
line < stop);
263 static const uint8_t gPathVerbToInitialLastIndex[] = {
273 return gPathVerbToInitialLastIndex[verb];
277 static const uint8_t gPathVerbToMaxEdges[] = {
287 return gPathVerbToMaxEdges[verb];
305 for (
int i = 1;
i <= lastIndex;
i++) {
306 if (top > pts[
i].fY) {
308 }
else if (bot < pts[
i].fY) {
313 if (top > pts[0].fY) {
315 }
else if (bot < pts[0].fY) {
331 if (
path.isInverseFillType()) {
334 return dst->setEmpty();
352 if (
clip.isComplex()) {
362 static constexpr int kTileSize = 32767 >> 1;
363 const SkIRect pathBounds =
path.getBounds().roundOut();
370 for (int64_t top = clipBounds.
fTop; top < clipBounds.
fBottom; top += kTileSize) {
397 int pathTop, pathBot;
399 if (0 == pathTransitions) {
403 int clipTop, clipBot;
404 int clipTransitions =
clip.count_runtype_values(&clipTop, &clipBot);
406 int top =
std::max(pathTop, clipTop);
407 int bot =
std::min(pathBot, clipBot);
415 std::max(pathTransitions, clipTransitions),
416 path.isInverseFillType())) {
427 }
else if (count == kRectRegionRuns) {
458 void set(
int x,
int y0,
int y1) {
516 while (0 == edge->
fFlags) {
539 }
while (edge !=
base);
547 return (
a.fX ==
b.fX) ?
a.top() <
b.top() :
a.fX <
b.fX;
574 edge[0].
set(r.fLeft, r.fBottom, r.fTop);
575 edge[1].
set(r.fRight, r.fTop, r.fBottom);
static float prev(float f)
#define SkDEBUGFAIL(message)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API void sk_free(void *)
static void * sk_malloc_canfail(size_t size)
static constexpr int16_t SK_MaxS16
static constexpr int16_t SK_MinS16
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static constexpr int SkRegion_kRunTypeSentinel
static unsigned verb_to_initial_last_index(unsigned verb)
static unsigned verb_to_max_edges(unsigned verb)
static void find_link(Edge *base, Edge *stop)
static bool sk_memeq32(const int32_t *SK_RESTRICT a, const int32_t *SK_RESTRICT b, int count)
static int count_path_runtype_values(const SkPath &path, int *itop, int *ibot)
static bool check_inverse_on_empty_return(SkRegion *dst, const SkPath &path, const SkRegion &clip)
static int extract_path(Edge *edge, Edge *stop, SkPath *path)
#define SkScalarRoundToInt(x)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr int32_t SkToS32(S x)
constexpr uint8_t SkToU8(S x)
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Verb next(SkPoint pts[4])
const SkRect & getBounds() const
SkRegion::RunType RunType
const SkIRect & rect() const
void translate(int dx, int dy)
bool getBoundaryPath(SkPath *path) const
@ kUnion_Op
target unioned with operand
@ kIntersect_Op
target intersected with operand
const SkIRect & getBounds() const
bool op(const SkIRect &rect, Op op)
bool setRect(const SkIRect &rect)
bool setPath(const SkPath &path, const SkRegion &clip)
void swap(SkRegion &other)
int computeRunCount() const
void copyToRgn(SkRegion::RunType runs[]) const
bool init(int maxHeight, int maxTransitions, bool pathIsInverse)
void blitH(int x, int y, int width) override
Blit a horizontal run of one or more pixels.
void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override
void copyToRect(SkIRect *) const
size_t add(size_t x, size_t y)
size_t mul(size_t x, size_t y)
static bool PathRequiresTiling(const SkIRect &bounds)
static void FillPath(const SkPath &, const SkIRect &, SkBlitter *)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Optional< SkRect > bounds
void Validate(const Table &table)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
bool operator()(const Edge &a, const Edge &b) const
void set(int x, int y0, int y1)
SkRegionPriv::RunType fY0
SkRegionPriv::RunType fY1
static bool Intersects(const SkIRect &a, const SkIRect &b)
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
void offset(int32_t dx, int32_t dy)
int32_t fLeft
smaller x-axis bounds
void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
int32_t fRight
larger x-axis bounds
void set(const SkIRect &src)
SkRegion::RunType * writable_runs()
static RunHead * Alloc(int count)
void computeRunBounds(SkIRect *bounds)