Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkScanPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkScanPriv_DEFINED
9#define SkScanPriv_DEFINED
10
11#include "include/core/SkPath.h"
12#include "src/core/SkBlitter.h"
13#include "src/core/SkScan.h"
14
15// controls how much we super-sample (when we use that scan convertion)
16#define SK_SUPERSAMPLE_SHIFT 2
17
19public:
20 SkScanClipper(SkBlitter* blitter, const SkRegion* clip, const SkIRect& bounds,
21 bool skipRejectTest = false, bool boundsPreClipped = false);
22
23 SkBlitter* getBlitter() const { return fBlitter; }
24 const SkIRect* getClipRect() const { return fClipRect; }
25
26private:
27 SkRectClipBlitter fRectBlitter;
28 SkRgnClipBlitter fRgnBlitter;
29#ifdef SK_DEBUG
30 SkRectClipCheckBlitter fRectClipCheckBlitter;
31#endif
32 SkBlitter* fBlitter;
33 const SkIRect* fClipRect;
34};
35
36void sk_fill_path(const SkPath& path, const SkIRect& clipRect,
37 SkBlitter* blitter, int start_y, int stop_y, int shiftEdgesUp,
38 bool pathContainedInClip);
39
40// blit the rects above and below avoid, clipped to clip
41void sk_blit_above(SkBlitter*, const SkIRect& avoid, const SkRegion& clip);
42void sk_blit_below(SkBlitter*, const SkIRect& avoid, const SkRegion& clip);
43
44template<class EdgeType>
45static inline void remove_edge(EdgeType* edge) {
46 edge->fPrev->fNext = edge->fNext;
47 edge->fNext->fPrev = edge->fPrev;
48}
49
50template<class EdgeType>
51static inline void insert_edge_after(EdgeType* edge, EdgeType* afterMe) {
52 edge->fPrev = afterMe;
53 edge->fNext = afterMe->fNext;
54 afterMe->fNext->fPrev = edge;
55 afterMe->fNext = edge;
56}
57
58template<class EdgeType>
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}
70
71// Start from the right side, searching backwards for the point to begin the new edge list
72// insertion, marching forwards from here. The implementation could have started from the left
73// of the prior insertion, and search to the right, or with some additional caching, binary
74// search the starting point. More work could be done to determine optimal new edge insertion.
75template<class EdgeType>
77 while (prev->fPrev && prev->fX > x) {
78 prev = prev->fPrev;
79 }
80 return prev;
81}
82
83#endif
static float prev(float f)
int32_t SkFixed
Definition SkFixed.h:25
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
void sk_fill_path(const SkPath &path, const SkIRect &clipRect, SkBlitter *blitter, int start_y, int stop_y, int shiftEdgesUp, bool pathContainedInClip)
static void remove_edge(EdgeType *edge)
Definition SkScanPriv.h:45
void backward_insert_edge_based_on_x(EdgeType *edge)
Definition SkScanPriv.h:59
static void insert_edge_after(EdgeType *edge, EdgeType *afterMe)
Definition SkScanPriv.h:51
EdgeType * backward_insert_start(EdgeType *prev, SkFixed x)
Definition SkScanPriv.h:76
void sk_blit_above(SkBlitter *, const SkIRect &avoid, const SkRegion &clip)
void sk_blit_below(SkBlitter *, const SkIRect &avoid, const SkRegion &clip)
SkBlitter * getBlitter() const
Definition SkScanPriv.h:23
const SkIRect * getClipRect() const
Definition SkScanPriv.h:24
double x