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 3 // found in the LICENSE file. 4 5 #ifndef CC_ANIMATION_TRANSFORM_OPERATION_H_ 6 #define CC_ANIMATION_TRANSFORM_OPERATION_H_ 7 8 #include "ui/gfx/transform.h" 9 10 namespace cc { 11 12 struct TransformOperation { 13 enum Type { 14 TransformOperationTranslate, 15 TransformOperationRotate, 16 TransformOperationScale, 17 TransformOperationSkew, 18 TransformOperationPerspective, 19 TransformOperationMatrix, 20 TransformOperationIdentity 21 }; 22 23 TransformOperation() 24 : type(TransformOperationIdentity) { 25 } 26 27 Type type; 28 gfx::Transform matrix; 29 30 union { 31 double perspective_depth; 32 33 struct { 34 double x, y; 35 } skew; 36 37 struct { 38 double x, y, z; 39 } scale; 40 41 struct { 42 double x, y, z; 43 } translate; 44 45 struct { 46 struct { 47 double x, y, z; 48 } axis; 49 50 double angle; 51 } rotate; 52 }; 53 54 bool IsIdentity() const; 55 static bool BlendTransformOperations(const TransformOperation* from, 56 const TransformOperation* to, 57 double progress, 58 gfx::Transform* result); 59 }; 60 61 } // namespace cc 62 63 #endif // CC_ANIMATION_TRANSFORM_OPERATION_H_ 64