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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h

Issue 2565073002: Implement the algorithm to test merging and overlap in PaintArtifactCompositor. (Closed)
Patch Set: none Created 4 years 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 PaintArtifactCompositor_h 5 #ifndef PaintArtifactCompositor_h
6 #define PaintArtifactCompositor_h 6 #define PaintArtifactCompositor_h
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "platform/PlatformExport.h" 9 #include "platform/PlatformExport.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
11 #include "platform/graphics/GraphicsLayerClient.h" 11 #include "platform/graphics/GraphicsLayerClient.h"
12 #include "platform/graphics/paint/PaintController.h" 12 #include "platform/graphics/paint/PaintController.h"
13 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
14 #include "wtf/PtrUtil.h" 14 #include "wtf/PtrUtil.h"
15 #include "wtf/Vector.h" 15 #include "wtf/Vector.h"
16 #include <memory> 16 #include <memory>
17 17
18 namespace cc { 18 namespace cc {
19 class Layer; 19 class Layer;
20 } 20 }
21 21
22 namespace gfx { 22 namespace gfx {
23 class Vector2dF; 23 class Vector2dF;
24 } 24 }
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class JSONObject; 28 class JSONObject;
29 class LayoutView;
29 class PaintArtifact; 30 class PaintArtifact;
30 class WebLayer; 31 class WebLayer;
31 struct PaintChunk; 32 struct PaintChunk;
32 33
34 struct PendingLayer {
35 PendingLayer(const PaintChunk& firstPaintChunk) : knownToBeOpaque(false) {
36 add(firstPaintChunk);
37 }
38
39 void add(const PaintChunk& paintChunk) {
40 paintChunks.append(paintChunk);
41 bounds.unite(paintChunk.bounds);
42 knownToBeOpaque = knownToBeOpaque && paintChunk.knownToBeOpaque;
43 }
44
45 FloatRect bounds;
46 Vector<PaintChunk> paintChunks;
47 bool knownToBeOpaque;
48 };
49
33 // Responsible for managing compositing in terms of a PaintArtifact. 50 // Responsible for managing compositing in terms of a PaintArtifact.
34 // 51 //
35 // Owns a subtree of the compositor layer tree, and updates it in response to 52 // Owns a subtree of the compositor layer tree, and updates it in response to
36 // changes in the paint artifact. 53 // changes in the paint artifact.
37 // 54 //
38 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting 55 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting
39 // the new home of compositing decisions after paint in Slimming Paint v2. 56 // the new home of compositing decisions after paint in Slimming Paint v2.
40 class PLATFORM_EXPORT PaintArtifactCompositor { 57 class PLATFORM_EXPORT PaintArtifactCompositor {
41 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor); 58 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor);
42 59
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void resetTrackedRasterInvalidations(); 92 void resetTrackedRasterInvalidations();
76 bool hasTrackedRasterInvalidations() const; 93 bool hasTrackedRasterInvalidations() const;
77 94
78 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const; 95 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const;
79 96
80 private: 97 private:
81 PaintArtifactCompositor(); 98 PaintArtifactCompositor();
82 99
83 class ContentLayerClientImpl; 100 class ContentLayerClientImpl;
84 101
102 void collectPendingLayers(const Vector<PaintChunk>& paintChunks,
103 Vector<PendingLayer>& pendingLayers);
104
85 // Builds a leaf layer that represents a single paint chunk. 105 // Builds a leaf layer that represents a single paint chunk.
86 // Note: cc::Layer API assumes the layer bounds start at (0, 0), but the 106 // Note: cc::Layer API assumes the layer bounds start at (0, 0), but the
87 // bounding box of a paint chunk does not necessarily start at (0, 0) (and 107 // bounding box of a paint chunk does not necessarily start at (0, 0) (and
88 // could even be negative). Internally the generated layer translates the 108 // could even be negative). Internally the generated layer translates the
89 // paint chunk to align the bounding box to (0, 0) and return the actual 109 // paint chunk to align the bounding box to (0, 0) and return the actual
90 // origin of the paint chunk in the |layerOffset| outparam. 110 // origin of the paint chunk in the |layerOffset| outparam.
91 scoped_refptr<cc::Layer> layerForPaintChunk( 111 scoped_refptr<cc::Layer> compositedLayerForPendingLayer(
92 const PaintArtifact&, 112 const PaintArtifact&,
93 const PaintChunk&, 113 const PendingLayer&,
94 gfx::Vector2dF& layerOffset, 114 gfx::Vector2dF& layerOffset,
95 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, 115 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients,
96 RasterInvalidationTracking*); 116 RasterInvalidationTrackingMap<const PaintChunk>*);
97 117
98 // Finds a client among the current vector of clients that matches the paint 118 // Finds a client among the current vector of clients that matches the paint
99 // chunk's id, or otherwise allocates a new one. 119 // chunk's id, or otherwise allocates a new one.
100 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk( 120 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk(
101 const PaintChunk&, 121 const PaintChunk&,
102 const PaintArtifact&); 122 const PaintArtifact&);
103 123
104 scoped_refptr<cc::Layer> m_rootLayer; 124 scoped_refptr<cc::Layer> m_rootLayer;
105 std::unique_ptr<WebLayer> m_webLayer; 125 std::unique_ptr<WebLayer> m_webLayer;
106 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; 126 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients;
107 127
108 bool m_extraDataForTestingEnabled = false; 128 bool m_extraDataForTestingEnabled = false;
109 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; 129 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting;
110 friend class StubChromeClientForSPv2; 130 friend class StubChromeClientForSPv2;
111 131
112 bool m_isTrackingRasterInvalidations; 132 bool m_isTrackingRasterInvalidations;
113 }; 133 };
114 134
115 } // namespace blink 135 } // namespace blink
116 136
117 #endif // PaintArtifactCompositor_h 137 #endif // PaintArtifactCompositor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698