| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 LayerImpl* CreateLayer(LayerImpl* parent, | 116 LayerImpl* CreateLayer(LayerImpl* parent, |
| 117 const gfx::Transform& transform, | 117 const gfx::Transform& transform, |
| 118 const gfx::PointF& position, | 118 const gfx::PointF& position, |
| 119 const gfx::Size& bounds) { | 119 const gfx::Size& bounds) { |
| 120 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 120 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
| 121 int id = next_layer_impl_id_++; | 121 int id = next_layer_impl_id_++; |
| 122 std::unique_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); | 122 std::unique_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); |
| 123 LayerImpl* layer_ptr = layer.get(); | 123 LayerImpl* layer_ptr = layer.get(); |
| 124 SetProperties(layer_ptr, transform, position, bounds); | 124 SetProperties(layer_ptr, transform, position, bounds); |
| 125 parent->AddChild(std::move(layer)); | 125 parent->test_properties()->AddChild(std::move(layer)); |
| 126 return layer_ptr; | 126 return layer_ptr; |
| 127 } | 127 } |
| 128 | 128 |
| 129 LayerImpl* CreateSurface(LayerImpl* parent, | 129 LayerImpl* CreateSurface(LayerImpl* parent, |
| 130 const gfx::Transform& transform, | 130 const gfx::Transform& transform, |
| 131 const gfx::PointF& position, | 131 const gfx::PointF& position, |
| 132 const gfx::Size& bounds) { | 132 const gfx::Size& bounds) { |
| 133 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); | 133 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); |
| 134 layer->test_properties()->force_render_surface = true; | 134 layer->test_properties()->force_render_surface = true; |
| 135 return layer; | 135 return layer; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 150 if (opaque_layers_) { | 150 if (opaque_layers_) { |
| 151 layer_ptr->SetContentsOpaque(opaque); | 151 layer_ptr->SetContentsOpaque(opaque); |
| 152 } else { | 152 } else { |
| 153 layer_ptr->SetContentsOpaque(false); | 153 layer_ptr->SetContentsOpaque(false); |
| 154 if (opaque) | 154 if (opaque) |
| 155 layer_ptr->SetOpaqueContentsRect(gfx::Rect(bounds)); | 155 layer_ptr->SetOpaqueContentsRect(gfx::Rect(bounds)); |
| 156 else | 156 else |
| 157 layer_ptr->SetOpaqueContentsRect(gfx::Rect()); | 157 layer_ptr->SetOpaqueContentsRect(gfx::Rect()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 parent->AddChild(std::move(layer)); | 160 parent->test_properties()->AddChild(std::move(layer)); |
| 161 return layer_ptr; | 161 return layer_ptr; |
| 162 } | 162 } |
| 163 | 163 |
| 164 LayerImpl* CreateReplicaLayer(LayerImpl* owning_layer, | 164 LayerImpl* CreateReplicaLayer(LayerImpl* owning_layer, |
| 165 const gfx::Transform& transform, | 165 const gfx::Transform& transform, |
| 166 const gfx::PointF& position, | 166 const gfx::PointF& position, |
| 167 const gfx::Size& bounds) { | 167 const gfx::Size& bounds) { |
| 168 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 168 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
| 169 int id = next_layer_impl_id_++; | 169 int id = next_layer_impl_id_++; |
| 170 std::unique_ptr<TestContentLayerImpl> layer( | 170 std::unique_ptr<TestContentLayerImpl> layer( |
| (...skipping 2343 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 |