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

Side by Side Diff: ui/accelerated_widget_mac/ca_renderer_layer_tree.h

Issue 1893273005: Hook up plumbing for minification/magnification filters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp66
Patch Set: Rebase. Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_H_ 5 #ifndef UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_H_
6 #define UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_H_ 6 #define UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_H_
7 7
8 #include <IOSurface/IOSurface.h> 8 #include <IOSurface/IOSurface.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 10
(...skipping 30 matching lines...) Expand all
41 bool ScheduleCALayer(bool is_clipped, 41 bool ScheduleCALayer(bool is_clipped,
42 const gfx::Rect& clip_rect, 42 const gfx::Rect& clip_rect,
43 unsigned sorting_context_id, 43 unsigned sorting_context_id,
44 const gfx::Transform& transform, 44 const gfx::Transform& transform,
45 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 45 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
46 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, 46 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
47 const gfx::RectF& contents_rect, 47 const gfx::RectF& contents_rect,
48 const gfx::Rect& rect, 48 const gfx::Rect& rect,
49 unsigned background_color, 49 unsigned background_color,
50 unsigned edge_aa_mask, 50 unsigned edge_aa_mask,
51 float opacity); 51 float opacity,
52 unsigned filter);
52 53
53 // Create a CALayer tree for the scheduled layers, and set |superlayer| to 54 // Create a CALayer tree for the scheduled layers, and set |superlayer| to
54 // have only this tree as its sublayers. If |old_tree| is non-null, then try 55 // have only this tree as its sublayers. If |old_tree| is non-null, then try
55 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will 56 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will
56 // be destroyed at the end of the function, and any CALayers in it which were 57 // be destroyed at the end of the function, and any CALayers in it which were
57 // not re-used by |this| will be removed from the CALayer hierarchy. 58 // not re-used by |this| will be removed from the CALayer hierarchy.
58 void CommitScheduledCALayers(CALayer* superlayer, 59 void CommitScheduledCALayers(CALayer* superlayer,
59 std::unique_ptr<CARendererLayerTree> old_tree, 60 std::unique_ptr<CARendererLayerTree> old_tree,
60 float scale_factor); 61 float scale_factor);
61 62
(...skipping 23 matching lines...) Expand all
85 bool is_clipped, 86 bool is_clipped,
86 const gfx::Rect& clip_rect, 87 const gfx::Rect& clip_rect,
87 unsigned sorting_context_id, 88 unsigned sorting_context_id,
88 const gfx::Transform& transform, 89 const gfx::Transform& transform,
89 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 90 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
90 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, 91 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
91 const gfx::RectF& contents_rect, 92 const gfx::RectF& contents_rect,
92 const gfx::Rect& rect, 93 const gfx::Rect& rect,
93 unsigned background_color, 94 unsigned background_color,
94 unsigned edge_aa_mask, 95 unsigned edge_aa_mask,
95 float opacity); 96 float opacity,
97 unsigned filter);
96 98
97 // Allocate CALayers for this layer and its children, and set their 99 // Allocate CALayers for this layer and its children, and set their
98 // properties appropriately. Re-use the CALayers from |old_layer| if 100 // properties appropriately. Re-use the CALayers from |old_layer| if
99 // possible. If re-using a CALayer from |old_layer|, reset its |ca_layer| 101 // possible. If re-using a CALayer from |old_layer|, reset its |ca_layer|
100 // to nil, so that its destructor will not remove an active CALayer. 102 // to nil, so that its destructor will not remove an active CALayer.
101 void CommitToCA(CALayer* superlayer, 103 void CommitToCA(CALayer* superlayer,
102 RootLayer* old_layer, 104 RootLayer* old_layer,
103 float scale_factor); 105 float scale_factor);
104 106
105 std::vector<ClipAndSortingLayer> clip_and_sorting_layers; 107 std::vector<ClipAndSortingLayer> clip_and_sorting_layers;
(...skipping 13 matching lines...) Expand all
119 // |ca_layer| member and |old_layer| argument. 121 // |ca_layer| member and |old_layer| argument.
120 ~ClipAndSortingLayer(); 122 ~ClipAndSortingLayer();
121 void AddContentLayer( 123 void AddContentLayer(
122 const gfx::Transform& transform, 124 const gfx::Transform& transform,
123 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 125 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
124 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, 126 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
125 const gfx::RectF& contents_rect, 127 const gfx::RectF& contents_rect,
126 const gfx::Rect& rect, 128 const gfx::Rect& rect,
127 unsigned background_color, 129 unsigned background_color,
128 unsigned edge_aa_mask, 130 unsigned edge_aa_mask,
129 float opacity); 131 float opacity,
132 unsigned filter);
130 void CommitToCA(CALayer* superlayer, 133 void CommitToCA(CALayer* superlayer,
131 ClipAndSortingLayer* old_layer, 134 ClipAndSortingLayer* old_layer,
132 float scale_factor); 135 float scale_factor);
133 136
134 std::vector<TransformLayer> transform_layers; 137 std::vector<TransformLayer> transform_layers;
135 bool is_clipped = false; 138 bool is_clipped = false;
136 gfx::Rect clip_rect; 139 gfx::Rect clip_rect;
137 unsigned sorting_context_id = 0; 140 unsigned sorting_context_id = 0;
138 bool is_singleton_sorting_context = false; 141 bool is_singleton_sorting_context = false;
139 base::scoped_nsobject<CALayer> ca_layer; 142 base::scoped_nsobject<CALayer> ca_layer;
140 143
141 private: 144 private:
142 DISALLOW_COPY_AND_ASSIGN(ClipAndSortingLayer); 145 DISALLOW_COPY_AND_ASSIGN(ClipAndSortingLayer);
143 }; 146 };
144 struct TransformLayer { 147 struct TransformLayer {
145 TransformLayer(const gfx::Transform& transform); 148 TransformLayer(const gfx::Transform& transform);
146 TransformLayer(TransformLayer&& layer); 149 TransformLayer(TransformLayer&& layer);
147 150
148 // See the behavior of RootLayer for the effects of these functions on the 151 // See the behavior of RootLayer for the effects of these functions on the
149 // |ca_layer| member and |old_layer| argument. 152 // |ca_layer| member and |old_layer| argument.
150 ~TransformLayer(); 153 ~TransformLayer();
151 void AddContentLayer( 154 void AddContentLayer(
152 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 155 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
153 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, 156 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
154 const gfx::RectF& contents_rect, 157 const gfx::RectF& contents_rect,
155 const gfx::Rect& rect, 158 const gfx::Rect& rect,
156 unsigned background_color, 159 unsigned background_color,
157 unsigned edge_aa_mask, 160 unsigned edge_aa_mask,
158 float opacity); 161 float opacity,
162 unsigned filter);
159 void CommitToCA(CALayer* superlayer, 163 void CommitToCA(CALayer* superlayer,
160 TransformLayer* old_layer, 164 TransformLayer* old_layer,
161 float scale_factor); 165 float scale_factor);
162 166
163 gfx::Transform transform; 167 gfx::Transform transform;
164 std::vector<ContentLayer> content_layers; 168 std::vector<ContentLayer> content_layers;
165 base::scoped_nsobject<CALayer> ca_layer; 169 base::scoped_nsobject<CALayer> ca_layer;
166 170
167 private: 171 private:
168 DISALLOW_COPY_AND_ASSIGN(TransformLayer); 172 DISALLOW_COPY_AND_ASSIGN(TransformLayer);
169 }; 173 };
170 struct ContentLayer { 174 struct ContentLayer {
171 ContentLayer(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 175 ContentLayer(base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
172 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, 176 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
173 const gfx::RectF& contents_rect, 177 const gfx::RectF& contents_rect,
174 const gfx::Rect& rect, 178 const gfx::Rect& rect,
175 unsigned background_color, 179 unsigned background_color,
176 unsigned edge_aa_mask, 180 unsigned edge_aa_mask,
177 float opacity); 181 float opacity,
182 unsigned filter);
178 ContentLayer(ContentLayer&& layer); 183 ContentLayer(ContentLayer&& layer);
179 184
180 // See the behavior of RootLayer for the effects of these functions on the 185 // See the behavior of RootLayer for the effects of these functions on the
181 // |ca_layer| member and |old_layer| argument. 186 // |ca_layer| member and |old_layer| argument.
182 ~ContentLayer(); 187 ~ContentLayer();
183 void CommitToCA(CALayer* parent, 188 void CommitToCA(CALayer* parent,
184 ContentLayer* old_layer, 189 ContentLayer* old_layer,
185 float scale_factor); 190 float scale_factor);
186 191
187 // Ensure that the IOSurface be marked as in-use as soon as it is received. 192 // Ensure that the IOSurface be marked as in-use as soon as it is received.
188 // When they are committed to the window server, that will also increment 193 // When they are committed to the window server, that will also increment
189 // their use count. 194 // their use count.
190 const gfx::ScopedInUseIOSurface io_surface; 195 const gfx::ScopedInUseIOSurface io_surface;
191 const base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; 196 const base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer;
192 gfx::RectF contents_rect; 197 gfx::RectF contents_rect;
193 gfx::Rect rect; 198 gfx::Rect rect;
194 unsigned background_color = 0; 199 unsigned background_color = 0;
195 // Note that the CoreAnimation edge antialiasing mask is not the same as 200 // Note that the CoreAnimation edge antialiasing mask is not the same as
196 // the edge antialiasing mask passed to the constructor. 201 // the edge antialiasing mask passed to the constructor.
197 CAEdgeAntialiasingMask ca_edge_aa_mask = 0; 202 CAEdgeAntialiasingMask ca_edge_aa_mask = 0;
198 float opacity = 1; 203 float opacity = 1;
204 base::scoped_nsobject<NSString> ca_filter;
ccameron 2016/04/27 22:45:48 I'd be inclined to leave this just as NSString* co
erikchen 2016/04/28 01:18:21 Done.
199 base::scoped_nsobject<CALayer> ca_layer; 205 base::scoped_nsobject<CALayer> ca_layer;
200 206
201 // If this layer's contents can be represented as an 207 // If this layer's contents can be represented as an
202 // AVSampleBufferDisplayLayer, then |ca_layer| will point to |av_layer|. 208 // AVSampleBufferDisplayLayer, then |ca_layer| will point to |av_layer|.
203 base::scoped_nsobject<AVSampleBufferDisplayLayer> av_layer; 209 base::scoped_nsobject<AVSampleBufferDisplayLayer> av_layer;
204 bool use_av_layer = false; 210 bool use_av_layer = false;
205 211
206 private: 212 private:
207 DISALLOW_COPY_AND_ASSIGN(ContentLayer); 213 DISALLOW_COPY_AND_ASSIGN(ContentLayer);
208 }; 214 };
209 215
210 RootLayer root_layer_; 216 RootLayer root_layer_;
211 float scale_factor_ = 1; 217 float scale_factor_ = 1;
212 bool has_committed_ = false; 218 bool has_committed_ = false;
213 219
214 private: 220 private:
215 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); 221 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree);
216 }; 222 };
217 223
218 } // namespace ui 224 } // namespace ui
219 225
220 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ 226 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698