| 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/DisplayItem.h" |
| 10 #include "platform/graphics/paint/PaintChunk.h" | 10 #include "platform/graphics/paint/PaintChunk.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 WTF_MAKE_NONCOPYABLE(PaintChunker); | 23 WTF_MAKE_NONCOPYABLE(PaintChunker); |
| 24 public: | 24 public: |
| 25 PaintChunker(); | 25 PaintChunker(); |
| 26 ~PaintChunker(); | 26 ~PaintChunker(); |
| 27 | 27 |
| 28 bool isInInitialState() const { return m_chunks.isEmpty() && m_currentProper
ties == PaintChunkProperties(); } | 28 bool isInInitialState() const { return m_chunks.isEmpty() && m_currentProper
ties == PaintChunkProperties(); } |
| 29 | 29 |
| 30 const PaintChunkProperties& currentPaintChunkProperties() const { return m_c
urrentProperties; } | 30 const PaintChunkProperties& currentPaintChunkProperties() const { return m_c
urrentProperties; } |
| 31 void updateCurrentPaintChunkProperties(const PaintChunk::Id*, const PaintChu
nkProperties&); | 31 void updateCurrentPaintChunkProperties(const PaintChunk::Id*, const PaintChu
nkProperties&); |
| 32 | 32 |
| 33 void incrementDisplayItemIndex(const DisplayItem&); | 33 // Returns true if a new chunk is created. |
| 34 void decrementDisplayItemIndex(); | 34 bool incrementDisplayItemIndex(const DisplayItem&); |
| 35 // Returns true if the last chunk is removed. |
| 36 bool decrementDisplayItemIndex(); |
| 35 | 37 |
| 36 const PaintChunk& lastChunk() const { return m_chunks.last(); } | 38 PaintChunk& paintChunkAt(size_t i) { return m_chunks[i]; } |
| 39 size_t lastChunkIndex() const { return m_chunks.isEmpty() ? kNotFound : m_ch
unks.size() - 1; } |
| 40 PaintChunk& lastChunk() { return m_chunks.last(); } |
| 37 | 41 |
| 38 void clear(); | 42 void clear(); |
| 39 | 43 |
| 40 // Releases the generated paint chunk list and resets the state of this | 44 // Releases the generated paint chunk list and resets the state of this |
| 41 // object. | 45 // object. |
| 42 Vector<PaintChunk> releasePaintChunks(); | 46 Vector<PaintChunk> releasePaintChunks(); |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 enum ItemBehavior { | 49 enum ItemBehavior { |
| 46 // Can be combined with adjacent items when building chunks. | 50 // Can be combined with adjacent items when building chunks. |
| 47 DefaultBehavior = 0, | 51 DefaultBehavior = 0, |
| 48 | 52 |
| 49 // Item requires its own paint chunk. | 53 // Item requires its own paint chunk. |
| 50 RequiresSeparateChunk, | 54 RequiresSeparateChunk, |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 Vector<PaintChunk> m_chunks; | 57 Vector<PaintChunk> m_chunks; |
| 54 Vector<ItemBehavior> m_chunkBehavior; | 58 Vector<ItemBehavior> m_chunkBehavior; |
| 55 Optional<PaintChunk::Id> m_currentChunkId; | 59 Optional<PaintChunk::Id> m_currentChunkId; |
| 56 PaintChunkProperties m_currentProperties; | 60 PaintChunkProperties m_currentProperties; |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace blink | 63 } // namespace blink |
| 60 | 64 |
| 61 #endif // PaintChunker_h | 65 #endif // PaintChunker_h |
| OLD | NEW |