OLD | NEW |
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 #ifndef CC_ANIMATION_TRANSFORM_OPERATIONS_H_ | 5 #ifndef CC_ANIMATION_TRANSFORM_OPERATIONS_H_ |
6 #define CC_ANIMATION_TRANSFORM_OPERATIONS_H_ | 6 #define CC_ANIMATION_TRANSFORM_OPERATIONS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/logging.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "cc/animation/transform_operation.h" | 13 #include "cc/animation/transform_operation.h" |
13 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
14 #include "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class BoxF; | 18 class BoxF; |
18 struct DecomposedTransform; | 19 struct DecomposedTransform; |
19 } | 20 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 void AppendTranslate(SkMScalar x, SkMScalar y, SkMScalar z); | 85 void AppendTranslate(SkMScalar x, SkMScalar y, SkMScalar z); |
85 void AppendRotate(SkMScalar x, SkMScalar y, SkMScalar z, SkMScalar degrees); | 86 void AppendRotate(SkMScalar x, SkMScalar y, SkMScalar z, SkMScalar degrees); |
86 void AppendScale(SkMScalar x, SkMScalar y, SkMScalar z); | 87 void AppendScale(SkMScalar x, SkMScalar y, SkMScalar z); |
87 void AppendSkew(SkMScalar x, SkMScalar y); | 88 void AppendSkew(SkMScalar x, SkMScalar y); |
88 void AppendPerspective(SkMScalar depth); | 89 void AppendPerspective(SkMScalar depth); |
89 void AppendMatrix(const gfx::Transform& matrix); | 90 void AppendMatrix(const gfx::Transform& matrix); |
90 void AppendIdentity(); | 91 void AppendIdentity(); |
91 bool IsIdentity() const; | 92 bool IsIdentity() const; |
92 | 93 |
| 94 size_t size() const { return operations_.size(); } |
| 95 |
| 96 const TransformOperation& at(size_t index) const { |
| 97 DCHECK_LT(index, size()); |
| 98 return operations_[index]; |
| 99 } |
| 100 |
93 private: | 101 private: |
94 bool BlendInternal(const TransformOperations& from, | 102 bool BlendInternal(const TransformOperations& from, |
95 SkMScalar progress, | 103 SkMScalar progress, |
96 gfx::Transform* result) const; | 104 gfx::Transform* result) const; |
97 | 105 |
98 std::vector<TransformOperation> operations_; | 106 std::vector<TransformOperation> operations_; |
99 | 107 |
100 bool ComputeDecomposedTransform() const; | 108 bool ComputeDecomposedTransform() const; |
101 | 109 |
102 // For efficiency, we cache the decomposed transform. | 110 // For efficiency, we cache the decomposed transform. |
103 mutable scoped_ptr<gfx::DecomposedTransform> decomposed_transform_; | 111 mutable scoped_ptr<gfx::DecomposedTransform> decomposed_transform_; |
104 mutable bool decomposed_transform_dirty_; | 112 mutable bool decomposed_transform_dirty_; |
105 | 113 |
106 DISALLOW_ASSIGN(TransformOperations); | 114 DISALLOW_ASSIGN(TransformOperations); |
107 }; | 115 }; |
108 | 116 |
109 } // namespace cc | 117 } // namespace cc |
110 | 118 |
111 #endif // CC_ANIMATION_TRANSFORM_OPERATIONS_H_ | 119 #endif // CC_ANIMATION_TRANSFORM_OPERATIONS_H_ |
OLD | NEW |