move private test for sect_with_horizontal into unittests
BUG=638575 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2250353004 Review-Url: https://codereview.chromium.org/2250353004
This commit is contained in:
parent
bf63e616a6
commit
ff863bc550
@ -157,34 +157,8 @@ static bool is_between_unsorted(SkScalar value,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
|
||||||
// This is an example of why we need to pin the result computed in
|
|
||||||
// sect_with_horizontal. If we didn't explicitly pin, is_between_unsorted would
|
|
||||||
// fail.
|
|
||||||
//
|
|
||||||
static void sect_with_horizontal_test_for_pin_results() {
|
|
||||||
const SkPoint pts[] = {
|
|
||||||
{ -540000, -720000 },
|
|
||||||
{ -9.10000017e-05f, 9.99999996e-13f }
|
|
||||||
};
|
|
||||||
float x = sect_with_horizontal(pts, 0);
|
|
||||||
SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
|
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
|
||||||
bool canCullToTheRight) {
|
bool canCullToTheRight) {
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
|
||||||
{
|
|
||||||
static bool gOnce;
|
|
||||||
if (!gOnce) {
|
|
||||||
sect_with_horizontal_test_for_pin_results();
|
|
||||||
gOnce = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int index0, index1;
|
int index0, index1;
|
||||||
|
|
||||||
if (pts[0].fY < pts[1].fY) {
|
if (pts[0].fY < pts[1].fY) {
|
||||||
|
@ -97,6 +97,20 @@ static void make_path_crbug364224_simplified(SkPath* path) {
|
|||||||
path->close();
|
path->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sect_with_horizontal_needs_pinning() {
|
||||||
|
// Test that sect_with_horizontal in SkLineClipper.cpp needs to pin after computing the
|
||||||
|
// intersection.
|
||||||
|
SkPath path;
|
||||||
|
path.reset();
|
||||||
|
path.moveTo(-540000, -720000);
|
||||||
|
path.lineTo(-9.10000017e-05f, 9.99999996e-13f);
|
||||||
|
path.lineTo(1, 1);
|
||||||
|
|
||||||
|
// Without the pinning code in sect_with_horizontal(), this would assert in the lineclipper
|
||||||
|
SkPaint paint;
|
||||||
|
SkSurface::MakeRasterN32Premul(10, 10)->getCanvas()->drawPath(path, paint);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_path_crbug364224() {
|
static void test_path_crbug364224() {
|
||||||
SkPath path;
|
SkPath path;
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
@ -4228,6 +4242,7 @@ DEF_TEST(PathContains, reporter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEF_TEST(Paths, reporter) {
|
DEF_TEST(Paths, reporter) {
|
||||||
|
test_sect_with_horizontal_needs_pinning();
|
||||||
test_crbug_629455(reporter);
|
test_crbug_629455(reporter);
|
||||||
test_fuzz_crbug_627414(reporter);
|
test_fuzz_crbug_627414(reporter);
|
||||||
test_path_crbug364224();
|
test_path_crbug364224();
|
||||||
|
Loading…
Reference in New Issue
Block a user