| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "SkRRect.h" | 9 #include "SkRRect.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 SkMatrix matrix; | 426 SkMatrix matrix; |
| 427 matrix.reset(); | 427 matrix.reset(); |
| 428 matrix.setSkewX(SkIntToScalar(2)); | 428 matrix.setSkewX(SkIntToScalar(2)); |
| 429 assert_transform_failure(reporter, orig, matrix); | 429 assert_transform_failure(reporter, orig, matrix); |
| 430 | 430 |
| 431 matrix.reset(); | 431 matrix.reset(); |
| 432 matrix.setSkewY(SkIntToScalar(3)); | 432 matrix.setSkewY(SkIntToScalar(3)); |
| 433 assert_transform_failure(reporter, orig, matrix); | 433 assert_transform_failure(reporter, orig, matrix); |
| 434 | 434 |
| 435 matrix.reset(); | 435 matrix.reset(); |
| 436 matrix.setPerspX(SkScalarToPersp(SkIntToScalar(4))); | 436 matrix.setPerspX(4); |
| 437 assert_transform_failure(reporter, orig, matrix); | 437 assert_transform_failure(reporter, orig, matrix); |
| 438 | 438 |
| 439 matrix.reset(); | 439 matrix.reset(); |
| 440 matrix.setPerspY(SkScalarToPersp(SkIntToScalar(5))); | 440 matrix.setPerspY(5); |
| 441 assert_transform_failure(reporter, orig, matrix); | 441 assert_transform_failure(reporter, orig, matrix); |
| 442 | 442 |
| 443 // Rotation fails. | 443 // Rotation fails. |
| 444 matrix.reset(); | 444 matrix.reset(); |
| 445 matrix.setRotate(SkIntToScalar(90)); | 445 matrix.setRotate(SkIntToScalar(90)); |
| 446 assert_transform_failure(reporter, orig, matrix); | 446 assert_transform_failure(reporter, orig, matrix); |
| 447 matrix.setRotate(SkIntToScalar(37)); | 447 matrix.setRotate(SkIntToScalar(37)); |
| 448 assert_transform_failure(reporter, orig, matrix); | 448 assert_transform_failure(reporter, orig, matrix); |
| 449 | 449 |
| 450 // Translate will keep the rect moved, but otherwise the same. | 450 // Translate will keep the rect moved, but otherwise the same. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 485 } |
| 486 // Width and height remain the same. | 486 // Width and height remain the same. |
| 487 REPORTER_ASSERT(reporter, orig.rect().width() == dst.rect().width()); | 487 REPORTER_ASSERT(reporter, orig.rect().width() == dst.rect().width()); |
| 488 REPORTER_ASSERT(reporter, orig.rect().height() == dst.rect().height()); | 488 REPORTER_ASSERT(reporter, orig.rect().height() == dst.rect().height()); |
| 489 // Right and left have swapped (sort of) | 489 // Right and left have swapped (sort of) |
| 490 REPORTER_ASSERT(reporter, orig.rect().right() == -dst.rect().left()); | 490 REPORTER_ASSERT(reporter, orig.rect().right() == -dst.rect().left()); |
| 491 // Top has stayed the same. | 491 // Top has stayed the same. |
| 492 REPORTER_ASSERT(reporter, orig.rect().top() == dst.rect().top()); | 492 REPORTER_ASSERT(reporter, orig.rect().top() == dst.rect().top()); |
| 493 | 493 |
| 494 // Keeping the scale, but adding a persp will make transform fail. | 494 // Keeping the scale, but adding a persp will make transform fail. |
| 495 matrix.setPerspX(SkScalarToPersp(SkIntToScalar(7))); | 495 matrix.setPerspX(7); |
| 496 assert_transform_failure(reporter, orig, matrix); | 496 assert_transform_failure(reporter, orig, matrix); |
| 497 | 497 |
| 498 // Scaling in -y will flip the round rect vertically. | 498 // Scaling in -y will flip the round rect vertically. |
| 499 matrix.reset(); | 499 matrix.reset(); |
| 500 matrix.setScaleY(SkIntToScalar(-1)); | 500 matrix.setScaleY(SkIntToScalar(-1)); |
| 501 dst.setEmpty(); | 501 dst.setEmpty(); |
| 502 success = orig.transform(matrix, &dst); | 502 success = orig.transform(matrix, &dst); |
| 503 REPORTER_ASSERT(reporter, success); | 503 REPORTER_ASSERT(reporter, success); |
| 504 { | 504 { |
| 505 GET_RADII; | 505 GET_RADII; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 test_round_rect_basic(reporter); | 615 test_round_rect_basic(reporter); |
| 616 test_round_rect_rects(reporter); | 616 test_round_rect_rects(reporter); |
| 617 test_round_rect_ovals(reporter); | 617 test_round_rect_ovals(reporter); |
| 618 test_round_rect_general(reporter); | 618 test_round_rect_general(reporter); |
| 619 test_round_rect_iffy_parameters(reporter); | 619 test_round_rect_iffy_parameters(reporter); |
| 620 test_inset(reporter); | 620 test_inset(reporter); |
| 621 test_round_rect_contains_rect(reporter); | 621 test_round_rect_contains_rect(reporter); |
| 622 test_round_rect_transform(reporter); | 622 test_round_rect_transform(reporter); |
| 623 test_issue_2696(reporter); | 623 test_issue_2696(reporter); |
| 624 } | 624 } |
| OLD | NEW |