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