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