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

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

Issue 2006923006: Move all CARendererLayerTree parameters to separate struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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
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 22
23 @class AVSampleBufferDisplayLayer; 23 @class AVSampleBufferDisplayLayer;
24 24
25 namespace ui { 25 namespace ui {
26 26
27 struct CARendererLayerParams;
28
27 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear 29 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear
28 // list provided by the CoreAnimation renderer using the algorithm and structure 30 // list provided by the CoreAnimation renderer using the algorithm and structure
29 // referenced described in 31 // referenced described in
30 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig QY/edit?usp=sharing 32 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig QY/edit?usp=sharing
31 class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree { 33 class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree {
32 public: 34 public:
33 CARendererLayerTree(); 35 CARendererLayerTree();
34 36
35 // This will remove all CALayers from this tree from their superlayer. 37 // This will remove all CALayers from this tree from their superlayer.
36 ~CARendererLayerTree(); 38 ~CARendererLayerTree();
37 39
38 // Append the description of a new CALayer to the tree. This will not 40 // Append the description of a new CALayer to the tree. This will not
39 // create any new CALayers until CommitScheduledCALayers is called. This 41 // create any new CALayers until CommitScheduledCALayers is called. This
40 // cannot be called anymore after CommitScheduledCALayers has been called. 42 // cannot be called anymore after CommitScheduledCALayers has been called.
41 bool ScheduleCALayer(bool is_clipped, 43 bool ScheduleCALayer(const CARendererLayerParams& params);
42 const gfx::Rect& clip_rect,
43 unsigned sorting_context_id,
44 const gfx::Transform& transform,
45 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
46 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
47 const gfx::RectF& contents_rect,
48 const gfx::Rect& rect,
49 unsigned background_color,
50 unsigned edge_aa_mask,
51 float opacity,
52 unsigned filter);
53 44
54 // Create a CALayer tree for the scheduled layers, and set |superlayer| to 45 // Create a CALayer tree for the scheduled layers, and set |superlayer| to
55 // have only this tree as its sublayers. If |old_tree| is non-null, then try 46 // have only this tree as its sublayers. If |old_tree| is non-null, then try
56 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will 47 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will
57 // be destroyed at the end of the function, and any CALayers in it which were 48 // be destroyed at the end of the function, and any CALayers in it which were
58 // not re-used by |this| will be removed from the CALayer hierarchy. 49 // not re-used by |this| will be removed from the CALayer hierarchy.
59 void CommitScheduledCALayers(CALayer* superlayer, 50 void CommitScheduledCALayers(CALayer* superlayer,
60 std::unique_ptr<CARendererLayerTree> old_tree, 51 std::unique_ptr<CARendererLayerTree> old_tree,
61 float scale_factor); 52 float scale_factor);
62 53
(...skipping 12 matching lines...) Expand all
75 66
76 struct RootLayer { 67 struct RootLayer {
77 RootLayer(); 68 RootLayer();
78 69
79 // This will remove |ca_layer| from its superlayer, if |ca_layer| is 70 // This will remove |ca_layer| from its superlayer, if |ca_layer| is
80 // non-nil. 71 // non-nil.
81 ~RootLayer(); 72 ~RootLayer();
82 73
83 // Append a new content layer, without modifying the actual CALayer 74 // Append a new content layer, without modifying the actual CALayer
84 // structure. 75 // structure.
85 bool AddContentLayer( 76 bool AddContentLayer(const CARendererLayerParams& params);
86 bool is_clipped,
87 const gfx::Rect& clip_rect,
88 unsigned sorting_context_id,
89 const gfx::Transform& transform,
90 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
91 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
92 const gfx::RectF& contents_rect,
93 const gfx::Rect& rect,
94 unsigned background_color,
95 unsigned edge_aa_mask,
96 float opacity,
97 unsigned filter);
98 77
99 // Allocate CALayers for this layer and its children, and set their 78 // Allocate CALayers for this layer and its children, and set their
100 // properties appropriately. Re-use the CALayers from |old_layer| if 79 // properties appropriately. Re-use the CALayers from |old_layer| if
101 // possible. If re-using a CALayer from |old_layer|, reset its |ca_layer| 80 // possible. If re-using a CALayer from |old_layer|, reset its |ca_layer|
102 // to nil, so that its destructor will not remove an active CALayer. 81 // to nil, so that its destructor will not remove an active CALayer.
103 void CommitToCA(CALayer* superlayer, 82 void CommitToCA(CALayer* superlayer,
104 RootLayer* old_layer, 83 RootLayer* old_layer,
105 float scale_factor); 84 float scale_factor);
106 85
107 std::vector<ClipAndSortingLayer> clip_and_sorting_layers; 86 std::vector<ClipAndSortingLayer> clip_and_sorting_layers;
108 base::scoped_nsobject<CALayer> ca_layer; 87 base::scoped_nsobject<CALayer> ca_layer;
109 88
110 private: 89 private:
111 DISALLOW_COPY_AND_ASSIGN(RootLayer); 90 DISALLOW_COPY_AND_ASSIGN(RootLayer);
112 }; 91 };
113 struct ClipAndSortingLayer { 92 struct ClipAndSortingLayer {
114 ClipAndSortingLayer(bool is_clipped, 93 ClipAndSortingLayer(bool is_clipped,
115 gfx::Rect clip_rect, 94 gfx::Rect clip_rect,
116 unsigned sorting_context_id, 95 unsigned sorting_context_id,
117 bool is_singleton_sorting_context); 96 bool is_singleton_sorting_context);
118 ClipAndSortingLayer(ClipAndSortingLayer&& layer); 97 ClipAndSortingLayer(ClipAndSortingLayer&& layer);
119 98
120 // See the behavior of RootLayer for the effects of these functions on the 99 // See the behavior of RootLayer for the effects of these functions on the
121 // |ca_layer| member and |old_layer| argument. 100 // |ca_layer| member and |old_layer| argument.
122 ~ClipAndSortingLayer(); 101 ~ClipAndSortingLayer();
123 void AddContentLayer( 102 void AddContentLayer(const CARendererLayerParams& params);
124 const gfx::Transform& transform,
125 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
126 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
127 const gfx::RectF& contents_rect,
128 const gfx::Rect& rect,
129 unsigned background_color,
130 unsigned edge_aa_mask,
131 float opacity,
132 unsigned filter);
133 void CommitToCA(CALayer* superlayer, 103 void CommitToCA(CALayer* superlayer,
134 ClipAndSortingLayer* old_layer, 104 ClipAndSortingLayer* old_layer,
135 float scale_factor); 105 float scale_factor);
136 106
137 std::vector<TransformLayer> transform_layers; 107 std::vector<TransformLayer> transform_layers;
138 bool is_clipped = false; 108 bool is_clipped = false;
139 gfx::Rect clip_rect; 109 gfx::Rect clip_rect;
140 unsigned sorting_context_id = 0; 110 unsigned sorting_context_id = 0;
141 bool is_singleton_sorting_context = false; 111 bool is_singleton_sorting_context = false;
142 base::scoped_nsobject<CALayer> ca_layer; 112 base::scoped_nsobject<CALayer> ca_layer;
143 113
144 private: 114 private:
145 DISALLOW_COPY_AND_ASSIGN(ClipAndSortingLayer); 115 DISALLOW_COPY_AND_ASSIGN(ClipAndSortingLayer);
146 }; 116 };
147 struct TransformLayer { 117 struct TransformLayer {
148 TransformLayer(const gfx::Transform& transform); 118 TransformLayer(const gfx::Transform& transform);
149 TransformLayer(TransformLayer&& layer); 119 TransformLayer(TransformLayer&& layer);
150 120
151 // See the behavior of RootLayer for the effects of these functions on the 121 // See the behavior of RootLayer for the effects of these functions on the
152 // |ca_layer| member and |old_layer| argument. 122 // |ca_layer| member and |old_layer| argument.
153 ~TransformLayer(); 123 ~TransformLayer();
154 void AddContentLayer( 124 void AddContentLayer(const CARendererLayerParams& params);
155 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
156 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer,
157 const gfx::RectF& contents_rect,
158 const gfx::Rect& rect,
159 unsigned background_color,
160 unsigned edge_aa_mask,
161 float opacity,
162 unsigned filter);
163 void CommitToCA(CALayer* superlayer, 125 void CommitToCA(CALayer* superlayer,
164 TransformLayer* old_layer, 126 TransformLayer* old_layer,
165 float scale_factor); 127 float scale_factor);
166 128
167 gfx::Transform transform; 129 gfx::Transform transform;
168 std::vector<ContentLayer> content_layers; 130 std::vector<ContentLayer> content_layers;
169 base::scoped_nsobject<CALayer> ca_layer; 131 base::scoped_nsobject<CALayer> ca_layer;
170 132
171 private: 133 private:
172 DISALLOW_COPY_AND_ASSIGN(TransformLayer); 134 DISALLOW_COPY_AND_ASSIGN(TransformLayer);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 float scale_factor_ = 1; 179 float scale_factor_ = 1;
218 bool has_committed_ = false; 180 bool has_committed_ = false;
219 181
220 private: 182 private:
221 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); 183 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree);
222 }; 184 };
223 185
224 } // namespace ui 186 } // namespace ui
225 187
226 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ 188 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698