| 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 PaintChunk_h | 5 #ifndef PaintChunk_h |
| 6 #define PaintChunk_h | 6 #define PaintChunk_h |
| 7 | 7 |
| 8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
| 9 #include "platform/graphics/paint/DisplayItem.h" | 9 #include "platform/graphics/paint/DisplayItem.h" |
| 10 #include "platform/graphics/paint/PaintChunkProperties.h" | 10 #include "platform/graphics/paint/PaintChunkProperties.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool matches(const PaintChunk& old) const { | 46 bool matches(const PaintChunk& old) const { |
| 47 // A PaintChunk without an id doesn't match any other PaintChunks. | 47 // A PaintChunk without an id doesn't match any other PaintChunks. |
| 48 if (!id || !old.id) | 48 if (!id || !old.id) |
| 49 return false; | 49 return false; |
| 50 if (*id != *old.id) | 50 if (*id != *old.id) |
| 51 return false; | 51 return false; |
| 52 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 52 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 53 CHECK(id->client.isAlive()); | 53 CHECK(id->client.isAlive()); |
| 54 #endif | 54 #endif |
| 55 // A chunk whose client is just created should not match any cached chunk, | 55 // A chunk whose client is just created should not match any cached chunk, |
| 56 // even if it's id equals the old chunk's id (which may happen if this chunk
's | 56 // even if it's id equals the old chunk's id (which may happen if this |
| 57 // client is just created at the same address of the old chunk's deleted cli
ent). | 57 // chunk's client is just created at the same address of the old chunk's |
| 58 // deleted client). |
| 58 return !id->client.isJustCreated(); | 59 return !id->client.isJustCreated(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 // Index of the first drawing in this chunk. | 62 // Index of the first drawing in this chunk. |
| 62 size_t beginIndex; | 63 size_t beginIndex; |
| 63 | 64 |
| 64 // Index of the first drawing not in this chunk, so that there are | 65 // Index of the first drawing not in this chunk, so that there are |
| 65 // |endIndex - beginIndex| drawings in the chunk. | 66 // |endIndex - beginIndex| drawings in the chunk. |
| 66 size_t endIndex; | 67 size_t endIndex; |
| 67 | 68 |
| 68 // Identifier of this chunk. If it has a value, it should be unique. | 69 // Identifier of this chunk. If it has a value, it should be unique. This is |
| 69 // It's used to match a new chunk to a cached old chunk to track changes of ch
unk | 70 // used to match a new chunk to a cached old chunk to track changes of chunk |
| 70 // contents, so the id should be stable across document cycles. | 71 // contents, so the id should be stable across document cycles. If the |
| 71 // If the contents of the chunk can't be cached (e.g. it's created when PaintC
ontroller | 72 // contents of the chunk can't be cached (e.g. it's created when |
| 72 // is skipping cache, normally because display items can't be uniquely identif
ied), | 73 // PaintController is skipping the cache, normally because display items can't |
| 73 // id is nullopt so that the chunk won't match any other chunk. | 74 // be uniquely identified), |id| is nullopt so that the chunk won't match any |
| 75 // other chunk. |
| 74 using Id = DisplayItem::Id; | 76 using Id = DisplayItem::Id; |
| 75 Optional<Id> id; | 77 Optional<Id> id; |
| 76 | 78 |
| 77 // The paint properties which apply to this chunk. | 79 // The paint properties which apply to this chunk. |
| 78 PaintChunkProperties properties; | 80 PaintChunkProperties properties; |
| 79 | 81 |
| 80 // The total bounds of this paint chunk's contents, in -the coordinate space o
f | 82 // The total bounds of this paint chunk's contents, in the coordinate space of |
| 81 // the containing transform node. | 83 // the containing transform node. |
| 82 FloatRect bounds; | 84 FloatRect bounds; |
| 83 | 85 |
| 84 // True if the bounds are filled entirely with opaque contents. | 86 // True if the bounds are filled entirely with opaque contents. |
| 85 bool knownToBeOpaque; | 87 bool knownToBeOpaque; |
| 86 | 88 |
| 87 // SPv2 only. Rectangles that need to be re-rasterized in this chunk, in the | 89 // SPv2 only. Rectangles that need to be re-rasterized in this chunk, in the |
| 88 // coordinate space of the containing transform node. | 90 // coordinate space of the containing transform node. |
| 89 Vector<FloatRect> rasterInvalidationRects; | 91 Vector<FloatRect> rasterInvalidationRects; |
| 90 }; | 92 }; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 121 const_cast<Vector<PaintChunk>&>(chunks), index); | 123 const_cast<Vector<PaintChunk>&>(chunks), index); |
| 122 } | 124 } |
| 123 | 125 |
| 124 // Redeclared here to avoid ODR issues. | 126 // Redeclared here to avoid ODR issues. |
| 125 // See platform/testing/PaintPrinters.h. | 127 // See platform/testing/PaintPrinters.h. |
| 126 void PrintTo(const PaintChunk&, std::ostream*); | 128 void PrintTo(const PaintChunk&, std::ostream*); |
| 127 | 129 |
| 128 } // namespace blink | 130 } // namespace blink |
| 129 | 131 |
| 130 #endif // PaintChunk_h | 132 #endif // PaintChunk_h |
| OLD | NEW |