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