32#include <initializer_list>
36 if (
a.fFormat !=
b.fFormat ||
a.fBounds !=
b.fBounds) {
39 if (!
a.fImage && !
b.fImage) {
42 if (!
a.fImage || !
b.fImage) {
46 size_t wbytes =
a.fBounds.width();
49 wbytes = (wbytes + 7) >> 3;
65 const int h =
a.fBounds.height();
66 const char* aptr = (
const char*)
a.fImage;
67 const char* bptr = (
const char*)
b.fImage;
68 for (
int y = 0;
y <
h; ++
y) {
69 if (0 != memcmp(aptr, bptr, wbytes)) {
84 mask->
image() =
nullptr;
115 rc.aaRgn().copyToMask(mask);
120 if (
a.isEmpty() &&
b.isEmpty()) {
122 }
else if (
a.isEmpty() !=
b.isEmpty() ||
a.isBW() !=
b.isBW() ||
a.isRect() !=
b.isRect()) {
131 return mask0 == mask1;
156 return mask0 == mask1;
162 return rgn == aaclip;
167 path.getBounds().round(&ir);
174 for (
int i = 0;
i < 1000;
i++) {
224 const int teardrop_height = 12;
243 SkIRect r = { 10, 10, 40, 50 };
254 clip.copyToMask(&mask);
262 int dy = rand.
nextU() % (2*
N);
270 for (
int i = 0;
i < 10000;
i++) {
284 bool nonEmptyAA = clip2.
op(clip1, op);
288 "[%d %d %d %d] %s [%d %d %d %d] = BW:[%d %d %d %d] AA:[%d %d %d %d]\n",
289 nonEmptyAA == nonEmptyBW ?
"true" :
"false",
311 static const uint8_t gExpectedImage[] = {
312 0xFF, 0xFF, 0xFF, 0xFF,
313 0xFF, 0xFF, 0xFF, 0xFF,
314 0x00, 0x00, 0x00, 0x00,
315 0x00, 0x00, 0x00, 0x00,
316 0xFF, 0xFF, 0xFF, 0xFF,
317 0xFF, 0xFF, 0xFF, 0xFF,
327 for (
int i = 0;
i < 2; ++
i) {
332 clip.copyToMask(&mask);
364 size_t count,
bool changed) {
367 for (
size_t i = 0;
i <
count; ++
i) {
394 static const SkScalar gUnsafeX[] = {
406 r.
fLeft = 129.892181f;
407 r.
fTop = 10.3999996f;
424 path.addCircle(50, 50, 50);
430 int big = 0x70000000;
431 SkIRect r = { -big, -big, big, big };
static void imoveTo(SkPath &path, int x, int y)
static SkIRect rand_rect(SkRandom &rand, int n)
DEF_TEST(AAClip, reporter)
static void test_really_a_rect(skiatest::Reporter *reporter)
static void test_huge(skiatest::Reporter *reporter)
static void test_path_bounds(skiatest::Reporter *reporter)
static void make_rand_rgn(SkRegion *rgn, SkRandom &rand)
static bool equalsAAClip(const SkRegion &rgn)
static void did_dx_affect(skiatest::Reporter *reporter, const SkScalar dx[], size_t count, bool changed)
static void rand_irect(SkIRect *r, int N, SkRandom &rand)
static void test_path_with_hole(skiatest::Reporter *reporter)
static void test_regressions()
static void test_rgn(skiatest::Reporter *reporter)
static void icubicTo(SkPath &path, int x0, int y0, int x1, int y1, int x2, int y2)
static bool operator==(const SkMask &a, const SkMask &b)
static void setRgnToPath(SkRegion *rgn, const SkPath &path)
static void test_nearly_integral(skiatest::Reporter *reporter)
static void test_irect(skiatest::Reporter *reporter)
static void test_crbug_422693(skiatest::Reporter *reporter)
static void copyToMask(const SkRegion &rgn, SkMaskBuilder *mask)
static void test_empty(skiatest::Reporter *reporter)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_bzero(glyphs, sizeof(glyphs))
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkDEBUGFAIL(message)
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
constexpr SkColor SK_ColorBLACK
std::unique_ptr< uint8_t, SkFunctionObject< SkMaskBuilder::FreeImage > > SkAutoMaskFreeImage
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define REPORTER_ASSERT(r, cond,...)
bool setRect(const SkIRect &)
const SkIRect & getBounds() const
bool op(const SkIRect &, SkClipOp)
void copyToMask(SkMaskBuilder *) const
bool setRegion(const SkRegion &)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void clipRegion(const SkRegion &deviceRgn, SkClipOp op=SkClipOp::kIntersect)
static const SkMatrix & I()
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
const SkRect & getBounds() const
bool isRect(SkRect *rect, bool *isClosed=nullptr, SkPathDirection *direction=nullptr) const
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
bool op(const SkIRect &, SkClipOp)
void translate(int dx, int dy)
@ kXOR_Op
target exclusive or with operand
const SkIRect & getBounds() const
bool op(const SkIRect &rect, Op op)
bool setRect(const SkIRect &rect)
bool setPath(const SkPath &path, const SkRegion &clip)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
constexpr int32_t bottom() const
constexpr int32_t height() const
constexpr int32_t right() const
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
void offset(int32_t dx, int32_t dy)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static uint8_t * AllocImage(size_t bytes, AllocType=kUninit_Alloc)
@ k3D_Format
3 8bit per pixl planes: alpha, mul, add
@ kA8_Format
8bits per pixel mask (e.g. antialiasing)
@ kLCD16_Format
565 alpha for r/g/b
@ kARGB32_Format
SkPMColor.
@ kBW_Format
1bit per pixel mask (e.g. monochrome)
uint8_t const *const fImage
size_t computeImageSize() const
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
void roundOut(SkIRect *dst) const
void offset(float dx, float dy)
constexpr float height() const
static constexpr SkRect MakeWH(float w, float h)
void set(const SkIRect &src)
SkScalar fTop
smaller y-axis bounds