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 <iosfwd> | 8 #include <iosfwd> |
9 #include "platform/geometry/FloatRect.h" | 9 #include "platform/geometry/FloatRect.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 const PaintChunkProperties& props) | 30 const PaintChunkProperties& props) |
31 : beginIndex(begin), | 31 : beginIndex(begin), |
32 endIndex(end), | 32 endIndex(end), |
33 properties(props), | 33 properties(props), |
34 knownToBeOpaque(false) { | 34 knownToBeOpaque(false) { |
35 if (chunkId) | 35 if (chunkId) |
36 id.emplace(*chunkId); | 36 id.emplace(*chunkId); |
37 } | 37 } |
38 | 38 |
39 size_t size() const { | 39 size_t size() const { |
40 ASSERT(endIndex >= beginIndex); | 40 DCHECK_GE(endIndex, beginIndex); |
41 return endIndex - beginIndex; | 41 return endIndex - beginIndex; |
42 } | 42 } |
43 | 43 |
44 // Check if a new PaintChunk (this) created in the latest paint matches an old | 44 // Check if a new PaintChunk (this) created in the latest paint matches an old |
45 // PaintChunk created in the previous paint. | 45 // PaintChunk created in the previous paint. |
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) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const_cast<Vector<PaintChunk>&>(chunks), index); | 123 const_cast<Vector<PaintChunk>&>(chunks), index); |
124 } | 124 } |
125 | 125 |
126 // Redeclared here to avoid ODR issues. | 126 // Redeclared here to avoid ODR issues. |
127 // See platform/testing/PaintPrinters.h. | 127 // See platform/testing/PaintPrinters.h. |
128 void PrintTo(const PaintChunk&, std::ostream*); | 128 void PrintTo(const PaintChunk&, std::ostream*); |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
131 | 131 |
132 #endif // PaintChunk_h | 132 #endif // PaintChunk_h |
OLD | NEW |