Add unit test to cover incorrect image filter layer bounds bug
Pulls the matrix and layer bounds from the captured skp that was originally clipped, and asserts that both SkMatrix and SkM44's separate mapRect functions don't regress. Bug: skia:12335 Change-Id: I092d60b8a38fcd3cb70a8123802d730644cffda1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439276 Commit-Queue: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Florin Malita <fmalita@google.com> Auto-Submit: Michael Ludwig <michaelludwig@google.com> Reviewed-by: Florin Malita <fmalita@google.com>
This commit is contained in:
parent
5ced06f0b4
commit
68e4e20fae
@ -358,3 +358,17 @@ DEF_TEST(M44_mapRect, reporter) {
|
||||
p.setRow(3, {-.2f, -.6f, 0.f, 8.f});
|
||||
assertMapRect(p, src, nullptr);
|
||||
}
|
||||
|
||||
DEF_TEST(M44_mapRect_skbug12335, r) {
|
||||
// Stripped down test case from skbug.com/12335. Essentially, the corners of this rect would
|
||||
// map to homogoneous coords with very small w's (below the old value of kW0PlaneDistance) and
|
||||
// so they would be clipped "behind" the plane, resulting in an empty mapped rect. Coordinates
|
||||
// with positive that wouldn't overflow when divided by w should still be included in the mapped
|
||||
// rectangle.
|
||||
SkRect rect = SkRect::MakeLTRB(0, 0, 319, 620);
|
||||
SkM44 m(SkMatrix::MakeAll( 0.000152695269f, 0.00000000f, -6.53848401e-05f,
|
||||
-1.75697533e-05f, 0.000157153074f, -1.10847975e-06f,
|
||||
-6.00415362e-08f, 0.00000000f, 0.000169880834f));
|
||||
SkRect out = SkMatrixPriv::MapRect(m, rect);
|
||||
REPORTER_ASSERT(r, !out.isEmpty());
|
||||
}
|
||||
|
@ -1025,6 +1025,20 @@ DEF_TEST(Matrix_maprects, r) {
|
||||
}
|
||||
}
|
||||
|
||||
DEF_TEST(Matrix_mapRect_skbug12335, r) {
|
||||
// Stripped down test case from skbug.com/12335. Essentially, the corners of this rect would
|
||||
// map to homogoneous coords with very small w's (below the old value of kW0PlaneDistance) and
|
||||
// so they would be clipped "behind" the plane, resulting in an empty mapped rect. Coordinates
|
||||
// with positive that wouldn't overflow when divided by w should still be included in the mapped
|
||||
// rectangle.
|
||||
SkRect rect = SkRect::MakeLTRB(0, 0, 319, 620);
|
||||
SkMatrix m = SkMatrix::MakeAll( 0.000152695269f, 0.00000000f, -6.53848401e-05f,
|
||||
-1.75697533e-05f, 0.000157153074f, -1.10847975e-06f,
|
||||
-6.00415362e-08f, 0.00000000f, 0.000169880834f);
|
||||
SkRect out = m.mapRect(rect);
|
||||
REPORTER_ASSERT(r, !out.isEmpty());
|
||||
}
|
||||
|
||||
DEF_TEST(Matrix_Ctor, r) {
|
||||
REPORTER_ASSERT(r, SkMatrix{} == SkMatrix::I());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user