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 SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ | 5 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ |
6 #define SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ | 6 #define SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ |
7 | 7 |
8 #include "third_party/skia/include/utils/SkMatrix44.h" | 8 #include "third_party/skia/include/core/SkMatrix44.h" |
9 | 9 |
10 namespace compositor { | 10 namespace compositor { |
11 | 11 |
12 // Contains information about a transformation and its inverse. | 12 // Contains information about a transformation and its inverse. |
13 // The inverse is computed lazily and cached. | 13 // The inverse is computed lazily and cached. |
14 class TransformPair { | 14 class TransformPair { |
15 public: | 15 public: |
16 TransformPair(const SkMatrix44& forward); | 16 TransformPair(const SkMatrix44& forward); |
17 ~TransformPair(); | 17 ~TransformPair(); |
18 | 18 |
19 // Gets the forward transformation. | 19 // Gets the forward transformation. |
20 const SkMatrix44& forward() const { return forward_; } | 20 const SkMatrix44& forward() const { return forward_; } |
21 | 21 |
22 // Gets the inverse transformation. | 22 // Gets the inverse transformation. |
23 const SkMatrix44& GetInverse() const; | 23 const SkMatrix44& GetInverse() const; |
24 | 24 |
25 // Maps a point using the inverse transformation. | 25 // Maps a point using the inverse transformation. |
26 const SkPoint InverseMapPoint(const SkPoint& point) const; | 26 const SkPoint InverseMapPoint(const SkPoint& point) const; |
27 | 27 |
28 private: | 28 private: |
29 const SkMatrix44 forward_; | 29 const SkMatrix44 forward_; |
30 mutable SkMatrix44 cached_inverse_; | 30 mutable SkMatrix44 cached_inverse_; |
31 mutable bool cached_inverse_valid_ = false; | 31 mutable bool cached_inverse_valid_ = false; |
32 }; | 32 }; |
33 | 33 |
34 } // namespace compositor | 34 } // namespace compositor |
35 | 35 |
36 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ | 36 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_TRANSFORM_PAIR_H_ |
OLD | NEW |