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/PaintChunkProperties.h" | 9 #include "platform/graphics/paint/PaintChunkProperties.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include <iosfwd> | 11 #include <iosfwd> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // A contiguous sequence of drawings with common paint properties. | 15 // A contiguous sequence of drawings with common paint properties. |
16 // | 16 // |
17 // This is expected to be owned by the paint artifact which also owns the | 17 // This is expected to be owned by the paint artifact which also owns the |
18 // related drawings. | 18 // related drawings. |
19 // | 19 // |
20 // This is a Slimming Paint v2 class. | 20 // This is a Slimming Paint v2 class. |
21 struct PaintChunk { | 21 struct PaintChunk { |
22 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 22 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
23 PaintChunk() : beginIndex(0), endIndex(0) { } | 23 PaintChunk() : beginIndex(0), endIndex(0), knownToBeOpaque(false) { } |
24 PaintChunk(unsigned begin, unsigned end, const PaintChunkProperties& props) | 24 PaintChunk(unsigned begin, unsigned end, const PaintChunkProperties& props) |
25 : beginIndex(begin), endIndex(end), properties(props) { } | 25 : beginIndex(begin), endIndex(end), properties(props), knownToBeOpaque(f alse) { } |
26 | 26 |
27 // Index of the first drawing in this chunk. | 27 // Index of the first drawing in this chunk. |
28 unsigned beginIndex; | 28 unsigned beginIndex; |
29 | 29 |
30 // Index of the first drawing not in this chunk, so that there are | 30 // Index of the first drawing not in this chunk, so that there are |
31 // |endIndex - beginIndex| drawings in the chunk. | 31 // |endIndex - beginIndex| drawings in the chunk. |
32 unsigned endIndex; | 32 unsigned endIndex; |
33 | 33 |
34 // The paint properties which apply to this chunk. | 34 // The paint properties which apply to this chunk. |
35 PaintChunkProperties properties; | 35 PaintChunkProperties properties; |
36 | 36 |
37 // The total bounds of this paint chunk's contents. | 37 // The total bounds of this paint chunk's contents. |
38 FloatRect bounds; | 38 FloatRect bounds; |
39 | |
40 // True if the bounds are filled entirely with opaque contents. | |
41 bool knownToBeOpaque; | |
39 }; | 42 }; |
40 | 43 |
41 inline bool operator==(const PaintChunk& a, const PaintChunk& b) | 44 inline bool operator==(const PaintChunk& a, const PaintChunk& b) |
jbroman
2016/01/26 17:50:14
mind updating operator==?
pdr.
2016/01/26 23:38:08
Done.
| |
42 { | 45 { |
43 return a.beginIndex == b.beginIndex | 46 return a.beginIndex == b.beginIndex |
44 && a.endIndex == b.endIndex | 47 && a.endIndex == b.endIndex |
45 && a.properties == b.properties | 48 && a.properties == b.properties |
46 && a.bounds == b.bounds; | 49 && a.bounds == b.bounds; |
47 } | 50 } |
48 | 51 |
49 inline bool operator!=(const PaintChunk& a, const PaintChunk& b) | 52 inline bool operator!=(const PaintChunk& a, const PaintChunk& b) |
50 { | 53 { |
51 return !(a == b); | 54 return !(a == b); |
52 } | 55 } |
53 | 56 |
54 // Redeclared here to avoid ODR issues. | 57 // Redeclared here to avoid ODR issues. |
55 // See platform/testing/PaintPrinters.h. | 58 // See platform/testing/PaintPrinters.h. |
56 void PrintTo(const PaintChunk&, std::ostream*); | 59 void PrintTo(const PaintChunk&, std::ostream*); |
57 | 60 |
58 } // namespace blink | 61 } // namespace blink |
59 | 62 |
60 #endif // PaintChunk_h | 63 #endif // PaintChunk_h |
OLD | NEW |