42#define OUTSET_BEFORE_CLIP_TEST true
44#define HLINE_STACK_BUFFER 100
49 return (
value * dot6) >> 6;
55 static uint8_t gGammaTable[256];
56 #define ApplyGamma(table, alpha) (table)[alpha]
58 static void build_gamma_table() {
59 static bool gInit =
false;
62 for (
int i = 0;
i < 256;
i++) {
75 #define ApplyGamma(table, alpha) SkToU8(alpha)
131 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
154 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
176 int lower_y = fy >> 16;
177 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
191 int lower_y = fy >> 16;
192 uint8_t
a = (uint8_t)((fy >> 8) & 0xFF);
195 }
while (++
x < stopx);
208 int a = (uint8_t)((fx >> 8) & 0xFF);
228 int a = (uint8_t)((fx >> 8) & 0xFF);
248 uint8_t
a = (uint8_t)((fx >> 8) & 0xFF);
260 uint8_t
a = (uint8_t)((fx >> 8) & 0xFF);
263 }
while (++
y < stopy);
275#define SkBITCOUNT(x) (sizeof(x) << 3)
287static inline int good_int(
int x) {
292 return !(good_int(
a) & good_int(
b) & good_int(c) & good_int(
d));
297static bool canConvertFDot6ToFixed(
SkFDot6 x) {
298 const int maxDot6 =
SK_MaxS32 >> (16 - 6);
311 int result = ordinate & 63;
316 int result = ((ordinate - 1) & 63) + 1;
333 SkASSERT(canConvertFDot6ToFixed(x0));
334 SkASSERT(canConvertFDot6ToFixed(y0));
335 SkASSERT(canConvertFDot6ToFixed(x1));
336 SkASSERT(canConvertFDot6ToFixed(y1));
345 int hx = (x0 >> 1) + (x1 >> 1);
346 int hy = (y0 >> 1) + (y1 >> 1);
352 int scaleStart, scaleStop;
374 hairBlitter = &hline_blitter;
378 fstart += (slope * (32 - (x0 & 63)) + 32) >> 6;
379 hairBlitter = &horish_blitter;
383 if (istop - istart == 1) {
385 scaleStart = x1 - x0;
386 SkASSERT(scaleStart >= 0 && scaleStart <= 64);
389 scaleStart = 64 - (x0 & 63);
394 if (istart >=
clip->fRight || istop <= clip->fLeft) {
397 if (istart < clip->fLeft) {
398 fstart += slope * (
clip->fLeft - istart);
399 istart =
clip->fLeft;
401 if (istop - istart == 1) {
407 if (istop >
clip->fRight) {
408 istop =
clip->fRight;
413 if (istart == istop) {
425#ifdef OUTSET_BEFORE_CLIP_TEST
429 if (top >=
clip->fBottom || bottom <= clip->fTop) {
432 if (
clip->fTop <= top &&
clip->fBottom >= bottom) {
451 hairBlitter = &vline_blitter;
455 fstart += (slope * (32 - (y0 & 63)) + 32) >> 6;
456 hairBlitter = &vertish_blitter;
460 if (istop - istart == 1) {
462 scaleStart = y1 - y0;
463 SkASSERT(scaleStart >= 0 && scaleStart <= 64);
466 scaleStart = 64 - (y0 & 63);
471 if (istart >=
clip->fBottom || istop <= clip->fTop) {
474 if (istart < clip->fTop) {
475 fstart += slope * (
clip->fTop - istart);
478 if (istop - istart == 1) {
484 if (istop >
clip->fBottom) {
485 istop =
clip->fBottom;
502#ifdef OUTSET_BEFORE_CLIP_TEST
506 if (
left >=
clip->fRight || right <= clip->fLeft) {
518 blitter = &rectClipper;
522 hairBlitter->
setup(blitter);
525 if (scaleStart > 0 && scaleStop > 0) {
531 fstart = hairBlitter->
drawCap(istart, fstart, slope, scaleStart);
533 int fullSpans = istop - istart - (scaleStop > 0);
535 fstart = hairBlitter->
drawLine(istart, istart + fullSpans, fstart, slope);
538 hairBlitter->
drawCap(istop - 1, fstart, slope, scaleStop);
572 for (
int i = 0;
i < arrayCount - 1; ++
i) {
602 if (
clip->quickReject(ir)) {
605 if (!
clip->quickContains(ir)) {
607 const SkIRect* r = &iter.rect();
609 while (!iter.done()) {
638 return (
x + 0x80) >> 8;
645 if ((
L >> 8) == ((
R - 1) >> 8)) {
670 if (
L >=
R ||
T >=
B) {
674 if (top == ((
B - 1) >> 8)) {
688 if (
left == ((
R - 1) >> 8)) {
697 if (
width > 0 && fillInner) {
721 if (
nullptr ==
clip) {
730 if (clipBounds.
contains(outerBounds)) {
742 const SkIRect& rr = clipper.rect();
744 while (!clipper.done()) {
766 if (
clip.quickContains(outerBounds)) {
809 while (!clipper.done()) {
810 newR.
set(clipper.rect());
834#define SkAlphaMulRound(a, b) SkMulDiv255Round(a, b)
838 if (
L <
R &&
T <
B) {
844 return (
int)(
x * 256);
852 return (
x + 0xFF) >> 8;
866 if ((
L >> 8) == ((
R - 1) >> 8)) {
870 widClamp = widClamp - (widClamp >> 8);
897 if (top == ((
B - 1) >> 8)) {
899 int alpha = 256 - (
B -
T);
931 edge2 -= (edge1 & 0xFF);
955 if (
clip->quickReject(outer)) {
959 blitter = clipper.
apply(blitter,
clip, &outer);
965 rx = strokeSize.
fX - rx;
966 ry = strokeSize.
fY - ry;
978 if (strokeSize.
fX < 1 || strokeSize.
fY < 1) {
986 antifilldot8(outerL, outerT, outerR, outerB, blitter,
false);
991 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)
static float min(float r, float g, float b)
sk_sp< SkBlender > blender SkRect rect
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
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