Flutter Engine
The Flutter Engine
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 487 of file SkScan_Path.cpp.

487 {
488 const SkIRect& cr = clip.getBounds();
489 SkIRect tmp;
490
491 tmp.fLeft = cr.fLeft;
492 tmp.fRight = cr.fRight;
493 tmp.fTop = cr.fTop;
494 tmp.fBottom = ir.fTop;
495 if (!tmp.isEmpty()) {
496 blitter->blitRectRegion(tmp, clip);
497 }
498}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
void blitRectRegion(const SkIRect &rect, const SkRegion &clip)
Definition: SkBlitter.cpp:300
const SkRect & getBounds() const
Definition: SkPath.cpp:430
Definition: SkRect.h:32
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 500 of file SkScan_Path.cpp.

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

◆ 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 404 of file SkScan_Path.cpp.

405 {
406 SkASSERT(blitter);
407
408 SkIRect shiftedClip = clipRect;
409 shiftedClip.fLeft = SkLeftShift(shiftedClip.fLeft, shiftEdgesUp);
410 shiftedClip.fRight = SkLeftShift(shiftedClip.fRight, shiftEdgesUp);
411 shiftedClip.fTop = SkLeftShift(shiftedClip.fTop, shiftEdgesUp);
412 shiftedClip.fBottom = SkLeftShift(shiftedClip.fBottom, shiftEdgesUp);
413
414 SkBasicEdgeBuilder builder(shiftEdgesUp);
415 int count = builder.buildEdges(path, pathContainedInClip ? nullptr : &shiftedClip);
416 SkEdge** list = builder.edgeList();
417
418 if (0 == count) {
419 if (path.isInverseFillType()) {
420 /*
421 * Since we are in inverse-fill, our caller has already drawn above
422 * our top (start_y) and will draw below our bottom (stop_y). Thus
423 * we need to restrict our drawing to the intersection of the clip
424 * and those two limits.
425 */
427 if (rect.fTop < start_y) {
428 rect.fTop = start_y;
429 }
430 if (rect.fBottom > stop_y) {
431 rect.fBottom = stop_y;
432 }
433 if (!rect.isEmpty()) {
434 blitter->blitRect(rect.fLeft << shiftEdgesUp,
435 rect.fTop << shiftEdgesUp,
436 rect.width() << shiftEdgesUp,
437 rect.height() << shiftEdgesUp);
438 }
439 }
440 return;
441 }
442
443 SkEdge headEdge, tailEdge, *last;
444 // this returns the first and last edge after they're sorted into a dlink list
445 SkEdge* edge = sort_edges(list, count, &last);
446
447 headEdge.fPrev = nullptr;
448 headEdge.fNext = edge;
449 headEdge.fFirstY = kEDGE_HEAD_Y;
450 headEdge.fX = SK_MinS32;
451 edge->fPrev = &headEdge;
452
453 tailEdge.fPrev = last;
454 tailEdge.fNext = nullptr;
455 tailEdge.fFirstY = kEDGE_TAIL_Y;
456 last->fNext = &tailEdge;
457
458 // now edge is the head of the sorted linklist
459
460 start_y = SkLeftShift(start_y, shiftEdgesUp);
461 stop_y = SkLeftShift(stop_y, shiftEdgesUp);
462 if (!pathContainedInClip && start_y < shiftedClip.fTop) {
463 start_y = shiftedClip.fTop;
464 }
465 if (!pathContainedInClip && stop_y > shiftedClip.fBottom) {
466 stop_y = shiftedClip.fBottom;
467 }
468
470 PrePostProc proc = nullptr;
471
472 if (path.isInverseFillType()) {
473 ib.setBlitter(blitter, clipRect, shiftEdgesUp);
474 blitter = &ib;
476 }
477
478 // count >= 2 is required as the convex walker does not handle missing right edges
479 if (path.isConvex() && (nullptr == proc) && count >= 2) {
480 walk_simple_edges(&headEdge, blitter, start_y, stop_y);
481 } else {
482 walk_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, proc,
483 shiftedClip.right());
484 }
485}
int count
Definition: FontMgrTest.cpp:50
#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
Definition: SkScan_Path.cpp:38
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
Definition: SkScan_Path.cpp:39
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.
Definition: SkBlitter.cpp:133
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
Definition: SkEdge.h:27
SkEdge * fNext
Definition: SkEdge.h:34
SkEdge * fPrev
Definition: SkEdge.h:35
SkFixed fX
Definition: SkEdge.h:37
int32_t fFirstY
Definition: SkEdge.h:39