OLD | NEW |
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 |
11 #include <deque> | 11 #include <deque> |
12 #include <memory> | 12 #include <memory> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
16 #include "base/mac/scoped_nsobject.h" | 16 #include "base/mac/scoped_nsobject.h" |
17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | 17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |
18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
19 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
20 #include "ui/gfx/mac/io_surface.h" | 20 #include "ui/gfx/mac/io_surface.h" |
21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
22 #include "ui/gl/ca_renderer_layer_params.h" | |
23 | 22 |
24 @class AVSampleBufferDisplayLayer; | 23 @class AVSampleBufferDisplayLayer; |
25 | 24 |
26 namespace ui { | 25 namespace ui { |
27 | 26 |
28 struct CARendererLayerParams; | 27 struct CARendererLayerParams; |
29 | 28 |
30 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear | 29 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear |
31 // list provided by the CoreAnimation renderer using the algorithm and structure | 30 // list provided by the CoreAnimation renderer using the algorithm and structure |
32 // referenced described in | 31 // referenced described in |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DISALLOW_COPY_AND_ASSIGN(TransformLayer); | 134 DISALLOW_COPY_AND_ASSIGN(TransformLayer); |
136 }; | 135 }; |
137 struct ContentLayer { | 136 struct ContentLayer { |
138 ContentLayer(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 137 ContentLayer(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
139 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 138 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
140 const gfx::RectF& contents_rect, | 139 const gfx::RectF& contents_rect, |
141 const gfx::Rect& rect, | 140 const gfx::Rect& rect, |
142 unsigned background_color, | 141 unsigned background_color, |
143 unsigned edge_aa_mask, | 142 unsigned edge_aa_mask, |
144 float opacity, | 143 float opacity, |
145 unsigned filter, | 144 unsigned filter); |
146 const CARendererLayerParams::FilterEffects& filter_effects); | |
147 ContentLayer(ContentLayer&& layer); | 145 ContentLayer(ContentLayer&& layer); |
148 | 146 |
149 // See the behavior of RootLayer for the effects of these functions on the | 147 // See the behavior of RootLayer for the effects of these functions on the |
150 // |ca_layer| member and |old_layer| argument. | 148 // |ca_layer| member and |old_layer| argument. |
151 ~ContentLayer(); | 149 ~ContentLayer(); |
152 void CommitToCA(CALayer* parent, | 150 void CommitToCA(CALayer* parent, |
153 ContentLayer* old_layer, | 151 ContentLayer* old_layer, |
154 float scale_factor); | 152 float scale_factor); |
155 | 153 |
156 // Ensure that the IOSurface be marked as in-use as soon as it is received. | 154 // Ensure that the IOSurface be marked as in-use as soon as it is received. |
157 // When they are committed to the window server, that will also increment | 155 // When they are committed to the window server, that will also increment |
158 // their use count. | 156 // their use count. |
159 const gfx::ScopedInUseIOSurface io_surface; | 157 const gfx::ScopedInUseIOSurface io_surface; |
160 const base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; | 158 const base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; |
161 gfx::RectF contents_rect; | 159 gfx::RectF contents_rect; |
162 gfx::Rect rect; | 160 gfx::Rect rect; |
163 unsigned background_color = 0; | 161 unsigned background_color = 0; |
164 // Note that the CoreAnimation edge antialiasing mask is not the same as | 162 // Note that the CoreAnimation edge antialiasing mask is not the same as |
165 // the edge antialiasing mask passed to the constructor. | 163 // the edge antialiasing mask passed to the constructor. |
166 CAEdgeAntialiasingMask ca_edge_aa_mask = 0; | 164 CAEdgeAntialiasingMask ca_edge_aa_mask = 0; |
167 float opacity = 1; | 165 float opacity = 1; |
168 NSString* const ca_filter = nil; | 166 NSString* const ca_filter = nil; |
169 base::scoped_nsobject<CALayer> ca_layer; | 167 base::scoped_nsobject<CALayer> ca_layer; |
170 | 168 |
171 // If this layer's contents can be represented as an | 169 // If this layer's contents can be represented as an |
172 // AVSampleBufferDisplayLayer, then |ca_layer| will point to |av_layer|. | 170 // AVSampleBufferDisplayLayer, then |ca_layer| will point to |av_layer|. |
173 base::scoped_nsobject<AVSampleBufferDisplayLayer> av_layer; | 171 base::scoped_nsobject<AVSampleBufferDisplayLayer> av_layer; |
174 bool use_av_layer = false; | 172 bool use_av_layer = false; |
175 | 173 |
176 // Filter effects to apply to this layer. | |
177 CARendererLayerParams::FilterEffects filter_effects; | |
178 | |
179 private: | 174 private: |
180 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 175 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
181 }; | 176 }; |
182 | 177 |
183 RootLayer root_layer_; | 178 RootLayer root_layer_; |
184 float scale_factor_ = 1; | 179 float scale_factor_ = 1; |
185 bool has_committed_ = false; | 180 bool has_committed_ = false; |
186 | 181 |
187 private: | 182 private: |
188 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); | 183 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); |
189 }; | 184 }; |
190 | 185 |
191 } // namespace ui | 186 } // namespace ui |
192 | 187 |
193 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ | 188 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ |
OLD | NEW |