| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 208 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 209 | 209 |
| 210 void AddCopyRequest(Layer* layer) { | 210 void AddCopyRequest(Layer* layer) { |
| 211 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | 211 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( |
| 212 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, | 212 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, |
| 213 base::Unretained(this)))); | 213 base::Unretained(this)))); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void AddCopyRequest(LayerImpl* layer) { | 216 void AddCopyRequest(LayerImpl* layer) { |
| 217 std::vector<std::unique_ptr<CopyOutputRequest>> requests; | 217 layer->test_properties()->copy_requests.push_back( |
| 218 requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind( | 218 CopyOutputRequest::CreateBitmapRequest( |
| 219 &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this)))); | 219 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, |
| 220 layer->PassCopyRequests(&requests); | 220 base::Unretained(this)))); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void CalcDrawEtc(TestContentLayerImpl* root) { | 223 void CalcDrawEtc(TestContentLayerImpl* root) { |
| 224 DCHECK(root == root->layer_tree_impl()->root_layer()); | 224 DCHECK(root == root->layer_tree_impl()->root_layer()); |
| 225 | 225 |
| 226 // These occlusion tests attach and detach layers in multiple | 226 // These occlusion tests attach and detach layers in multiple |
| 227 // iterations, so rebuild property trees every time. | 227 // iterations, so rebuild property trees every time. |
| 228 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 228 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 229 | 229 |
| 230 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); | 230 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 EXPECT_EQ(gfx::Rect(), | 2514 EXPECT_EQ(gfx::Rect(), |
| 2515 occlusion.UnoccludedSurfaceContentRect( | 2515 occlusion.UnoccludedSurfaceContentRect( |
| 2516 surface, gfx::Rect(80, 70, 50, 50))); | 2516 surface, gfx::Rect(80, 70, 50, 50))); |
| 2517 } | 2517 } |
| 2518 }; | 2518 }; |
| 2519 | 2519 |
| 2520 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2520 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
| 2521 | 2521 |
| 2522 } // namespace | 2522 } // namespace |
| 2523 } // namespace cc | 2523 } // namespace cc |
| OLD | NEW |