OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CompositorTransformOperations_h | 5 #ifndef CompositorTransformOperations_h |
6 #define CompositorTransformOperations_h | 6 #define CompositorTransformOperations_h |
7 | 7 |
8 #include "cc/animation/transform_operations.h" | 8 #include "cc/animation/transform_operations.h" |
9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 #include "wtf/PtrUtil.h" | 11 #include "wtf/PassOwnPtr.h" |
12 #include <memory> | |
13 | 12 |
14 class SkMatrix44; | 13 class SkMatrix44; |
15 | 14 |
16 namespace blink { | 15 namespace blink { |
17 | 16 |
18 class PLATFORM_EXPORT CompositorTransformOperations { | 17 class PLATFORM_EXPORT CompositorTransformOperations { |
19 WTF_MAKE_NONCOPYABLE(CompositorTransformOperations); | 18 WTF_MAKE_NONCOPYABLE(CompositorTransformOperations); |
20 public: | 19 public: |
21 static std::unique_ptr<CompositorTransformOperations> create() | 20 static PassOwnPtr<CompositorTransformOperations> create() |
22 { | 21 { |
23 return wrapUnique(new CompositorTransformOperations()); | 22 return adoptPtr(new CompositorTransformOperations()); |
24 } | 23 } |
25 | 24 |
26 const cc::TransformOperations& asTransformOperations() const; | 25 const cc::TransformOperations& asTransformOperations() const; |
27 | 26 |
28 // Returns true if these operations can be blended. It will only return | 27 // Returns true if these operations can be blended. It will only return |
29 // false if we must resort to matrix interpolation, and matrix interpolation | 28 // false if we must resort to matrix interpolation, and matrix interpolation |
30 // fails (this can happen if either matrix cannot be decomposed). | 29 // fails (this can happen if either matrix cannot be decomposed). |
31 bool canBlendWith(const CompositorTransformOperations& other) const; | 30 bool canBlendWith(const CompositorTransformOperations& other) const; |
32 | 31 |
33 void appendTranslate(double x, double y, double z); | 32 void appendTranslate(double x, double y, double z); |
34 void appendRotate(double x, double y, double z, double degrees); | 33 void appendRotate(double x, double y, double z, double degrees); |
35 void appendScale(double x, double y, double z); | 34 void appendScale(double x, double y, double z); |
36 void appendSkew(double x, double y); | 35 void appendSkew(double x, double y); |
37 void appendPerspective(double depth); | 36 void appendPerspective(double depth); |
38 void appendMatrix(const SkMatrix44&); | 37 void appendMatrix(const SkMatrix44&); |
39 void appendIdentity(); | 38 void appendIdentity(); |
40 | 39 |
41 bool isIdentity() const; | 40 bool isIdentity() const; |
42 | 41 |
43 private: | 42 private: |
44 CompositorTransformOperations(); | 43 CompositorTransformOperations(); |
45 | 44 |
46 cc::TransformOperations m_transformOperations; | 45 cc::TransformOperations m_transformOperations; |
47 }; | 46 }; |
48 | 47 |
49 } // namespace blink | 48 } // namespace blink |
50 | 49 |
51 #endif // CompositorTransformOperations_h | 50 #endif // CompositorTransformOperations_h |
OLD | NEW |