Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: cc/animation/transform_operations_unittest.cc

Issue 1325803002: Apply skew on both axes together rather than sequentially on Compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test for skewY Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/animation/transform_operations.cc ('k') | cc/base/float_quad_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "cc/animation/transform_operations.h" 9 #include "cc/animation/transform_operations.h"
10 #include "cc/test/geometry_test_utils.h" 10 #include "cc/test/geometry_test_utils.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 expected.Scale3d(x, y, z); 202 expected.Scale3d(x, y, z);
203 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply()); 203 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply());
204 } 204 }
205 205
206 TEST(TransformOperationTest, ApplySkew) { 206 TEST(TransformOperationTest, ApplySkew) {
207 SkMScalar x = 1; 207 SkMScalar x = 1;
208 SkMScalar y = 2; 208 SkMScalar y = 2;
209 TransformOperations operations; 209 TransformOperations operations;
210 operations.AppendSkew(x, y); 210 operations.AppendSkew(x, y);
211 gfx::Transform expected; 211 gfx::Transform expected;
212 expected.SkewX(x); 212 expected.Skew(x, y);
213 expected.SkewY(y);
214 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply()); 213 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply());
215 } 214 }
216 215
217 TEST(TransformOperationTest, ApplyPerspective) { 216 TEST(TransformOperationTest, ApplyPerspective) {
218 SkMScalar depth = 800; 217 SkMScalar depth = 800;
219 TransformOperations operations; 218 TransformOperations operations;
220 operations.AppendPerspective(depth); 219 operations.AppendPerspective(depth);
221 gfx::Transform expected; 220 gfx::Transform expected;
222 expected.ApplyPerspectiveDepth(depth); 221 expected.ApplyPerspectiveDepth(depth);
223 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply()); 222 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.Apply());
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 544
546 TEST(TransformOperationTest, BlendSkewFromEmpty) { 545 TEST(TransformOperationTest, BlendSkewFromEmpty) {
547 TransformOperations empty_operation; 546 TransformOperations empty_operation;
548 547
549 TransformOperations operations; 548 TransformOperations operations;
550 operations.AppendSkew(2, 2); 549 operations.AppendSkew(2, 2);
551 550
552 SkMScalar progress = 0.5f; 551 SkMScalar progress = 0.5f;
553 552
554 gfx::Transform expected; 553 gfx::Transform expected;
555 expected.SkewX(1); 554 expected.Skew(1, 1);
556 expected.SkewY(1);
557 555
558 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, 556 EXPECT_TRANSFORMATION_MATRIX_EQ(expected,
559 operations.Blend(empty_operation, progress)); 557 operations.Blend(empty_operation, progress));
560 558
561 progress = -0.5f; 559 progress = -0.5f;
562 560
563 expected.MakeIdentity(); 561 expected.MakeIdentity();
564 expected.SkewX(-1); 562 expected.Skew(-1, -1);
565 expected.SkewY(-1);
566 563
567 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, 564 EXPECT_TRANSFORMATION_MATRIX_EQ(expected,
568 operations.Blend(empty_operation, progress)); 565 operations.Blend(empty_operation, progress));
569 566
570 progress = 1.5f; 567 progress = 1.5f;
571 568
572 expected.MakeIdentity(); 569 expected.MakeIdentity();
573 expected.SkewX(3); 570 expected.Skew(3, 3);
574 expected.SkewY(3);
575 571
576 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, 572 EXPECT_TRANSFORMATION_MATRIX_EQ(expected,
577 operations.Blend(empty_operation, progress)); 573 operations.Blend(empty_operation, progress));
578 } 574 }
579 575
580 TEST(TransformOperationTest, BlendPerspectiveFromIdentity) { 576 TEST(TransformOperationTest, BlendPerspectiveFromIdentity) {
581 ScopedVector<TransformOperations> identity_operations; 577 ScopedVector<TransformOperations> identity_operations;
582 GetIdentityOperations(&identity_operations); 578 GetIdentityOperations(&identity_operations);
583 579
584 for (size_t i = 0; i < identity_operations.size(); ++i) { 580 for (size_t i = 0; i < identity_operations.size(); ++i) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 647
652 TEST(TransformOperationTest, BlendSkewToEmpty) { 648 TEST(TransformOperationTest, BlendSkewToEmpty) {
653 TransformOperations empty_operation; 649 TransformOperations empty_operation;
654 650
655 TransformOperations operations; 651 TransformOperations operations;
656 operations.AppendSkew(2, 2); 652 operations.AppendSkew(2, 2);
657 653
658 SkMScalar progress = 0.5f; 654 SkMScalar progress = 0.5f;
659 655
660 gfx::Transform expected; 656 gfx::Transform expected;
661 expected.SkewX(1); 657 expected.Skew(1, 1);
662 expected.SkewY(1);
663 658
664 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, 659 EXPECT_TRANSFORMATION_MATRIX_EQ(expected,
665 empty_operation.Blend(operations, progress)); 660 empty_operation.Blend(operations, progress));
666 } 661 }
667 662
668 TEST(TransformOperationTest, BlendPerspectiveToIdentity) { 663 TEST(TransformOperationTest, BlendPerspectiveToIdentity) {
669 ScopedVector<TransformOperations> identity_operations; 664 ScopedVector<TransformOperations> identity_operations;
670 GetIdentityOperations(&identity_operations); 665 GetIdentityOperations(&identity_operations);
671 666
672 for (size_t i = 0; i < identity_operations.size(); ++i) { 667 for (size_t i = 0; i < identity_operations.size(); ++i) {
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1463
1469 // Scale + Perspective can't. 1464 // Scale + Perspective can't.
1470 TransformOperations operations11; 1465 TransformOperations operations11;
1471 operations11.AppendScale(2.f, 2.f, 2.f); 1466 operations11.AppendScale(2.f, 2.f, 2.f);
1472 operations11.AppendPerspective(1.f); 1467 operations11.AppendPerspective(1.f);
1473 EXPECT_FALSE(operations11.ScaleComponent(&scale)); 1468 EXPECT_FALSE(operations11.ScaleComponent(&scale));
1474 } 1469 }
1475 1470
1476 } // namespace 1471 } // namespace
1477 } // namespace cc 1472 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/transform_operations.cc ('k') | cc/base/float_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698