| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace ui { | 26 namespace ui { |
| 27 | 27 |
| 28 struct CARendererLayerParams; | 28 struct CARendererLayerParams; |
| 29 | 29 |
| 30 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear | 30 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear |
| 31 // list provided by the CoreAnimation renderer using the algorithm and structure | 31 // list provided by the CoreAnimation renderer using the algorithm and structure |
| 32 // referenced described in | 32 // referenced described in |
| 33 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig
QY/edit?usp=sharing | 33 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig
QY/edit?usp=sharing |
| 34 class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree { | 34 class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree { |
| 35 public: | 35 public: |
| 36 CARendererLayerTree(bool allow_av_sample_buffer_display_layer); | 36 CARendererLayerTree(bool allow_av_sample_buffer_display_layer, |
| 37 bool allow_solid_color_layers); |
| 37 | 38 |
| 38 // This will remove all CALayers from this tree from their superlayer. | 39 // This will remove all CALayers from this tree from their superlayer. |
| 39 ~CARendererLayerTree(); | 40 ~CARendererLayerTree(); |
| 40 | 41 |
| 41 // Append the description of a new CALayer to the tree. This will not | 42 // Append the description of a new CALayer to the tree. This will not |
| 42 // create any new CALayers until CommitScheduledCALayers is called. This | 43 // create any new CALayers until CommitScheduledCALayers is called. This |
| 43 // cannot be called anymore after CommitScheduledCALayers has been called. | 44 // cannot be called anymore after CommitScheduledCALayers has been called. |
| 44 bool ScheduleCALayer(const CARendererLayerParams& params); | 45 bool ScheduleCALayer(const CARendererLayerParams& params); |
| 45 | 46 |
| 46 // Create a CALayer tree for the scheduled layers, and set |superlayer| to | 47 // Create a CALayer tree for the scheduled layers, and set |superlayer| to |
| 47 // have only this tree as its sublayers. If |old_tree| is non-null, then try | 48 // have only this tree as its sublayers. If |old_tree| is non-null, then try |
| 48 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will | 49 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will |
| 49 // be destroyed at the end of the function, and any CALayers in it which were | 50 // be destroyed at the end of the function, and any CALayers in it which were |
| 50 // not re-used by |this| will be removed from the CALayer hierarchy. | 51 // not re-used by |this| will be removed from the CALayer hierarchy. |
| 51 void CommitScheduledCALayers(CALayer* superlayer, | 52 void CommitScheduledCALayers(CALayer* superlayer, |
| 52 std::unique_ptr<CARendererLayerTree> old_tree, | 53 std::unique_ptr<CARendererLayerTree> old_tree, |
| 53 float scale_factor); | 54 float scale_factor); |
| 54 | 55 |
| 55 // Check to see if the CALayer tree can be represented entirely by a video | 56 // Check to see if the CALayer tree can be represented entirely by a video |
| 56 // layer on a black background. If so, then set |fullscreen_low_power_layer| | 57 // layer on a black background. If so, then set |fullscreen_low_power_layer| |
| 57 // to draw this content and return true. Otherwise return false. This is to | 58 // to draw this content and return true. Otherwise return false. This is to |
| 58 // be called after committing scheduled CALayers. | 59 // be called after committing scheduled CALayers. |
| 59 bool CommitFullscreenLowPowerLayer( | 60 bool CommitFullscreenLowPowerLayer( |
| 60 AVSampleBufferDisplayLayer* fullscreen_low_power_layer); | 61 AVSampleBufferDisplayLayer* fullscreen_low_power_layer); |
| 61 | 62 |
| 63 // Returns the contents used for a given solid color. |
| 64 id ContentsForSolidColorForTesting(unsigned int color); |
| 65 |
| 62 private: | 66 private: |
| 63 class SolidColorContents; | 67 class SolidColorContents; |
| 64 struct RootLayer; | 68 struct RootLayer; |
| 65 struct ClipAndSortingLayer; | 69 struct ClipAndSortingLayer; |
| 66 struct TransformLayer; | 70 struct TransformLayer; |
| 67 struct ContentLayer; | 71 struct ContentLayer; |
| 68 friend struct ContentLayer; | 72 friend struct ContentLayer; |
| 69 | 73 |
| 70 struct RootLayer { | 74 struct RootLayer { |
| 71 RootLayer(); | 75 RootLayer(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 bool use_av_layer = false; | 184 bool use_av_layer = false; |
| 181 | 185 |
| 182 private: | 186 private: |
| 183 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 187 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 184 }; | 188 }; |
| 185 | 189 |
| 186 RootLayer root_layer_; | 190 RootLayer root_layer_; |
| 187 float scale_factor_ = 1; | 191 float scale_factor_ = 1; |
| 188 bool has_committed_ = false; | 192 bool has_committed_ = false; |
| 189 const bool allow_av_sample_buffer_display_layer_ = true; | 193 const bool allow_av_sample_buffer_display_layer_ = true; |
| 194 const bool allow_solid_color_layers_ = true; |
| 190 | 195 |
| 191 private: | 196 private: |
| 192 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); | 197 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); |
| 193 }; | 198 }; |
| 194 | 199 |
| 195 } // namespace ui | 200 } // namespace ui |
| 196 | 201 |
| 197 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ | 202 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ |
| OLD | NEW |