OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "cc/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 LayerPtrType ref(*layer); | 124 LayerPtrType ref(*layer); |
125 *layer = NULL; | 125 *layer = NULL; |
126 return ref; | 126 return ref; |
127 } | 127 } |
128 | 128 |
129 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 129 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
130 LayerPtrType ref(*layer); | 130 LayerPtrType ref(*layer); |
131 *layer = NULL; | 131 *layer = NULL; |
132 return ref; | 132 return ref; |
133 } | 133 } |
134 static void SetForceRenderSurface(LayerType* layer, bool force) { | |
135 layer->SetForceRenderSurface(force); | |
136 } | |
134 | 137 |
135 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } | 138 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } |
136 | 139 |
137 static void RecursiveUpdateNumChildren(LayerType* layerType) {} | 140 static void RecursiveUpdateNumChildren(LayerType* layerType) {} |
138 }; | 141 }; |
139 | 142 |
140 struct OcclusionTrackerTestImplThreadTypes { | 143 struct OcclusionTrackerTestImplThreadTypes { |
141 typedef LayerImpl LayerType; | 144 typedef LayerImpl LayerType; |
142 typedef LayerTreeImpl HostType; | 145 typedef LayerTreeImpl HostType; |
143 typedef RenderSurfaceImpl RenderSurfaceType; | 146 typedef RenderSurfaceImpl RenderSurfaceType; |
(...skipping 12 matching lines...) Expand all Loading... | |
156 static int next_layer_impl_id; | 159 static int next_layer_impl_id; |
157 | 160 |
158 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 161 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
159 return layer->Pass(); | 162 return layer->Pass(); |
160 } | 163 } |
161 | 164 |
162 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { | 165 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { |
163 return layer->PassAs<LayerType>(); | 166 return layer->PassAs<LayerType>(); |
164 } | 167 } |
165 | 168 |
169 static void SetForceRenderSurface(LayerType* layer, bool force) { | |
170 layer->SetHasRenderSurface(force); | |
171 } | |
166 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } | 172 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } |
167 | 173 |
168 static void RecursiveUpdateNumChildren(LayerType* layer) { | 174 static void RecursiveUpdateNumChildren(LayerType* layer) { |
169 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); | 175 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); |
170 } | 176 } |
171 }; | 177 }; |
172 | 178 |
173 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; | 179 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; |
174 | 180 |
175 template <typename Types> class OcclusionTrackerTest : public testing::Test { | 181 template <typename Types> class OcclusionTrackerTest : public testing::Test { |
(...skipping 11 matching lines...) Expand all Loading... | |
187 const gfx::PointF& position, | 193 const gfx::PointF& position, |
188 const gfx::Size& bounds) { | 194 const gfx::Size& bounds) { |
189 typename Types::ContentLayerPtrType layer( | 195 typename Types::ContentLayerPtrType layer( |
190 Types::CreateContentLayer(GetHost())); | 196 Types::CreateContentLayer(GetHost())); |
191 typename Types::ContentLayerType* layer_ptr = layer.get(); | 197 typename Types::ContentLayerType* layer_ptr = layer.get(); |
192 SetProperties(layer_ptr, transform, position, bounds); | 198 SetProperties(layer_ptr, transform, position, bounds); |
193 | 199 |
194 DCHECK(!root_.get()); | 200 DCHECK(!root_.get()); |
195 root_ = Types::PassLayerPtr(&layer); | 201 root_ = Types::PassLayerPtr(&layer); |
196 | 202 |
203 CreateRenderSurfaceOnImplThread(layer_ptr); | |
danakj
2014/09/03 19:30:35
you could just Types::SetForceRenderSurface(layer_
awoloszyn
2014/09/09 15:31:37
That would have the same effect, although on MainT
| |
197 SetRootLayerOnMainThread(layer_ptr); | 204 SetRootLayerOnMainThread(layer_ptr); |
198 | 205 |
199 return layer_ptr; | 206 return layer_ptr; |
200 } | 207 } |
201 | 208 |
202 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent, | 209 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent, |
203 const gfx::Transform& transform, | 210 const gfx::Transform& transform, |
204 const gfx::PointF& position, | 211 const gfx::PointF& position, |
205 const gfx::Size& bounds) { | 212 const gfx::Size& bounds) { |
206 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost())); | 213 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost())); |
207 typename Types::LayerType* layer_ptr = layer.get(); | 214 typename Types::LayerType* layer_ptr = layer.get(); |
208 SetProperties(layer_ptr, transform, position, bounds); | 215 SetProperties(layer_ptr, transform, position, bounds); |
209 parent->AddChild(Types::PassLayerPtr(&layer)); | 216 parent->AddChild(Types::PassLayerPtr(&layer)); |
210 return layer_ptr; | 217 return layer_ptr; |
211 } | 218 } |
212 | 219 |
213 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent, | 220 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent, |
214 const gfx::Transform& transform, | 221 const gfx::Transform& transform, |
215 const gfx::PointF& position, | 222 const gfx::PointF& position, |
216 const gfx::Size& bounds) { | 223 const gfx::Size& bounds) { |
217 typename Types::LayerType* layer = | 224 typename Types::LayerType* layer = |
218 CreateLayer(parent, transform, position, bounds); | 225 CreateLayer(parent, transform, position, bounds); |
219 layer->SetForceRenderSurface(true); | 226 Types::SetForceRenderSurface(layer, true); |
220 return layer; | 227 return layer; |
221 } | 228 } |
222 | 229 |
223 typename Types::ContentLayerType* CreateDrawingLayer( | 230 typename Types::ContentLayerType* CreateDrawingLayer( |
224 typename Types::LayerType* parent, | 231 typename Types::LayerType* parent, |
225 const gfx::Transform& transform, | 232 const gfx::Transform& transform, |
226 const gfx::PointF& position, | 233 const gfx::PointF& position, |
227 const gfx::Size& bounds, | 234 const gfx::Size& bounds, |
228 bool opaque) { | 235 bool opaque) { |
229 typename Types::ContentLayerPtrType layer( | 236 typename Types::ContentLayerPtrType layer( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 } | 277 } |
271 | 278 |
272 typename Types::ContentLayerType* CreateDrawingSurface( | 279 typename Types::ContentLayerType* CreateDrawingSurface( |
273 typename Types::LayerType* parent, | 280 typename Types::LayerType* parent, |
274 const gfx::Transform& transform, | 281 const gfx::Transform& transform, |
275 const gfx::PointF& position, | 282 const gfx::PointF& position, |
276 const gfx::Size& bounds, | 283 const gfx::Size& bounds, |
277 bool opaque) { | 284 bool opaque) { |
278 typename Types::ContentLayerType* layer = | 285 typename Types::ContentLayerType* layer = |
279 CreateDrawingLayer(parent, transform, position, bounds, opaque); | 286 CreateDrawingLayer(parent, transform, position, bounds, opaque); |
280 layer->SetForceRenderSurface(true); | 287 Types::SetForceRenderSurface(layer, true); |
281 return layer; | 288 return layer; |
282 } | 289 } |
283 | 290 |
284 void DestroyLayers() { | 291 void DestroyLayers() { |
285 Types::DestroyLayer(&root_); | 292 Types::DestroyLayer(&root_); |
286 render_surface_layer_list_.reset(); | 293 render_surface_layer_list_.reset(); |
287 render_surface_layer_list_impl_.clear(); | 294 render_surface_layer_list_impl_.clear(); |
288 replica_layers_.clear(); | 295 replica_layers_.clear(); |
289 mask_layers_.clear(); | 296 mask_layers_.clear(); |
290 ResetLayerIterator(); | 297 ResetLayerIterator(); |
291 } | 298 } |
292 | 299 |
293 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 300 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
294 | 301 |
295 void AddCopyRequest(Layer* layer) { | 302 void AddCopyRequest(Layer* layer) { |
296 layer->RequestCopyOfOutput( | 303 layer->RequestCopyOfOutput( |
297 CopyOutputRequest::CreateBitmapRequest(base::Bind( | 304 CopyOutputRequest::CreateBitmapRequest(base::Bind( |
298 &OcclusionTrackerTest<Types>::CopyOutputCallback, | 305 &OcclusionTrackerTest<Types>::CopyOutputCallback, |
299 base::Unretained(this)))); | 306 base::Unretained(this)))); |
300 } | 307 } |
301 | 308 |
302 void AddCopyRequest(LayerImpl* layer) { | 309 void AddCopyRequest(LayerImpl* layer) { |
303 ScopedPtrVector<CopyOutputRequest> requests; | 310 ScopedPtrVector<CopyOutputRequest> requests; |
304 requests.push_back( | 311 requests.push_back( |
305 CopyOutputRequest::CreateBitmapRequest(base::Bind( | 312 CopyOutputRequest::CreateBitmapRequest(base::Bind( |
306 &OcclusionTrackerTest<Types>::CopyOutputCallback, | 313 &OcclusionTrackerTest<Types>::CopyOutputCallback, |
307 base::Unretained(this)))); | 314 base::Unretained(this)))); |
315 layer->SetHasRenderSurface(true); | |
308 layer->PassCopyRequests(&requests); | 316 layer->PassCopyRequests(&requests); |
309 } | 317 } |
310 | 318 |
311 void CalcDrawEtc(TestContentLayerImpl* root) { | 319 void CalcDrawEtc(TestContentLayerImpl* root) { |
312 DCHECK(root == root_.get()); | 320 DCHECK(root == root_.get()); |
313 DCHECK(!root->render_surface()); | |
314 | 321 |
315 Types::RecursiveUpdateNumChildren(root); | 322 Types::RecursiveUpdateNumChildren(root); |
316 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 323 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
317 root, root->bounds(), &render_surface_layer_list_impl_); | 324 root, root->bounds(), &render_surface_layer_list_impl_); |
318 inputs.can_adjust_raster_scales = true; | 325 inputs.can_adjust_raster_scales = true; |
319 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 326 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
320 | 327 |
321 layer_iterator_ = layer_iterator_begin_ = | 328 layer_iterator_ = layer_iterator_begin_ = |
322 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); | 329 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); |
323 } | 330 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 typename Types::LayerType* layer, | 389 typename Types::LayerType* layer, |
383 typename Types::OcclusionTrackerType* occlusion) { | 390 typename Types::OcclusionTrackerType* occlusion) { |
384 EnterContributingSurface(layer, occlusion); | 391 EnterContributingSurface(layer, occlusion); |
385 LeaveContributingSurface(layer, occlusion); | 392 LeaveContributingSurface(layer, occlusion); |
386 } | 393 } |
387 | 394 |
388 void ResetLayerIterator() { layer_iterator_ = layer_iterator_begin_; } | 395 void ResetLayerIterator() { layer_iterator_ = layer_iterator_begin_; } |
389 | 396 |
390 const gfx::Transform identity_matrix; | 397 const gfx::Transform identity_matrix; |
391 | 398 |
399 void CreateRenderSurfaceOnImplThread(Layer* root) {} | |
danakj
2014/09/03 19:30:35
These seem redundant with SetForceRenderSurface, c
awoloszyn
2014/09/09 15:31:38
This would force a RenderSurface on the main threa
| |
400 void CreateRenderSurfaceOnImplThread(LayerImpl* root) { | |
401 root->SetHasRenderSurface(true); | |
402 } | |
403 | |
392 private: | 404 private: |
393 void SetRootLayerOnMainThread(Layer* root) { | 405 void SetRootLayerOnMainThread(Layer* root) { |
394 host_->SetRootLayer(scoped_refptr<Layer>(root)); | 406 host_->SetRootLayer(scoped_refptr<Layer>(root)); |
395 } | 407 } |
396 | 408 |
397 void SetRootLayerOnMainThread(LayerImpl* root) {} | 409 void SetRootLayerOnMainThread(LayerImpl* root) {} |
398 | 410 |
399 void SetBaseProperties(typename Types::LayerType* layer, | 411 void SetBaseProperties(typename Types::LayerType* layer, |
400 const gfx::Transform& transform, | 412 const gfx::Transform& transform, |
401 const gfx::PointF& position, | 413 const gfx::PointF& position, |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 : OcclusionTrackerTest<Types>(opaque_layers) {} | 743 : OcclusionTrackerTest<Types>(opaque_layers) {} |
732 | 744 |
733 void RunMyTest() { | 745 void RunMyTest() { |
734 typename Types::ContentLayerType* parent = this->CreateRoot( | 746 typename Types::ContentLayerType* parent = this->CreateRoot( |
735 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); | 747 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); |
736 | 748 |
737 gfx::Transform layer1_matrix; | 749 gfx::Transform layer1_matrix; |
738 layer1_matrix.Scale(2.0, 2.0); | 750 layer1_matrix.Scale(2.0, 2.0); |
739 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( | 751 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( |
740 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 752 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
741 layer1->SetForceRenderSurface(true); | 753 Types::SetForceRenderSurface(layer1, true); |
742 | 754 |
743 gfx::Transform layer2_matrix; | 755 gfx::Transform layer2_matrix; |
744 layer2_matrix.Translate(25.0, 25.0); | 756 layer2_matrix.Translate(25.0, 25.0); |
745 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( | 757 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( |
746 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); | 758 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); |
747 typename Types::ContentLayerType* occluder = | 759 typename Types::ContentLayerType* occluder = |
748 this->CreateDrawingLayer(parent, | 760 this->CreateDrawingLayer(parent, |
749 this->identity_matrix, | 761 this->identity_matrix, |
750 gfx::PointF(100.f, 100.f), | 762 gfx::PointF(100.f, 100.f), |
751 gfx::Size(500, 500), | 763 gfx::Size(500, 500), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 child_transform.Rotate(95.0); | 857 child_transform.Rotate(95.0); |
846 child_transform.Translate(-250.0, -250.0); | 858 child_transform.Translate(-250.0, -250.0); |
847 | 859 |
848 gfx::Transform layer_transform; | 860 gfx::Transform layer_transform; |
849 layer_transform.Translate(10.0, 10.0); | 861 layer_transform.Translate(10.0, 10.0); |
850 | 862 |
851 typename Types::ContentLayerType* root = this->CreateRoot( | 863 typename Types::ContentLayerType* root = this->CreateRoot( |
852 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); | 864 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); |
853 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( | 865 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( |
854 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 866 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
855 typename Types::LayerType* child = this->CreateLayer( | 867 typename Types::LayerType* child = this->CreateLayer( |
danakj
2014/09/03 19:30:35
Can you just CreateSurface here instead
awoloszyn
2014/09/09 15:31:37
Done.
| |
856 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); | 868 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); |
857 child->SetMasksToBounds(true); | 869 child->SetMasksToBounds(true); |
danakj
2014/09/03 19:30:35
and drop this and the CreateRSOnImplThread
awoloszyn
2014/09/09 15:31:37
Done.
| |
870 this->CreateRenderSurfaceOnImplThread(child); | |
858 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( | 871 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( |
859 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); | 872 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); |
860 this->CalcDrawEtc(root); | 873 this->CalcDrawEtc(root); |
861 | 874 |
862 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( | 875 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
863 gfx::Rect(0, 0, 1000, 1000)); | 876 gfx::Rect(0, 0, 1000, 1000)); |
864 | 877 |
865 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( | 878 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( |
866 layer_transform, layer->visible_content_rect()); | 879 layer_transform, layer->visible_content_rect()); |
867 | 880 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1165 layer_transform, | 1178 layer_transform, |
1166 gfx::PointF(30.f, 30.f), | 1179 gfx::PointF(30.f, 30.f), |
1167 gfx::Size(500, 500), | 1180 gfx::Size(500, 500), |
1168 true); | 1181 true); |
1169 typename Types::ContentLayerType* opacity_layer = | 1182 typename Types::ContentLayerType* opacity_layer = |
1170 this->CreateDrawingLayer(parent, | 1183 this->CreateDrawingLayer(parent, |
1171 layer_transform, | 1184 layer_transform, |
1172 gfx::PointF(30.f, 30.f), | 1185 gfx::PointF(30.f, 30.f), |
1173 gfx::Size(500, 500), | 1186 gfx::Size(500, 500), |
1174 true); | 1187 true); |
1188 this->CreateRenderSurfaceOnImplThread(blur_layer); | |
1189 this->CreateRenderSurfaceOnImplThread(opacity_layer); | |
1190 this->CreateRenderSurfaceOnImplThread(opaque_layer); | |
1175 | 1191 |
1176 FilterOperations filters; | 1192 FilterOperations filters; |
1177 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 1193 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
1178 blur_layer->SetFilters(filters); | 1194 blur_layer->SetFilters(filters); |
danakj
2014/09/03 19:30:35
you can use Type::SetForceRenderSurface instead of
awoloszyn
2014/09/09 15:31:37
Done.
| |
1179 | 1195 |
1180 filters.Clear(); | 1196 filters.Clear(); |
1181 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); | 1197 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); |
1182 opaque_layer->SetFilters(filters); | 1198 opaque_layer->SetFilters(filters); |
1183 | 1199 |
1184 filters.Clear(); | 1200 filters.Clear(); |
1185 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 1201 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
1186 opacity_layer->SetFilters(filters); | 1202 opacity_layer->SetFilters(filters); |
1187 | 1203 |
1188 this->CalcDrawEtc(parent); | 1204 this->CalcDrawEtc(parent); |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2227 // space, where the background filter is applied. | 2243 // space, where the background filter is applied. |
2228 typename Types::ContentLayerType* parent = this->CreateRoot( | 2244 typename Types::ContentLayerType* parent = this->CreateRoot( |
2229 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); | 2245 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); |
2230 typename Types::LayerType* filtered_surface = | 2246 typename Types::LayerType* filtered_surface = |
2231 this->CreateDrawingLayer(parent, | 2247 this->CreateDrawingLayer(parent, |
2232 scale_by_half, | 2248 scale_by_half, |
2233 gfx::PointF(50.f, 50.f), | 2249 gfx::PointF(50.f, 50.f), |
2234 gfx::Size(100, 100), | 2250 gfx::Size(100, 100), |
2235 false); | 2251 false); |
2236 filtered_surface->SetBackgroundFilters(filters); | 2252 filtered_surface->SetBackgroundFilters(filters); |
2237 | 2253 Types::SetForceRenderSurface(filtered_surface, true); |
2238 gfx::Rect occlusion_rect; | 2254 gfx::Rect occlusion_rect; |
2239 switch (i) { | 2255 switch (i) { |
2240 case LEFT: | 2256 case LEFT: |
2241 occlusion_rect = gfx::Rect(0, 0, 50, 200); | 2257 occlusion_rect = gfx::Rect(0, 0, 50, 200); |
2242 break; | 2258 break; |
2243 case RIGHT: | 2259 case RIGHT: |
2244 occlusion_rect = gfx::Rect(100, 0, 50, 200); | 2260 occlusion_rect = gfx::Rect(100, 0, 50, 200); |
2245 break; | 2261 break; |
2246 case TOP: | 2262 case TOP: |
2247 occlusion_rect = gfx::Rect(0, 0, 200, 50); | 2263 occlusion_rect = gfx::Rect(0, 0, 200, 50); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2342 this->identity_matrix, | 2358 this->identity_matrix, |
2343 gfx::PointF(100.f, 100.f), | 2359 gfx::PointF(100.f, 100.f), |
2344 gfx::Size(50, 50), | 2360 gfx::Size(50, 50), |
2345 true); | 2361 true); |
2346 | 2362 |
2347 // Filters make the layers own surfaces. | 2363 // Filters make the layers own surfaces. |
2348 FilterOperations filters; | 2364 FilterOperations filters; |
2349 filters.Append(FilterOperation::CreateBlurFilter(1.f)); | 2365 filters.Append(FilterOperation::CreateBlurFilter(1.f)); |
2350 filtered_surface1->SetBackgroundFilters(filters); | 2366 filtered_surface1->SetBackgroundFilters(filters); |
2351 filtered_surface2->SetBackgroundFilters(filters); | 2367 filtered_surface2->SetBackgroundFilters(filters); |
2368 this->CreateRenderSurfaceOnImplThread(filtered_surface1); | |
2369 this->CreateRenderSurfaceOnImplThread(filtered_surface2); | |
2352 | 2370 |
2353 // Save the distance of influence for the blur effect. | 2371 // Save the distance of influence for the blur effect. |
2354 int outset_top, outset_right, outset_bottom, outset_left; | 2372 int outset_top, outset_right, outset_bottom, outset_left; |
2355 filters.GetOutsets( | 2373 filters.GetOutsets( |
2356 &outset_top, &outset_right, &outset_bottom, &outset_left); | 2374 &outset_top, &outset_right, &outset_bottom, &outset_left); |
2357 | 2375 |
2358 this->CalcDrawEtc(root); | 2376 this->CalcDrawEtc(root); |
2359 | 2377 |
2360 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( | 2378 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
2361 gfx::Rect(0, 0, 1000, 1000)); | 2379 gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2427 false); | 2445 false); |
2428 this->CreateReplicaLayer(filtered_surface, | 2446 this->CreateReplicaLayer(filtered_surface, |
2429 this->identity_matrix, | 2447 this->identity_matrix, |
2430 gfx::PointF(300.f, 0.f), | 2448 gfx::PointF(300.f, 0.f), |
2431 gfx::Size()); | 2449 gfx::Size()); |
2432 | 2450 |
2433 // Filters make the layer own a surface. | 2451 // Filters make the layer own a surface. |
2434 FilterOperations filters; | 2452 FilterOperations filters; |
2435 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 2453 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
2436 filtered_surface->SetBackgroundFilters(filters); | 2454 filtered_surface->SetBackgroundFilters(filters); |
2437 | 2455 this->CreateRenderSurfaceOnImplThread(filtered_surface); |
2438 this->CalcDrawEtc(parent); | 2456 this->CalcDrawEtc(parent); |
2439 | 2457 |
2440 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( | 2458 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
2441 gfx::Rect(0, 0, 1000, 1000)); | 2459 gfx::Rect(0, 0, 1000, 1000)); |
2442 | 2460 |
2443 // The surface has a background blur, so it blurs non-opaque pixels below | 2461 // The surface has a background blur, so it blurs non-opaque pixels below |
2444 // it. | 2462 // it. |
2445 this->VisitLayer(filtered_surface, &occlusion); | 2463 this->VisitLayer(filtered_surface, &occlusion); |
2446 this->VisitContributingSurface(filtered_surface, &occlusion); | 2464 this->VisitContributingSurface(filtered_surface, &occlusion); |
2447 | 2465 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2501 this->CreateDrawingLayer(parent, | 2519 this->CreateDrawingLayer(parent, |
2502 this->identity_matrix, | 2520 this->identity_matrix, |
2503 gfx::PointF(50.f, 50.f), | 2521 gfx::PointF(50.f, 50.f), |
2504 gfx::Size(50, 50), | 2522 gfx::Size(50, 50), |
2505 true); | 2523 true); |
2506 | 2524 |
2507 // Filters make the layer own a surface. | 2525 // Filters make the layer own a surface. |
2508 FilterOperations filters; | 2526 FilterOperations filters; |
2509 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 2527 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
2510 filtered_surface->SetBackgroundFilters(filters); | 2528 filtered_surface->SetBackgroundFilters(filters); |
2529 this->CreateRenderSurfaceOnImplThread(filtered_surface); | |
2511 | 2530 |
2512 this->CalcDrawEtc(parent); | 2531 this->CalcDrawEtc(parent); |
2513 | 2532 |
2514 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( | 2533 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
2515 gfx::Rect(0, 0, 1000, 1000)); | 2534 gfx::Rect(0, 0, 1000, 1000)); |
2516 | 2535 |
2517 this->VisitLayer(occluding_layer, &occlusion); | 2536 this->VisitLayer(occluding_layer, &occlusion); |
2518 | 2537 |
2519 this->VisitLayer(filtered_surface, &occlusion); | 2538 this->VisitLayer(filtered_surface, &occlusion); |
2520 { | 2539 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2597 this->CreateDrawingLayer(parent, | 2616 this->CreateDrawingLayer(parent, |
2598 this->identity_matrix, | 2617 this->identity_matrix, |
2599 gfx::PointF(200.f, 40.f), | 2618 gfx::PointF(200.f, 40.f), |
2600 gfx::Size(10, 10), | 2619 gfx::Size(10, 10), |
2601 true); | 2620 true); |
2602 | 2621 |
2603 // Filters make the layer own a surface. | 2622 // Filters make the layer own a surface. |
2604 FilterOperations filters; | 2623 FilterOperations filters; |
2605 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 2624 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
2606 filtered_surface->SetBackgroundFilters(filters); | 2625 filtered_surface->SetBackgroundFilters(filters); |
2626 this->CreateRenderSurfaceOnImplThread(filtered_surface); | |
2607 | 2627 |
2608 // Save the distance of influence for the blur effect. | 2628 // Save the distance of influence for the blur effect. |
2609 int outset_top, outset_right, outset_bottom, outset_left; | 2629 int outset_top, outset_right, outset_bottom, outset_left; |
2610 filters.GetOutsets( | 2630 filters.GetOutsets( |
2611 &outset_top, &outset_right, &outset_bottom, &outset_left); | 2631 &outset_top, &outset_right, &outset_bottom, &outset_left); |
2612 | 2632 |
2613 this->CalcDrawEtc(parent); | 2633 this->CalcDrawEtc(parent); |
2614 | 2634 |
2615 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( | 2635 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
2616 gfx::Rect(0, 0, 1000, 1000)); | 2636 gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3305 EXPECT_EQ(gfx::Rect(), | 3325 EXPECT_EQ(gfx::Rect(), |
3306 occlusion.UnoccludedSurfaceContentRect( | 3326 occlusion.UnoccludedSurfaceContentRect( |
3307 surface, gfx::Rect(80, 70, 50, 50))); | 3327 surface, gfx::Rect(80, 70, 50, 50))); |
3308 } | 3328 } |
3309 }; | 3329 }; |
3310 | 3330 |
3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3331 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3312 | 3332 |
3313 } // namespace | 3333 } // namespace |
3314 } // namespace cc | 3334 } // namespace cc |
OLD | NEW |