Don't test GPU configs on hittestpath
Change-Id: I0574edbc1014d58d2f4836e98e35a78575b084a4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291957 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
e84ed12bbd
commit
b7518a80c5
@ -34,32 +34,40 @@ static void test_hittest(SkCanvas* canvas, const SkPath& path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_SIMPLE_GM(hittestpath, canvas, 700, 460) {
|
DEF_SIMPLE_GM_CAN_FAIL(hittestpath, canvas, errorMsg, 700, 460) {
|
||||||
SkPath path;
|
if (canvas->getGrContext()) {
|
||||||
SkRandom rand;
|
// GPU rasterization results vary greatly from platform to platform. We can't use them as
|
||||||
|
// an expected result for our internal SkPath::contains().
|
||||||
|
*errorMsg = "This test is for CPU configs only.";
|
||||||
|
return skiagm::DrawResult::kSkip;
|
||||||
|
}
|
||||||
|
|
||||||
int scale = 300;
|
SkPath path;
|
||||||
for (int i = 0; i < 4; ++i) {
|
SkRandom rand;
|
||||||
// get the random values deterministically
|
|
||||||
SkScalar randoms[12];
|
int scale = 300;
|
||||||
for (int index = 0; index < (int) SK_ARRAY_COUNT(randoms); ++index) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
randoms[index] = rand.nextUScalar1();
|
// get the random values deterministically
|
||||||
}
|
SkScalar randoms[12];
|
||||||
path.lineTo(randoms[0] * scale, randoms[1] * scale);
|
for (int index = 0; index < (int) SK_ARRAY_COUNT(randoms); ++index) {
|
||||||
path.quadTo(randoms[2] * scale, randoms[3] * scale,
|
randoms[index] = rand.nextUScalar1();
|
||||||
randoms[4] * scale, randoms[5] * scale);
|
|
||||||
path.cubicTo(randoms[6] * scale, randoms[7] * scale,
|
|
||||||
randoms[8] * scale, randoms[9] * scale,
|
|
||||||
randoms[10] * scale, randoms[11] * scale);
|
|
||||||
}
|
}
|
||||||
|
path.lineTo(randoms[0] * scale, randoms[1] * scale);
|
||||||
|
path.quadTo(randoms[2] * scale, randoms[3] * scale,
|
||||||
|
randoms[4] * scale, randoms[5] * scale);
|
||||||
|
path.cubicTo(randoms[6] * scale, randoms[7] * scale,
|
||||||
|
randoms[8] * scale, randoms[9] * scale,
|
||||||
|
randoms[10] * scale, randoms[11] * scale);
|
||||||
|
}
|
||||||
|
|
||||||
path.setFillType(SkPathFillType::kEvenOdd);
|
path.setFillType(SkPathFillType::kEvenOdd);
|
||||||
path.offset(SkIntToScalar(20), SkIntToScalar(20));
|
path.offset(SkIntToScalar(20), SkIntToScalar(20));
|
||||||
|
|
||||||
test_hittest(canvas, path);
|
test_hittest(canvas, path);
|
||||||
|
|
||||||
canvas->translate(SkIntToScalar(scale), 0);
|
canvas->translate(SkIntToScalar(scale), 0);
|
||||||
path.setFillType(SkPathFillType::kWinding);
|
path.setFillType(SkPathFillType::kWinding);
|
||||||
|
|
||||||
test_hittest(canvas, path);
|
test_hittest(canvas, path);
|
||||||
|
return skiagm::DrawResult::kOk;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user