Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkScan_AntiPath.cpp File Reference
#include "include/core/SkPath.h"
#include "include/core/SkRect.h"
#include "include/core/SkRegion.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkMath.h"
#include "src/core/SkAAClip.h"
#include "src/core/SkBlitter.h"
#include "src/core/SkRasterClip.h"
#include "src/core/SkScan.h"
#include "src/core/SkScanPriv.h"
#include <cstdint>

Go to the source code of this file.

Functions

static SkIRect safeRoundOut (const SkRect &src)
 
static int overflows_short_shift (int value, int shift)
 
static int rect_overflows_short_shift (SkIRect rect, int shift)
 

Function Documentation

◆ overflows_short_shift()

static int overflows_short_shift ( int  value,
int  shift 
)
static

Definition at line 35 of file SkScan_AntiPath.cpp.

35 {
36 const int s = 16 + shift;
37 return (SkLeftShift(value, s) >> s) - value;
38}
static constexpr int32_t SkLeftShift(int32_t value, int32_t shift)
Definition SkMath.h:37
struct MyStruct s
uint8_t value

◆ rect_overflows_short_shift()

static int rect_overflows_short_shift ( SkIRect  rect,
int  shift 
)
static

Would any of the coordinates of this rectangle not fit in a short, when left-shifted by shift?

Definition at line 44 of file SkScan_AntiPath.cpp.

44 {
45 SkASSERT(!overflows_short_shift(8191, shift));
46 SkASSERT(overflows_short_shift(8192, shift));
49
50 // Since we expect these to succeed, we bit-or together
51 // for a tiny extra bit of speed.
52 return overflows_short_shift(rect.fLeft, shift) |
53 overflows_short_shift(rect.fRight, shift) |
54 overflows_short_shift(rect.fTop, shift) |
55 overflows_short_shift(rect.fBottom, shift);
56}
#define SkASSERT(cond)
Definition SkAssert.h:116
static int overflows_short_shift(int value, int shift)
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350

◆ safeRoundOut()

static SkIRect safeRoundOut ( const SkRect src)
static

Definition at line 22 of file SkScan_AntiPath.cpp.

22 {
23 // roundOut will pin huge floats to max/min int
24 SkIRect dst = src.roundOut();
25
26 // intersect with a smaller huge rect, so the rect will not be considered empty for being
27 // too large. e.g. { -SK_MaxS32 ... SK_MaxS32 } is considered empty because its width
28 // exceeds signed 32bit.
29 const int32_t limit = SK_MaxS32 >> SK_SUPERSAMPLE_SHIFT;
30 (void)dst.intersect({ -limit, -limit, limit, limit});
31
32 return dst;
33}
static constexpr int32_t SK_MaxS32
Definition SkMath.h:21
#define SK_SUPERSAMPLE_SHIFT
Definition SkScanPriv.h:16
dst
Definition cp.py:12