193 Expectation
tests[] = {
197 {
a, {6, 6, 10, 10}, {2, 10, 12, 15},
false},
205 {
a, {15, 17, 20, 40},
a,
true},
207 {
a, {0, 0, 6, 20}, {6, 3, 12, 15},
true},
209 {
a, {6, 0, 20, 20}, {2, 3, 6, 15},
true},
211 {
a, {0, 0, 20, 6}, {2, 6, 12, 15},
true},
213 {
a, {0, 10, 20, 20}, {2, 3, 12, 10},
true},
215 {
a, {0, 6, 20, 10}, {2, 10, 12, 15},
false},
217 {
a, {6, 0, 10, 20}, {2, 3, 6, 15},
false},
219 {
a, {0, 0, 4, 4}, {2, 4, 12, 15},
false},
221 {
a, {10, 0, 14, 7}, {2, 3, 10, 15},
false},
223 {
a, {0, 12, 5, 20}, {2, 3, 12, 12},
false},
225 {
a, {10, 12, 20, 20}, {2, 3, 10, 15},
false},
227 {
a, {0, 6, 8, 10}, {2, 10, 12, 15},
false},
229 {
a, {8, 6, 20, 10}, {2, 3, 8, 15},
false},
231 {
a, {6, 0, 10, 7}, {2, 7, 12, 15},
false},
233 {
a, {4, 6, 8, 20}, {8, 3, 12, 15},
false}
236 for (
const Expectation& e :
tests) {
294 {
"Identity matrix contains success",
true,
297 {
"Identity matrix contains failure",
false,
300 {
"Identity mapped rect contains itself",
true,
303 {
"Scaled rect contains success",
true,
304 SkMatrix::Scale(2.f, 3.4f), {0,0,4,4}, {1,1,6,6}},
306 {
"Scaled rect contains failure",
false,
307 SkMatrix::Scale(0.25f, 0.3f), {0,0,8,8}, {0,0,5,5}},
309 {
"Rotate rect contains success",
true,
310 SkMatrix::RotateDeg(45.f, {10.f, 10.f}), {0,0,20,20}, {3,3,17,17}},
312 {
"Rotate rect contains failure",
false,
313 SkMatrix::RotateDeg(45.f, {10.f, 10.f}), {0,0,20,20}, {2,2,18,18}},
315 {
"Negative scale contains success",
true,
316 SkMatrix::Scale(-1.f, 1.f), {0,0,10,10}, {-9,1,-1,9}},
318 {
"Empty rect contains nothing",
false,
319 SkMatrix::RotateDeg(45.f, {0.f, 0.f}), {10,10,10,20}, {10,14,10,16}},
321 {
"MakeEmpty() contains nothing",
false,
324 {
"Unsorted rect contains nothing",
false,
327 {
"Unsorted rect is contained",
true,
332 {
"Epsilon not contained",
true,
334 -0.173648f, 0.984808f, 17.3648f,
335 0.000000f, 0.000000f, 1.0000f)
337 {0, 0, 134, 215}, {0, 0, 100, 200}, 0.001f},
346 SkVector bOffset = t.m.mapVector(0.5f, 0.5f);
356 bOffset = t.m.mapVector(0.5f, 0.5f);
372 p.preTranslate(0.f, 5.f, -0.1f);
381 p.setRow(3, {-.2f, -.6f, 0.f, 8.f});
392 p.setRow(3, {-.2f, -.6f, 0.f, 8.f});
393 const SkRect na =
a.makeOffset(16.f, 31.f);
410 {
"src left edge", {-15, -5, -2, 15}, {0, 0, 1, 10}},
411 {
"src left edge clipped to dst", {-15, 2, -2, 8}, {0, 2, 1, 8}},
412 {
"src top-left corner", {-15,-15, -2, -2}, {0, 0, 1, 1}},
413 {
"src top edge", { -5,-10, 15, -2}, {0, 0, 10, 1}},
414 {
"src top edge clipped to dst", { 2,-10, 8, -2}, {2, 0, 8, 1}},
415 {
"src top-right corner", { 15,-15, 20, -2}, {9, 0, 10, 1}},
416 {
"src right edge", { 15, -5, 20, 15}, {9, 0, 10, 10}},
417 {
"src right edge clipped to dst", { 15, 2, 20, 8}, {9, 2, 10, 8}},
418 {
"src bottom-right corner", { 15, 15, 20, 20}, {9, 9, 10, 10}},
419 {
"src bottom edge", { -5, 15, 15, 20}, {0, 9, 10, 10}},
420 {
"src bottom edge clipped to dst", { 2, 15, 8, 20}, {2, 9, 8, 10}},
421 {
"src bottom-left corner", {-15, 15, -2, 20}, {0, 9, 1, 10}},
422 {
"src intersects dst high", { 2, 2, 15, 15}, {2, 2, 10, 10}},
423 {
"src intersects dst low", { -5, -5, 8, 8}, {0, 0, 8, 8}},
424 {
"src contains dst", { 2, 2, 8, 8}, {2, 2, 8, 8}},
425 {
"src contained in dst", { -5, -5, 15, 15}, {0, 0, 10, 10}}