30 const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
32 const SkVector vec[] = { { rad, rad }, { 0, rad }, { rad, rad }, { 0, rad } };
40 { 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554432.0 }, { 110.0f, 5.0f }
53 const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
67 static const SkRect oooRects[] = {
73 static const SkRect emptyRects[] = {
74 { 100, 100, 100, 200 },
75 { 100, 100, 200, 100 },
76 { 100, 100, 100, 100 },
80 static const SkVector radii[4] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 } };
139 SkRect r = { 0, 0, 100, 100 };
142 rr.
inset(-20, -20, &rr2);
145 rr.
inset(20, 20, &rr2);
152 rr.
inset(19, 19, &rr2);
154 rr.
inset(20, 20, &rr2);
171 SkRect ninePatchRadii = { l, t, r,
b };
173 ninePatchRadii.
toQuad(rquad);
174 for (
int i = 0;
i < 4; ++
i) {
179 SkVector radii[4] = { { l, t }, { r, t }, { r,
b }, { l,
b } };
195 for (
int i = 0;
i < 4; ++
i) {
208 for (
int i = 0;
i < 4; ++
i) {
212 SkVector rr1_2_radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
227 for (
int i = 0;
i < 4; ++
i) {
233 SkVector rr2_2_radii[4] = { { halfPoint.
fX, halfPoint.
fY }, { halfPoint.
fX, halfPoint.
fY },
234 { halfPoint.
fX, halfPoint.
fY }, { halfPoint.
fX, halfPoint.
fY } };
249 for (
int i = 0;
i < 4; ++
i) {
253 SkVector rr3_2_radii[4] = { { 5, 5 }, { 5, 5 }, { 5, 5 }, { 5, 5 } };
269 0.926942348f, 0.642850280f, 0.529063463f, 0.587844372f,
274 SkPoint radii2[4] = { { 0, 0 }, { 0, 0 }, { 50, 50 }, { 20, 50 } };
282 for (
int i = 0;
i < 4; ++
i) {
314 SkPoint radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
324 SkPoint radii2[4] = { { 0, 0 }, { 20, 20 }, { 50, 50 }, { 20, 50 } };
354 SkPoint radii[4] = { { 0, 0 }, { 20, 20 }, { 50, 50 }, { 20, 50 } };
368 SkPoint radii[4] = { { 50, 100 }, { 100, 50 }, { 50, 100 }, { 100, 50 } };
396 int numSteps,
const bool*
contains) {
398 for (
int i = 0;
i < numSteps; ++
i) {
414 static const int kNumRRects = 4;
415 static const SkVector gRadii[kNumRRects][4] = {
416 { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
417 { { 20, 20 }, { 20, 20 }, { 20, 20 }, { 20, 20 } },
418 { { 10, 10 }, { 10, 10 }, { 10, 10 }, { 10, 10 } },
419 { { 0, 0 }, { 20, 20 }, { 10, 10 }, { 30, 30 } }
423 for (
int i = 0;
i < kNumRRects; ++
i) {
429 static const SkRect easyOuts[] = {
440 for (
int i = 0;
i < kNumRRects; ++
i) {
441 for (
size_t j = 0; j <
std::size(easyOuts); ++j) {
449 static const int kNumSteps = 15;
450 bool answers[kNumRRects][8][kNumSteps] = {
454 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
455 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
456 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
457 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
458 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
459 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
460 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
461 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
469 { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
470 { 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
510 { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
514 for (
int i = 0;
i < kNumRRects; ++
i) {
535 const SkRRect copyOfOrig = orig;
547 const SkVector& origUL = orig.radii(SkRRect::kUpperLeft_Corner); \
548 const SkVector& origUR = orig.radii(SkRRect::kUpperRight_Corner); \
549 const SkVector& origLR = orig.radii(SkRRect::kLowerRight_Corner); \
550 const SkVector& origLL = orig.radii(SkRRect::kLowerLeft_Corner); \
551 const SkVector& dstUL = dst.radii(SkRRect::kUpperLeft_Corner); \
552 const SkVector& dstUR = dst.radii(SkRRect::kUpperRight_Corner); \
553 const SkVector& dstLR = dst.radii(SkRRect::kLowerRight_Corner); \
554 const SkVector& dstLL = dst.radii(SkRRect::kLowerLeft_Corner)
593 matrix.setTranslateX(translateX);
594 matrix.setTranslateY(translateY);
598 for (
int i = 0;
i < 4; ++
i) {
689 for (
int i = 0;
i < 4; ++
i) {
943 SkRect r = { 28443.8594f, 53.1428604f, 28446.7148f, 56.0000038f };
947 xform.
setAll(2.44f, 0.0f, 485411.7f,
948 0.0f, 2.44f, -438.7f,
958 for (
int i = 0;
i < 4; ++
i) {
970 const void*
buffer =
reinterpret_cast<const void*
>(&
rrect);
975 if (shouldEqualSrc) {
981 static const SkRect kRect = {10.f, 10.f, 20.f, 20.f};
995 *innerRect = kInfRect;
997 *innerRect = kNaNRect;
1004 *innerRect = kInfRect;
1006 *innerRect = kNaNRect;
1013 static const SkVector kRadii[4] = {{0.5f, 1.f}, {1.5f, 2.f}, {2.5f, 3.f}, {3.5f, 4.f}};
1018 *innerRadius = 400.f;
1024 *innerRadius = -10.f;
1050 float expectedArea =
1051 (2.f * radius * radius) +
1072 for (
int i = 0;
i < 1000; ++
i) {
1073 float maxRadiusX = rng.
nextRangeF(0.f, 40.f);
1074 float maxRadiusY = rng.
nextRangeF(0.f, 40.f);
1076 float innerWidth = rng.
nextRangeF(0.f, 40.f);
1077 float innerHeight = rng.
nextRangeF(0.f, 40.f);
1084 float maxLeft =
std::max(radii[0].fX, radii[3].fX);
1085 float maxTop =
std::max(radii[0].fY, radii[1].fY);
1086 float maxRight =
std::max(radii[1].fX, radii[2].fX);
1087 float maxBottom =
std::max(radii[2].fY, radii[3].fY);
1090 maxTop + maxBottom + innerHeight);
1106 float midX = maxLeft + 0.5f * innerWidth;
1107 float midY = maxTop + 0.5f * innerHeight;
1120 enum CornerChoice : uint8_t {
1125 CornerChoice tl, CornerChoice tr, CornerChoice br, CornerChoice bl) {
1154 SkPath aPath, bPath, expectedPath;
1181 auto make_inset = [](
const SkRRect& r,
float dx,
float dy) {
1239 verify_failure(
reporter,
a.makeOffset(32.f, 0.f),
b);
1241 verify_failure(
reporter,
a.makeOffset(11.5f, -11.5f),
b);
1246 verify_failure(
reporter, make_inset(
b, 0.3f, 0.3f),
b);
1248 verify_failure(
reporter,
a.makeOffset(2.5f, 0.f),
b);
1249 verify_failure(
reporter,
a.makeOffset(-2.5f, 0.f),
b);
1251 verify_failure(
reporter,
a,
b.makeOffset(0.f, 1.5f));
1252 verify_failure(
reporter,
a,
b.makeOffset(0.f, -1.5f));
1254 verify_failure(
reporter,
a.makeOffset(5.f, -2.f),
b);
1255 verify_failure(
reporter,
a.makeOffset(-5.f, -2.f),
b);
1256 verify_failure(
reporter,
a.makeOffset(5.f, 2.f),
b);
1257 verify_failure(
reporter,
a.makeOffset(-5.f, 2.f),
b);
1259 verify_failure(
reporter,
a,
b.makeOffset(3.f, -5.f));
1260 verify_failure(
reporter,
a,
b.makeOffset(-3.f, -5.f));
1261 verify_failure(
reporter,
a,
b.makeOffset(3.f, 5.f));
1262 verify_failure(
reporter,
a,
b.makeOffset(-3.f, 5.f));
1264 verify_failure(
reporter,
a.makeOffset(8.f, 10.f),
b);
1265 verify_failure(
reporter,
a.makeOffset(-8.f, 10.f),
b);
1266 verify_failure(
reporter,
a.makeOffset(8.f, -10.f),
b);
1267 verify_failure(
reporter,
a.makeOffset(-8.f, -10.f),
b);
1276 verify_failure(
reporter,
a,
a.makeOffset(r, 0.f));
1299 unsigned char buf[] = {
1300 0x0a, 0x00, 0x00, 0xff, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
1301 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
1302 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
1303 0x7f, 0x7f, 0x7f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x02, 0x00
1309 unsigned char buf[] = {
1310 0x5d, 0xff, 0xff, 0x5d, 0x0a, 0x60, 0x0a, 0x0a, 0x0a, 0x7e, 0x0a, 0x5a,
1311 0x0a, 0x12, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
1312 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x00, 0x00, 0x00, 0x0a,
1313 0x0a, 0x0a, 0x0a, 0x26, 0x0a, 0x0a, 0x0a, 0x0a, 0xff, 0xff, 0x0a, 0x0a
1319 unsigned char buf[] = {
1320 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x04, 0xdd, 0xdd, 0x15,
1321 0xfe, 0x00, 0x00, 0x04, 0x05, 0x7e, 0x00, 0x00, 0x00, 0xff, 0x08, 0x04,
1322 0xff, 0xff, 0xfe, 0xfe, 0xff, 0x32, 0x32, 0x32, 0x32, 0x00, 0x32, 0x32,
1323 0x04, 0xdd, 0x3d, 0x1c, 0xfe, 0x89, 0x04, 0x0a, 0x0e, 0x05, 0x7e, 0x0a
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static const double answers[][2]
static void test_round_rect_rects(skiatest::Reporter *reporter)
static void test_round_rect_transform(skiatest::Reporter *reporter)
static const SkScalar kHeight
static void test_round_rect_ovals(skiatest::Reporter *reporter)
static void test_9patch_rrect(skiatest::Reporter *reporter, const SkRect &rect, SkScalar l, SkScalar t, SkScalar r, SkScalar b, bool checkRadii)
static void test_tricky_radii(skiatest::Reporter *reporter)
static void test_inset(skiatest::Reporter *reporter)
static void test_round_rect_basic(skiatest::Reporter *reporter)
static void test_round_rect_contains_rect(skiatest::Reporter *reporter)
static void test_issue_2696(skiatest::Reporter *reporter)
static const SkScalar kWidth
static void assert_transform_failure(skiatest::Reporter *reporter, const SkRRect &orig, const SkMatrix &matrix)
static void test_inner_bounds(skiatest::Reporter *reporter)
static void test_conservative_intersection(skiatest::Reporter *reporter)
static void test_direction(skiatest::Reporter *reporter, const SkRRect &rr, SkScalar initX, int stepX, SkScalar initY, int stepY, int numSteps, const bool *contains)
static void test_round_rect_iffy_parameters(skiatest::Reporter *reporter)
static void test_read(skiatest::Reporter *reporter)
static void test_empty_crbug_458524(skiatest::Reporter *reporter)
DEF_TEST(RoundRect, reporter)
static void test_transform_helper(skiatest::Reporter *reporter, const SkRRect &orig)
void test_read_rrect(skiatest::Reporter *reporter, const SkRRect &rrect, bool shouldEqualSrc)
static void test_round_rect_general(skiatest::Reporter *reporter)
static void test_empty(skiatest::Reporter *reporter)
static constexpr double kEpsilon
@ kIntersect_SkPathOp
intersect the two paths
@ kXOR_SkPathOp
exclusive-or the two paths
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
#define SK_ScalarInfinity
#define REPORTER_ASSERT(r, cond,...)
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
static const SkMatrix & I()
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
static bool EqualsWithinTolerance(const SkPoint &p1, const SkPoint &p2)
static SkRect InnerBounds(const SkRRect &rr)
static SkRRect ConservativeIntersect(const SkRRect &a, const SkRRect &b)
const SkRect & rect() const
SkVector radii(Corner corner) const
@ kOval_Type
non-zero width and height filled with radii
@ kSimple_Type
non-zero width and height with equal radii
@ kEmpty_Type
zero width or height
@ kNinePatch_Type
non-zero width and height with axis-aligned radii
@ kRect_Type
non-zero width and height, and zeroed radii
@ kComplex_Type
non-zero width and height with arbitrary radii
static SkRRect MakeOval(const SkRect &oval)
void inset(SkScalar dx, SkScalar dy, SkRRect *dst) const
size_t readFromMemory(const void *buffer, size_t length)
@ kUpperLeft_Corner
index of top-left corner radii
@ kLowerRight_Corner
index of bottom-right corner radii
@ kUpperRight_Corner
index of top-right corner radii
@ kLowerLeft_Corner
index of bottom-left corner radii
bool transform(const SkMatrix &matrix, SkRRect *dst) const
static SkRRect MakeRect(const SkRect &r)
void setOval(const SkRect &oval)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
void setRectRadii(const SkRect &rect, const SkVector radii[4])
bool contains(const SkRect &rect) const
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
static constexpr size_t kSizeInMemory
void setRect(const SkRect &rect)
static SkRRect MakeEmpty()
float nextRangeF(float min, float max)
EMSCRIPTEN_KEEPALIVE void empty()
static float max(float r, float g, float b)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
constexpr std::array< std::array< float, 2 >, 2 > kRect
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
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
constexpr bool contains(std::string_view str, std::string_view needle)
SkRect makeSorted() const
SkScalar fBottom
larger y-axis bounds
void toQuad(SkPoint quad[4]) const
constexpr float left() const
void inset(float dx, float dy)
constexpr float top() const
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
bool contains(SkScalar x, SkScalar y) const
constexpr float height() const
constexpr float right() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
SkScalar fTop
smaller y-axis bounds