Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Macros | Functions
SkScanPriv.h File Reference
#include "include/core/SkPath.h"
#include "src/core/SkBlitter.h"
#include "src/core/SkScan.h"

Go to the source code of this file.

Classes

class  SkScanClipper
 

Macros

#define SK_SUPERSAMPLE_SHIFT   2
 

Functions

void sk_fill_path (const SkPath &path, const SkIRect &clipRect, SkBlitter *blitter, int start_y, int stop_y, int shiftEdgesUp, bool pathContainedInClip)
 
void sk_blit_above (SkBlitter *, const SkIRect &avoid, const SkRegion &clip)
 
void sk_blit_below (SkBlitter *, const SkIRect &avoid, const SkRegion &clip)
 
template<class EdgeType >
static void remove_edge (EdgeType *edge)
 
template<class EdgeType >
static void insert_edge_after (EdgeType *edge, EdgeType *afterMe)
 
template<class EdgeType >
void backward_insert_edge_based_on_x (EdgeType *edge)
 
template<class EdgeType >
EdgeTypebackward_insert_start (EdgeType *prev, SkFixed x)
 

Macro Definition Documentation

◆ SK_SUPERSAMPLE_SHIFT

#define SK_SUPERSAMPLE_SHIFT   2

Definition at line 16 of file SkScanPriv.h.

Function Documentation

◆ backward_insert_edge_based_on_x()

template<class EdgeType >
void backward_insert_edge_based_on_x ( EdgeType edge)

Definition at line 59 of file SkScanPriv.h.

59 {
60 SkFixed x = edge->fX;
61 EdgeType* prev = edge->fPrev;
62 while (prev->fPrev && prev->fX > x) {
63 prev = prev->fPrev;
64 }
65 if (prev->fNext != edge) {
66 remove_edge(edge);
68 }
69}
static float prev(float f)
int32_t SkFixed
Definition SkFixed.h:25
static void remove_edge(EdgeType *edge)
Definition SkScanPriv.h:45
static void insert_edge_after(EdgeType *edge, EdgeType *afterMe)
Definition SkScanPriv.h:51
double x

◆ backward_insert_start()

template<class EdgeType >
EdgeType * backward_insert_start ( EdgeType prev,
SkFixed  x 
)

Definition at line 76 of file SkScanPriv.h.

76 {
77 while (prev->fPrev && prev->fX > x) {
78 prev = prev->fPrev;
79 }
80 return prev;
81}

◆ insert_edge_after()

template<class EdgeType >
static void insert_edge_after ( EdgeType edge,
EdgeType afterMe 
)
inlinestatic

Definition at line 51 of file SkScanPriv.h.

51 {
52 edge->fPrev = afterMe;
53 edge->fNext = afterMe->fNext;
54 afterMe->fNext->fPrev = edge;
55 afterMe->fNext = edge;
56}

◆ remove_edge()

template<class EdgeType >
static void remove_edge ( EdgeType edge)
inlinestatic

Definition at line 45 of file SkScanPriv.h.

45 {
46 edge->fPrev->fNext = edge->fNext;
47 edge->fNext->fPrev = edge->fPrev;
48}

◆ sk_blit_above()

void sk_blit_above ( SkBlitter blitter,
const SkIRect avoid,
const SkRegion clip 
)

Definition at line 486 of file SkScan_Path.cpp.

486 {
487 const SkIRect& cr = clip.getBounds();
488 SkIRect tmp;
489
490 tmp.fLeft = cr.fLeft;
491 tmp.fRight = cr.fRight;
492 tmp.fTop = cr.fTop;
493 tmp.fBottom = ir.fTop;
494 if (!tmp.isEmpty()) {
495 blitter->blitRectRegion(tmp, clip);
496 }
497}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
void blitRectRegion(const SkIRect &rect, const SkRegion &clip)
const SkRect & getBounds() const
Definition SkPath.cpp:420
int32_t fBottom
larger y-axis bounds
Definition SkRect.h:36
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
bool isEmpty() const
Definition SkRect.h:202
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
int32_t fRight
larger x-axis bounds
Definition SkRect.h:35

◆ sk_blit_below()

void sk_blit_below ( SkBlitter blitter,
const SkIRect avoid,
const SkRegion clip 
)

Definition at line 499 of file SkScan_Path.cpp.

499 {
500 const SkIRect& cr = clip.getBounds();
501 SkIRect tmp;
502
503 tmp.fLeft = cr.fLeft;
504 tmp.fRight = cr.fRight;
505 tmp.fTop = ir.fBottom;
506 tmp.fBottom = cr.fBottom;
507 if (!tmp.isEmpty()) {
508 blitter->blitRectRegion(tmp, clip);
509 }
510}

◆ sk_fill_path()

void sk_fill_path ( const SkPath path,
const SkIRect clipRect,
SkBlitter blitter,
int  start_y,
int  stop_y,
int  shiftEdgesUp,
bool  pathContainedInClip 
)

Definition at line 403 of file SkScan_Path.cpp.

404 {
405 SkASSERT(blitter);
406
407 SkIRect shiftedClip = clipRect;
408 shiftedClip.fLeft = SkLeftShift(shiftedClip.fLeft, shiftEdgesUp);
409 shiftedClip.fRight = SkLeftShift(shiftedClip.fRight, shiftEdgesUp);
410 shiftedClip.fTop = SkLeftShift(shiftedClip.fTop, shiftEdgesUp);
411 shiftedClip.fBottom = SkLeftShift(shiftedClip.fBottom, shiftEdgesUp);
412
413 SkBasicEdgeBuilder builder(shiftEdgesUp);
414 int count = builder.buildEdges(path, pathContainedInClip ? nullptr : &shiftedClip);
415 SkEdge** list = builder.edgeList();
416
417 if (0 == count) {
418 if (path.isInverseFillType()) {
419 /*
420 * Since we are in inverse-fill, our caller has already drawn above
421 * our top (start_y) and will draw below our bottom (stop_y). Thus
422 * we need to restrict our drawing to the intersection of the clip
423 * and those two limits.
424 */
426 if (rect.fTop < start_y) {
427 rect.fTop = start_y;
428 }
429 if (rect.fBottom > stop_y) {
430 rect.fBottom = stop_y;
431 }
432 if (!rect.isEmpty()) {
433 blitter->blitRect(rect.fLeft << shiftEdgesUp,
434 rect.fTop << shiftEdgesUp,
435 rect.width() << shiftEdgesUp,
436 rect.height() << shiftEdgesUp);
437 }
438 }
439 return;
440 }
441
442 SkEdge headEdge, tailEdge, *last;
443 // this returns the first and last edge after they're sorted into a dlink list
444 SkEdge* edge = sort_edges(list, count, &last);
445
446 headEdge.fPrev = nullptr;
447 headEdge.fNext = edge;
448 headEdge.fFirstY = kEDGE_HEAD_Y;
449 headEdge.fX = SK_MinS32;
450 edge->fPrev = &headEdge;
451
452 tailEdge.fPrev = last;
453 tailEdge.fNext = nullptr;
454 tailEdge.fFirstY = kEDGE_TAIL_Y;
455 last->fNext = &tailEdge;
456
457 // now edge is the head of the sorted linklist
458
459 start_y = SkLeftShift(start_y, shiftEdgesUp);
460 stop_y = SkLeftShift(stop_y, shiftEdgesUp);
461 if (!pathContainedInClip && start_y < shiftedClip.fTop) {
462 start_y = shiftedClip.fTop;
463 }
464 if (!pathContainedInClip && stop_y > shiftedClip.fBottom) {
465 stop_y = shiftedClip.fBottom;
466 }
467
469 PrePostProc proc = nullptr;
470
471 if (path.isInverseFillType()) {
472 ib.setBlitter(blitter, clipRect, shiftEdgesUp);
473 blitter = &ib;
475 }
476
477 // count >= 2 is required as the convex walker does not handle missing right edges
478 if (path.isConvex() && (nullptr == proc) && count >= 2) {
479 walk_simple_edges(&headEdge, blitter, start_y, stop_y);
480 } else {
481 walk_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, proc,
482 shiftedClip.right());
483 }
484}
int count
#define SkASSERT(cond)
Definition SkAssert.h:116
static constexpr int32_t SkLeftShift(int32_t value, int32_t shift)
Definition SkMath.h:37
static constexpr int32_t SK_MinS32
Definition SkMath.h:22
static SkEdge * sort_edges(SkEdge *list[], int count, SkEdge **last)
#define kEDGE_HEAD_Y
static void walk_simple_edges(SkEdge *prevHead, SkBlitter *blitter, int start_y, int stop_y)
static void walk_edges(SkEdge *prevHead, SkPathFillType fillType, SkBlitter *blitter, int start_y, int stop_y, PrePostProc proc, int rightClip)
void(* PrePostProc)(SkBlitter *blitter, int y, bool isStartOfScanline)
#define kEDGE_TAIL_Y
static void PrePostInverseBlitterProc(SkBlitter *blitter, int y, bool isStart)
void setBlitter(SkBlitter *blitter, const SkIRect &clip, int shift)
virtual void blitRect(int x, int y, int width, int height)
Blit a solid rectangle one or more pixels wide.
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
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
Definition switches.h:57
SkEdge * fNext
Definition SkEdge.h:33
SkEdge * fPrev
Definition SkEdge.h:34
SkFixed fX
Definition SkEdge.h:36
int32_t fFirstY
Definition SkEdge.h:38
constexpr int32_t right() const
Definition SkRect.h:127