OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 GeometryMapperTransformCache_h |
| 6 #define GeometryMapperTransformCache_h |
| 7 |
| 8 #include "platform/PlatformExport.h" |
| 9 |
| 10 #include "platform/transforms/TransformationMatrix.h" |
| 11 #include "wtf/Vector.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class TransformPaintPropertyNode; |
| 16 |
| 17 // A GeometryMapperTransformCache hangs off a TransformPaintPropertyNode. It |
| 18 // stores cached "transformed rects" (See GeometryMapper.h) from that node in |
| 19 // ancestor spaces. |
| 20 class PLATFORM_EXPORT GeometryMapperTransformCache { |
| 21 public: |
| 22 GeometryMapperTransformCache(); |
| 23 |
| 24 // Returns the transformed rect (see GeometryMapper.h) of |this| in the |
| 25 // space of |ancestorTransform|, if there is one cached. Otherwise returns |
| 26 // null. |
| 27 const TransformationMatrix* getCachedTransform( |
| 28 const TransformPaintPropertyNode* ancestorTransform); |
| 29 |
| 30 // Stores the "transformed rect" of |this| in the space of |ancestors|, |
| 31 // into a local cache. |
| 32 void setCachedTransform(const TransformPaintPropertyNode* ancestorTransform, |
| 33 const TransformationMatrix& toAncestor); |
| 34 |
| 35 static void clearCache(); |
| 36 |
| 37 private: |
| 38 struct TransformCacheEntry { |
| 39 const TransformPaintPropertyNode* ancestorNode; |
| 40 TransformationMatrix toAncestor; |
| 41 TransformCacheEntry(const TransformPaintPropertyNode* ancestorNodeArg, |
| 42 const TransformationMatrix& toAncestorArg) |
| 43 : ancestorNode(ancestorNodeArg), toAncestor(toAncestorArg) {} |
| 44 }; |
| 45 |
| 46 void invalidateCacheIfNeeded(); |
| 47 |
| 48 Vector<TransformCacheEntry> m_transformCache; |
| 49 unsigned m_cacheGeneration; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(GeometryMapperTransformCache); |
| 52 }; |
| 53 |
| 54 } // namespace blink |
| 55 |
| 56 #endif // GeometryMapperTransformCache_h |
OLD | NEW |