41#define OUTSET_BEFORE_CLIP_TEST true
43#define HLINE_STACK_BUFFER 100
48 return (
value * dot6) >> 6;
54 static uint8_t gGammaTable[256];
55 #define ApplyGamma(table, alpha) (table)[alpha]
57 static void build_gamma_table() {
58 static bool gInit =
false;
61 for (
int i = 0; i < 256; i++) {
68 gGammaTable[i] =
SkToU8(n);
74 #define ApplyGamma(table, alpha) SkToU8(alpha)
130 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
153 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
175 int lower_y = fy >> 16;
176 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
190 int lower_y = fy >> 16;
191 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
194 }
while (++
x < stopx);
207 int a = (uint8_t)((fx >> 8) & 0xFF);
227 int a = (uint8_t)((fx >> 8) & 0xFF);
247 uint8_t
a = (uint8_t)((fx >> 8) & 0xFF);
259 uint8_t
a = (uint8_t)((fx >> 8) & 0xFF);
262 }
while (++
y < stopy);
274#define SkBITCOUNT(x) (sizeof(x) << 3)
286static inline int good_int(
int x) {
291 return !(good_int(
a) & good_int(
b) & good_int(c) & good_int(
d));
296static bool canConvertFDot6ToFixed(
SkFDot6 x) {
297 const int maxDot6 =
SK_MaxS32 >> (16 - 6);
310 int result = ordinate & 63;
315 int result = ((ordinate - 1) & 63) + 1;
332 SkASSERT(canConvertFDot6ToFixed(x0));
333 SkASSERT(canConvertFDot6ToFixed(y0));
334 SkASSERT(canConvertFDot6ToFixed(x1));
335 SkASSERT(canConvertFDot6ToFixed(y1));
344 int hx = (x0 >> 1) + (x1 >> 1);
345 int hy = (y0 >> 1) + (y1 >> 1);
351 int scaleStart, scaleStop;
373 hairBlitter = &hline_blitter;
377 fstart += (slope * (32 - (x0 & 63)) + 32) >> 6;
378 hairBlitter = &horish_blitter;
382 if (istop - istart == 1) {
384 scaleStart = x1 - x0;
385 SkASSERT(scaleStart >= 0 && scaleStart <= 64);
388 scaleStart = 64 - (x0 & 63);
393 if (istart >=
clip->fRight || istop <= clip->fLeft) {
396 if (istart < clip->fLeft) {
397 fstart += slope * (
clip->fLeft - istart);
398 istart =
clip->fLeft;
400 if (istop - istart == 1) {
406 if (istop >
clip->fRight) {
407 istop =
clip->fRight;
412 if (istart == istop) {
424#ifdef OUTSET_BEFORE_CLIP_TEST
428 if (top >=
clip->fBottom || bottom <= clip->fTop) {
431 if (
clip->fTop <= top &&
clip->fBottom >= bottom) {
450 hairBlitter = &vline_blitter;
454 fstart += (slope * (32 - (y0 & 63)) + 32) >> 6;
455 hairBlitter = &vertish_blitter;
459 if (istop - istart == 1) {
461 scaleStart = y1 - y0;
462 SkASSERT(scaleStart >= 0 && scaleStart <= 64);
465 scaleStart = 64 - (y0 & 63);
470 if (istart >=
clip->fBottom || istop <= clip->fTop) {
473 if (istart < clip->fTop) {
474 fstart += slope * (
clip->fTop - istart);
477 if (istop - istart == 1) {
483 if (istop >
clip->fBottom) {
484 istop =
clip->fBottom;
501#ifdef OUTSET_BEFORE_CLIP_TEST
505 if (
left >=
clip->fRight || right <= clip->fLeft) {
517 blitter = &rectClipper;
521 hairBlitter->
setup(blitter);
524 if (scaleStart > 0 && scaleStop > 0) {
530 fstart = hairBlitter->
drawCap(istart, fstart, slope, scaleStart);
532 int fullSpans = istop - istart - (scaleStop > 0);
534 fstart = hairBlitter->
drawLine(istart, istart + fullSpans, fstart, slope);
537 hairBlitter->
drawCap(istop - 1, fstart, slope, scaleStop);
571 for (
int i = 0; i < arrayCount - 1; ++i) {
591 SkFDot6 top = std::min(y0, y1);
593 SkFDot6 bottom = std::max(y0, y1);
601 if (
clip->quickReject(ir)) {
604 if (!
clip->quickContains(ir)) {
606 const SkIRect* r = &iter.rect();
608 while (!iter.done()) {
624 pts[0].
set(rect.fLeft, rect.fTop);
625 pts[1].
set(rect.fRight, rect.fTop);
626 pts[2].
set(rect.fRight, rect.fBottom);
627 pts[3].
set(rect.fLeft, rect.fBottom);
637 return (
x + 0x80) >> 8;
644 if ((L >> 8) == ((
R - 1) >> 8)) {
669 if (L >=
R ||
T >=
B) {
673 if (top == ((
B - 1) >> 8)) {
687 if (
left == ((
R - 1) >> 8)) {
696 if (
width > 0 && fillInner) {
720 if (
nullptr ==
clip) {
729 if (clipBounds.
contains(outerBounds)) {
741 const SkIRect& rr = clipper.rect();
743 while (!clipper.done()) {
765 if (
clip.quickContains(outerBounds)) {
808 while (!clipper.done()) {
809 newR.
set(clipper.rect());
833#define SkAlphaMulRound(a, b) SkMulDiv255Round(a, b)
837 if (L <
R &&
T <
B) {
843 return (
int)(
x * 256);
851 return (
x + 0xFF) >> 8;
865 if ((L >> 8) == ((
R - 1) >> 8)) {
869 widClamp = widClamp - (widClamp >> 8);
896 if (top == ((
B - 1) >> 8)) {
898 int alpha = 256 - (
B -
T);
930 edge2 -= (edge1 & 0xFF);
954 if (
clip->quickReject(outer)) {
958 blitter = clipper.
apply(blitter,
clip, &outer);
964 rx = strokeSize.
fX - rx;
965 ry = strokeSize.
fY - ry;
977 if (strokeSize.
fX < 1 || strokeSize.
fY < 1) {
985 antifilldot8(outerL, outerT, outerR, outerB, blitter,
false);
990 if (innerL >= innerR || innerT >= innerB) {
#define SkAlphaMul(value, alpha256)
SkFixed SkFDot6ToFixed(SkFDot6 x)
#define SkScalarToFDot6(x)
#define SkFixedCeilToInt(x)
#define SkFixedFloorToInt(x)
static constexpr int32_t SkLeftShift(int32_t value, int32_t shift)
static constexpr int32_t SK_MaxS32
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)
void swap(sk_sp< T > &a, sk_sp< T > &b)
static int32_t SkAbs32(int32_t value)
static void XRect_set(SkXRect *xr, const SkIRect &src)
static void XRect_roundOut(const SkXRect &xr, SkIRect *dst)
static void antifilldot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B, SkBlitter *blitter, bool fillInner)
#define SkAlphaMulRound(a, b)
#define ApplyGamma(table, alpha)
static int any_bad_ints(int a, int b, int c, int d)
static void align_thin_stroke(FDot8 &edge1, FDot8 &edge2)
static int bad_int(int x)
static void fillcheckrect(int L, int T, int R, int B, SkBlitter *blitter)
static void call_hline_blitter(SkBlitter *blitter, int x, int y, int count, U8CPU alpha)
static void innerstrokedot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B, SkBlitter *blitter)
static FDot8 SkScalarToFDot8(SkScalar x)
static FDot8 SkFixedToFDot8(SkFixed x)
static SkFixed fastfixdiv(SkFDot6 a, SkFDot6 b)
static int SmallDot6Scale(int value, int dot6)
static U8CPU InvAlphaMul(U8CPU a, U8CPU b)
static void do_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha, SkBlitter *blitter)
static int FDot8Floor(FDot8 x)
static int FDot8Ceil(FDot8 x)
static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1, const SkIRect *clip, SkBlitter *blitter)
static int contribution_64(SkFDot6 ordinate)
static void antifillrect(const SkXRect &xr, SkBlitter *blitter)
static void inner_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha, SkBlitter *blitter)
#define HLINE_STACK_BUFFER
constexpr uint8_t SkToU8(S x)
constexpr int16_t SkToS16(S x)
SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed slope) override
SkFixed drawCap(int x, SkFixed fy, SkFixed slope, int mod64) override
SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed dy) override
SkFixed drawCap(int x, SkFixed fy, SkFixed dy, int mod64) override
const SkRegion & getRgn() const
virtual ~SkAntiHairBlitter()
virtual SkFixed drawCap(int x, SkFixed fy, SkFixed slope, int mod64)=0
SkBlitter * getBlitter() const
void setup(SkBlitter *blitter)
virtual SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed slope)=0
SkBlitter * apply(SkBlitter *blitter, const SkRegion *clip, const SkIRect *bounds=nullptr)
virtual void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1)
virtual void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1)
virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])=0
virtual void blitV(int x, int y, int height, SkAlpha alpha)
Blit a vertical run of pixels with a constant alpha value.
virtual void blitRect(int x, int y, int width, int height)
Blit a solid rectangle one or more pixels wide.
static bool IntersectLine(const SkPoint src[2], const SkRect &clip, SkPoint dst[2])
const SkRect & getBounds() const
bool isRect(SkRect *rect, bool *isClosed=nullptr, SkPathDirection *direction=nullptr) const
bool contains(SkScalar x, SkScalar y) const
void init(SkBlitter *blitter, const SkIRect &clipRect)
static void AntiHairRect(const SkRect &, const SkRasterClip &, SkBlitter *)
static void AntiFillRect(const SkRect &, const SkRasterClip &, SkBlitter *)
static void AntiHairLine(const SkPoint[], int count, const SkRasterClip &, SkBlitter *)
static void AntiFrameRect(const SkRect &, const SkPoint &strokeSize, const SkRasterClip &, SkBlitter *)
static void AntiFillXRect(const SkXRect &, const SkRasterClip &, SkBlitter *)
SkFixed drawCap(int y, SkFixed fx, SkFixed dx, int mod64) override
SkFixed drawLine(int y, int stopy, SkFixed fx, SkFixed dx) override
SkFixed drawCap(int y, SkFixed fx, SkFixed dx, int mod64) override
SkFixed drawLine(int y, int stopy, SkFixed fx, SkFixed dx) override
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float max(float r, float g, float b)
bool intersect(const SkIRect &r)
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
bool contains(int32_t x, int32_t y) const
int32_t fRight
larger x-axis bounds
void set(float x, float y)
SkScalar fBottom
larger y-axis bounds
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
void outset(float dx, float dy)
SkScalar fRight
larger x-axis bounds
void roundOut(SkIRect *dst) const
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
void set(const SkIRect &src)
SkScalar fTop
smaller y-axis bounds