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 GeometryMapperClipCache_h | |
6 #define GeometryMapperClipCache_h | |
7 | |
8 #include "platform/PlatformExport.h" | |
9 #include "platform/graphics/paint/FloatClipRect.h" | |
10 #include "wtf/Vector.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class ClipPaintPropertyNode; | |
15 class FloatClipRect; | |
16 class TransformPaintPropertyNode; | |
17 | |
18 // A GeometryMapperClipCache hangs off a ClipPaintPropertyNode. It stores | |
19 // cached "clip visual rects" (See GeometryMapper.h) from that node in | |
20 // ancestor spaces. | |
21 class PLATFORM_EXPORT GeometryMapperClipCache { | |
22 public: | |
23 struct ClipAndTransform { | |
24 const ClipPaintPropertyNode* ancestorClip; | |
25 const TransformPaintPropertyNode* ancestorTransform; | |
26 bool operator==(const ClipAndTransform& other) const { | |
27 return ancestorClip == other.ancestorClip && | |
28 ancestorTransform == other.ancestorTransform; | |
29 } | |
30 ClipAndTransform(const ClipPaintPropertyNode* ancestorClipArg, | |
31 const TransformPaintPropertyNode* ancestorTransformArg) | |
32 : ancestorClip(ancestorClipArg), | |
33 ancestorTransform(ancestorTransformArg) {} | |
34 }; | |
35 | |
36 // Returns the clip visual rect of the owning | |
37 // clip of |this| in the space of |ancestors|, if there is one cached. | |
38 // Otherwise returns null. | |
39 const FloatClipRect* getCachedClip(const ClipAndTransform& ancestors); | |
40 // Stores the "clip visual rect" of |this in the space of |ancestors|, | |
41 // into a local cache. | |
42 | |
43 void setCachedClip(const ClipAndTransform&, const FloatClipRect&); | |
44 | |
45 static void clearCache(); | |
46 | |
47 private: | |
48 struct ClipCacheEntry { | |
49 const ClipAndTransform clipAndTransform; | |
50 const FloatClipRect clipRect; | |
51 ClipCacheEntry(const ClipAndTransform& clipAndTransformArg, | |
52 const FloatClipRect& clipRectArg) | |
53 : clipAndTransform(clipAndTransformArg), clipRect(clipRectArg) {} | |
54 }; | |
55 | |
56 Vector<ClipCacheEntry>* getClipCacheEntries(); | |
57 | |
58 std::unique_ptr<Vector<ClipCacheEntry>> m_clipCache; | |
pdr.
2017/03/08 02:34:55
Because GeometryMapperClipCache is lazily allocate
chrishtr
2017/03/08 02:59:28
Done.
| |
59 unsigned m_cacheGeneration; | |
60 }; | |
61 | |
62 } // namespace blink | |
63 | |
64 #endif // GeometryMapperClipCache_h | |
OLD | NEW |