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" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/Optional.h" | 12 #include "wtf/Optional.h" |
| 13 #include "wtf/Vector.h" |
13 #include <iosfwd> | 14 #include <iosfwd> |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 // A contiguous sequence of drawings with common paint properties. | 18 // A contiguous sequence of drawings with common paint properties. |
18 // | 19 // |
19 // This is expected to be owned by the paint artifact which also owns the | 20 // This is expected to be owned by the paint artifact which also owns the |
20 // related drawings. | 21 // related drawings. |
21 // | 22 // |
22 // This is a Slimming Paint v2 class. | 23 // This is a Slimming Paint v2 class. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 && a.bounds == b.bounds | 95 && a.bounds == b.bounds |
95 && a.knownToBeOpaque == b.knownToBeOpaque | 96 && a.knownToBeOpaque == b.knownToBeOpaque |
96 && a.rasterInvalidationRects == b.rasterInvalidationRects; | 97 && a.rasterInvalidationRects == b.rasterInvalidationRects; |
97 } | 98 } |
98 | 99 |
99 inline bool operator!=(const PaintChunk& a, const PaintChunk& b) | 100 inline bool operator!=(const PaintChunk& a, const PaintChunk& b) |
100 { | 101 { |
101 return !(a == b); | 102 return !(a == b); |
102 } | 103 } |
103 | 104 |
| 105 inline bool chunkLessThanIndex(const PaintChunk& chunk, size_t index) |
| 106 { |
| 107 return chunk.endIndex <= index; |
| 108 } |
| 109 |
| 110 inline Vector<PaintChunk>::iterator findChunkInVectorByDisplayItemIndex(Vector<P
aintChunk>& chunks, size_t index) |
| 111 { |
| 112 auto chunk = std::lower_bound(chunks.begin(), chunks.end(), index, chunkLess
ThanIndex); |
| 113 DCHECK(chunk == chunks.end() || (index >= chunk->beginIndex && index < chunk
->endIndex)); |
| 114 return chunk; |
| 115 } |
| 116 |
| 117 inline Vector<PaintChunk>::const_iterator findChunkInVectorByDisplayItemIndex(co
nst Vector<PaintChunk>& chunks, size_t index) |
| 118 { |
| 119 return findChunkInVectorByDisplayItemIndex(const_cast<Vector<PaintChunk>&>(c
hunks), index); |
| 120 } |
| 121 |
104 // Redeclared here to avoid ODR issues. | 122 // Redeclared here to avoid ODR issues. |
105 // See platform/testing/PaintPrinters.h. | 123 // See platform/testing/PaintPrinters.h. |
106 void PrintTo(const PaintChunk&, std::ostream*); | 124 void PrintTo(const PaintChunk&, std::ostream*); |
107 | 125 |
108 } // namespace blink | 126 } // namespace blink |
109 | 127 |
110 #endif // PaintChunk_h | 128 #endif // PaintChunk_h |
OLD | NEW |