Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintChunk.h

Issue 1632263002: Calculate and track display item opaqueness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Be more conservative about rounding Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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)
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
50 && a.knownToBeOpaque == b.knownToBeOpaque;
47 } 51 }
48 52
49 inline bool operator!=(const PaintChunk& a, const PaintChunk& b) 53 inline bool operator!=(const PaintChunk& a, const PaintChunk& b)
50 { 54 {
51 return !(a == b); 55 return !(a == b);
52 } 56 }
53 57
54 // Redeclared here to avoid ODR issues. 58 // Redeclared here to avoid ODR issues.
55 // See platform/testing/PaintPrinters.h. 59 // See platform/testing/PaintPrinters.h.
56 void PrintTo(const PaintChunk&, std::ostream*); 60 void PrintTo(const PaintChunk&, std::ostream*);
57 61
58 } // namespace blink 62 } // namespace blink
59 63
60 #endif // PaintChunk_h 64 #endif // PaintChunk_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698