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

Unified Diff: cc/animation/transform_operations_unittest.cc

Issue 297163010: Fixed the order of applying transform operations for animation bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/animation/transform_operations_unittest.cc
diff --git a/cc/animation/transform_operations_unittest.cc b/cc/animation/transform_operations_unittest.cc
index ce7d12114ec4f360f0dad9257e6a4a286fe33e28..2f2ddca683a714523420bc2fe4ca95da43aa9987 100644
--- a/cc/animation/transform_operations_unittest.cc
+++ b/cc/animation/transform_operations_unittest.cc
@@ -1219,15 +1219,39 @@ TEST(TransformOperationTest, BlendedBoundsForSkew) {
}
}
+TEST(TransformOperationTest, NonCommutativeRotations) {
+ TransformOperations operations_from;
+ operations_from.AppendRotate(1.0, 0.0, 0.0, 0.0);
+ operations_from.AppendRotate(0.0, 1.0, 0.0, 0.0);
+ TransformOperations operations_to;
+ operations_to.AppendRotate(1.0, 0.0, 0.0, 45.0);
+ operations_to.AppendRotate(0.0, 1.0, 0.0, 135.0);
+
+ gfx::BoxF box(0, 0, 0, 1, 1, 1);
+ gfx::BoxF bounds;
+
+ SkMScalar min_progress = 0.0f;
+ SkMScalar max_progress = 1.0f;
+ EXPECT_TRUE(operations_to.BlendedBoundsForBox(
+ box, operations_from, min_progress, max_progress, &bounds));
+ gfx::Transform blendedTransform =
ajuma 2014/05/27 16:00:54 nit: blended_transform
awoloszyn 2014/05/27 16:08:09 Thanks! Turns out my brain was still at least part
+ operations_to.Blend(operations_from, max_progress);
+ gfx::Point3F blendedPoint(0.9, 0.9, 0);
ajuma 2014/05/27 16:00:54 nit: blended_point
awoloszyn 2014/05/27 16:08:09 Done.
+ blendedTransform.TransformPoint(&blendedPoint);
+ gfx::BoxF expandedBounds = bounds;
ajuma 2014/05/27 16:00:54 expanded_bounds
awoloszyn 2014/05/27 16:08:09 Done.
+ expandedBounds.ExpandTo(blendedPoint);
+ EXPECT_EQ(bounds.ToString(), expandedBounds.ToString());
+}
+
TEST(TransformOperationTest, BlendedBoundsForSequence) {
TransformOperations operations_from;
- operations_from.AppendTranslate(2.0, 4.0, -1.0);
- operations_from.AppendScale(-1.0, 2.0, 3.0);
operations_from.AppendTranslate(1.0, -5.0, 1.0);
+ operations_from.AppendScale(-1.0, 2.0, 3.0);
+ operations_from.AppendTranslate(2.0, 4.0, -1.0);
TransformOperations operations_to;
- operations_to.AppendTranslate(6.0, -2.0, 3.0);
- operations_to.AppendScale(-3.0, -2.0, 5.0);
operations_to.AppendTranslate(13.0, -1.0, 5.0);
+ operations_to.AppendScale(-3.0, -2.0, 5.0);
+ operations_to.AppendTranslate(6.0, -2.0, 3.0);
gfx::BoxF box(1.f, 2.f, 3.f, 4.f, 4.f, 4.f);
gfx::BoxF bounds;
« cc/animation/transform_operation.cc ('K') | « cc/animation/transform_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698