OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 PaintChunker_h | 5 #ifndef PaintChunker_h |
6 #define PaintChunker_h | 6 #define PaintChunker_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/PaintChunk.h" | 10 #include "platform/graphics/paint/PaintChunk.h" |
10 #include "platform/graphics/paint/PaintChunkProperties.h" | 11 #include "platform/graphics/paint/PaintChunkProperties.h" |
11 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
12 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
13 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 // Accepts information about changes to |PaintChunkProperties| as drawings are | 18 // Accepts information about changes to |PaintChunkProperties| as drawings are |
18 // accumulated, and produces a series of paint chunks: contiguous ranges of the | 19 // accumulated, and produces a series of paint chunks: contiguous ranges of the |
19 // display list with identical |PaintChunkProperties|. | 20 // display list with identical |PaintChunkProperties|. |
20 class PLATFORM_EXPORT PaintChunker final { | 21 class PLATFORM_EXPORT PaintChunker final { |
21 DISALLOW_NEW(); | 22 DISALLOW_NEW(); |
22 WTF_MAKE_NONCOPYABLE(PaintChunker); | 23 WTF_MAKE_NONCOPYABLE(PaintChunker); |
23 public: | 24 public: |
24 enum ItemBehavior { | |
25 // Can be combined with adjacent items when building chunks. | |
26 DefaultBehavior = 0, | |
27 | |
28 // Item requires its own paint chunk. | |
29 RequiresSeparateChunk, | |
30 }; | |
31 | |
32 PaintChunker(); | 25 PaintChunker(); |
33 ~PaintChunker(); | 26 ~PaintChunker(); |
34 | 27 |
35 bool isInInitialState() const { return m_chunks.isEmpty() && m_currentProper
ties == PaintChunkProperties(); } | 28 bool isInInitialState() const { return m_chunks.isEmpty() && m_currentProper
ties == PaintChunkProperties(); } |
36 | 29 |
37 const PaintChunkProperties& currentPaintChunkProperties() const { return m_c
urrentProperties; } | 30 const PaintChunkProperties& currentPaintChunkProperties() const { return m_c
urrentProperties; } |
38 void updateCurrentPaintChunkProperties(const PaintChunkProperties&); | 31 void updateCurrentPaintChunkProperties(const PaintChunk::Id*, const PaintChu
nkProperties&); |
39 | 32 |
40 void incrementDisplayItemIndex(ItemBehavior); | 33 void incrementDisplayItemIndex(const DisplayItem&); |
41 void decrementDisplayItemIndex(); | 34 void decrementDisplayItemIndex(); |
42 | 35 |
43 void clear(); | 36 void clear(); |
44 | 37 |
45 // Releases the generated paint chunk list and resets the state of this | 38 // Releases the generated paint chunk list and resets the state of this |
46 // object. | 39 // object. |
47 Vector<PaintChunk> releasePaintChunks(); | 40 Vector<PaintChunk> releasePaintChunks(); |
48 | 41 |
49 private: | 42 private: |
| 43 enum ItemBehavior { |
| 44 // Can be combined with adjacent items when building chunks. |
| 45 DefaultBehavior = 0, |
| 46 |
| 47 // Item requires its own paint chunk. |
| 48 RequiresSeparateChunk, |
| 49 }; |
| 50 |
50 Vector<PaintChunk> m_chunks; | 51 Vector<PaintChunk> m_chunks; |
51 Vector<ItemBehavior> m_chunkBehavior; | 52 Vector<ItemBehavior> m_chunkBehavior; |
| 53 Optional<PaintChunk::Id> m_currentChunkId; |
52 PaintChunkProperties m_currentProperties; | 54 PaintChunkProperties m_currentProperties; |
53 }; | 55 }; |
54 | 56 |
55 } // namespace blink | 57 } // namespace blink |
56 | 58 |
57 #endif // PaintChunker_h | 59 #endif // PaintChunker_h |
OLD | NEW |