| 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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
| 10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 gfx::Transform identity_matrix_; | 112 gfx::Transform identity_matrix_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 | 115 |
| 116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping | 116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping |
| 117 : public LayerTreeHostOcclusionTest { | 117 : public LayerTreeHostOcclusionTest { |
| 118 public: | 118 public: |
| 119 virtual void SetupTree() override { | 119 virtual void SetupTree() override { |
| 120 // The child layer is a surface and the grand_child is opaque, but clipped | 120 // The child layer is a surface and the grand_child is opaque, but clipped |
| 121 // to the child and root | 121 // to the child and root |
| 122 SetLayerPropertiesForTesting( | 122 SetLayerPropertiesForTesting(root_.get(), |
| 123 root_.get(), NULL, identity_matrix_, | 123 nullptr, |
| 124 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 124 identity_matrix_, |
| 125 gfx::PointF(0.f, 0.f), |
| 126 gfx::Size(200, 200), |
| 127 true); |
| 125 SetLayerPropertiesForTesting( | 128 SetLayerPropertiesForTesting( |
| 126 child_.get(), root_.get(), identity_matrix_, | 129 child_.get(), root_.get(), identity_matrix_, |
| 127 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); | 130 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); |
| 128 SetLayerPropertiesForTesting( | 131 SetLayerPropertiesForTesting( |
| 129 grand_child_.get(), child_.get(), identity_matrix_, | 132 grand_child_.get(), child_.get(), identity_matrix_, |
| 130 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 133 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 131 | 134 |
| 132 child_->SetMasksToBounds(true); | 135 child_->SetMasksToBounds(true); |
| 133 child_->SetForceRenderSurface(true); | 136 child_->SetForceRenderSurface(true); |
| 134 | 137 |
| 135 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); | 138 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); |
| 136 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); | 139 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); |
| 137 | 140 |
| 138 layer_tree_host()->SetRootLayer(root_); | 141 layer_tree_host()->SetRootLayer(root_); |
| 139 LayerTreeTest::SetupTree(); | 142 LayerTreeTest::SetupTree(); |
| 140 } | 143 } |
| 141 }; | 144 }; |
| 142 | 145 |
| 143 SINGLE_AND_MULTI_THREAD_TEST_F( | 146 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 144 LayerTreeHostOcclusionTestOcclusionSurfaceClipping); | 147 LayerTreeHostOcclusionTestOcclusionSurfaceClipping); |
| 145 | 148 |
| 146 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque | 149 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque |
| 147 : public LayerTreeHostOcclusionTest { | 150 : public LayerTreeHostOcclusionTest { |
| 148 public: | 151 public: |
| 149 virtual void SetupTree() override { | 152 virtual void SetupTree() override { |
| 150 // If the child layer is opaque, then it adds to the occlusion seen by the | 153 // If the child layer is opaque, then it adds to the occlusion seen by the |
| 151 // root_. | 154 // root_. |
| 152 SetLayerPropertiesForTesting( | 155 SetLayerPropertiesForTesting(root_.get(), |
| 153 root_.get(), NULL, identity_matrix_, | 156 nullptr, |
| 154 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 157 identity_matrix_, |
| 158 gfx::PointF(0.f, 0.f), |
| 159 gfx::Size(200, 200), |
| 160 true); |
| 155 SetLayerPropertiesForTesting( | 161 SetLayerPropertiesForTesting( |
| 156 child_.get(), root_.get(), identity_matrix_, | 162 child_.get(), root_.get(), identity_matrix_, |
| 157 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 163 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 158 SetLayerPropertiesForTesting( | 164 SetLayerPropertiesForTesting( |
| 159 grand_child_.get(), child_.get(), identity_matrix_, | 165 grand_child_.get(), child_.get(), identity_matrix_, |
| 160 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 166 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 161 | 167 |
| 162 child_->SetMasksToBounds(true); | 168 child_->SetMasksToBounds(true); |
| 163 child_->SetForceRenderSurface(true); | 169 child_->SetForceRenderSurface(true); |
| 164 | 170 |
| 165 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); | 171 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); |
| 166 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); | 172 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); |
| 167 | 173 |
| 168 layer_tree_host()->SetRootLayer(root_); | 174 layer_tree_host()->SetRootLayer(root_); |
| 169 LayerTreeTest::SetupTree(); | 175 LayerTreeTest::SetupTree(); |
| 170 } | 176 } |
| 171 }; | 177 }; |
| 172 | 178 |
| 173 SINGLE_AND_MULTI_THREAD_TEST_F( | 179 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 174 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque); | 180 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque); |
| 175 | 181 |
| 176 class LayerTreeHostOcclusionTestOcclusionTwoChildren | 182 class LayerTreeHostOcclusionTestOcclusionTwoChildren |
| 177 : public LayerTreeHostOcclusionTest { | 183 : public LayerTreeHostOcclusionTest { |
| 178 public: | 184 public: |
| 179 virtual void SetupTree() override { | 185 virtual void SetupTree() override { |
| 180 // Add a second child to the root layer and the regions should merge | 186 // Add a second child to the root layer and the regions should merge |
| 181 SetLayerPropertiesForTesting( | 187 SetLayerPropertiesForTesting(root_.get(), |
| 182 root_.get(), NULL, identity_matrix_, | 188 nullptr, |
| 183 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 189 identity_matrix_, |
| 190 gfx::PointF(0.f, 0.f), |
| 191 gfx::Size(200, 200), |
| 192 true); |
| 184 SetLayerPropertiesForTesting( | 193 SetLayerPropertiesForTesting( |
| 185 child_.get(), root_.get(), identity_matrix_, | 194 child_.get(), root_.get(), identity_matrix_, |
| 186 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); | 195 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); |
| 187 SetLayerPropertiesForTesting( | 196 SetLayerPropertiesForTesting( |
| 188 grand_child_.get(), child_.get(), identity_matrix_, | 197 grand_child_.get(), child_.get(), identity_matrix_, |
| 189 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 198 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 190 SetLayerPropertiesForTesting( | 199 SetLayerPropertiesForTesting( |
| 191 child2_.get(), root_.get(), identity_matrix_, | 200 child2_.get(), root_.get(), identity_matrix_, |
| 192 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 201 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 193 | 202 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 205 | 214 |
| 206 SINGLE_AND_MULTI_THREAD_TEST_F( | 215 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 207 LayerTreeHostOcclusionTestOcclusionTwoChildren); | 216 LayerTreeHostOcclusionTestOcclusionTwoChildren); |
| 208 | 217 |
| 209 class LayerTreeHostOcclusionTestOcclusionMask | 218 class LayerTreeHostOcclusionTestOcclusionMask |
| 210 : public LayerTreeHostOcclusionTest { | 219 : public LayerTreeHostOcclusionTest { |
| 211 public: | 220 public: |
| 212 virtual void SetupTree() override { | 221 virtual void SetupTree() override { |
| 213 // If the child layer has a mask on it, then it shouldn't contribute to | 222 // If the child layer has a mask on it, then it shouldn't contribute to |
| 214 // occlusion on stuff below it. | 223 // occlusion on stuff below it. |
| 215 SetLayerPropertiesForTesting( | 224 SetLayerPropertiesForTesting(root_.get(), |
| 216 root_.get(), NULL, identity_matrix_, | 225 nullptr, |
| 217 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 226 identity_matrix_, |
| 227 gfx::PointF(0.f, 0.f), |
| 228 gfx::Size(200, 200), |
| 229 true); |
| 218 SetLayerPropertiesForTesting( | 230 SetLayerPropertiesForTesting( |
| 219 child2_.get(), root_.get(), identity_matrix_, | 231 child2_.get(), root_.get(), identity_matrix_, |
| 220 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 232 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 221 SetLayerPropertiesForTesting( | 233 SetLayerPropertiesForTesting( |
| 222 child_.get(), root_.get(), identity_matrix_, | 234 child_.get(), root_.get(), identity_matrix_, |
| 223 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true); | 235 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true); |
| 224 SetLayerPropertiesForTesting( | 236 SetLayerPropertiesForTesting( |
| 225 grand_child_.get(), child_.get(), identity_matrix_, | 237 grand_child_.get(), child_.get(), identity_matrix_, |
| 226 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true); | 238 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true); |
| 227 | 239 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 239 | 251 |
| 240 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask); | 252 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask); |
| 241 | 253 |
| 242 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion | 254 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion |
| 243 : public LayerTreeHostOcclusionTest { | 255 : public LayerTreeHostOcclusionTest { |
| 244 public: | 256 public: |
| 245 virtual void SetupTree() override { | 257 virtual void SetupTree() override { |
| 246 // If the child layer with a mask is below child2, then child2 should | 258 // If the child layer with a mask is below child2, then child2 should |
| 247 // contribute to occlusion on everything, and child shouldn't contribute | 259 // contribute to occlusion on everything, and child shouldn't contribute |
| 248 // to the root_. | 260 // to the root_. |
| 249 SetLayerPropertiesForTesting( | 261 SetLayerPropertiesForTesting(root_.get(), |
| 250 root_.get(), NULL, identity_matrix_, | 262 nullptr, |
| 251 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 263 identity_matrix_, |
| 264 gfx::PointF(0.f, 0.f), |
| 265 gfx::Size(200, 200), |
| 266 true); |
| 252 SetLayerPropertiesForTesting( | 267 SetLayerPropertiesForTesting( |
| 253 child_.get(), root_.get(), identity_matrix_, | 268 child_.get(), root_.get(), identity_matrix_, |
| 254 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 269 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 255 SetLayerPropertiesForTesting( | 270 SetLayerPropertiesForTesting( |
| 256 grand_child_.get(), child_.get(), identity_matrix_, | 271 grand_child_.get(), child_.get(), identity_matrix_, |
| 257 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 272 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 258 SetLayerPropertiesForTesting( | 273 SetLayerPropertiesForTesting( |
| 259 child2_.get(), root_.get(), identity_matrix_, | 274 child2_.get(), root_.get(), identity_matrix_, |
| 260 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 275 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 261 | 276 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 274 | 289 |
| 275 SINGLE_AND_MULTI_THREAD_TEST_F( | 290 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 276 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion); | 291 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion); |
| 277 | 292 |
| 278 class LayerTreeHostOcclusionTestOcclusionOpacity | 293 class LayerTreeHostOcclusionTestOcclusionOpacity |
| 279 : public LayerTreeHostOcclusionTest { | 294 : public LayerTreeHostOcclusionTest { |
| 280 public: | 295 public: |
| 281 virtual void SetupTree() override { | 296 virtual void SetupTree() override { |
| 282 // If the child layer has a non-opaque opacity, then it shouldn't | 297 // If the child layer has a non-opaque opacity, then it shouldn't |
| 283 // contribute to occlusion on stuff below it | 298 // contribute to occlusion on stuff below it |
| 284 SetLayerPropertiesForTesting( | 299 SetLayerPropertiesForTesting(root_.get(), |
| 285 root_.get(), NULL, identity_matrix_, | 300 nullptr, |
| 286 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 301 identity_matrix_, |
| 302 gfx::PointF(0.f, 0.f), |
| 303 gfx::Size(200, 200), |
| 304 true); |
| 287 SetLayerPropertiesForTesting( | 305 SetLayerPropertiesForTesting( |
| 288 child2_.get(), root_.get(), identity_matrix_, | 306 child2_.get(), root_.get(), identity_matrix_, |
| 289 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 307 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 290 SetLayerPropertiesForTesting( | 308 SetLayerPropertiesForTesting( |
| 291 child_.get(), root_.get(), identity_matrix_, | 309 child_.get(), root_.get(), identity_matrix_, |
| 292 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 310 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 293 SetLayerPropertiesForTesting( | 311 SetLayerPropertiesForTesting( |
| 294 grand_child_.get(), child_.get(), identity_matrix_, | 312 grand_child_.get(), child_.get(), identity_matrix_, |
| 295 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 313 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 296 | 314 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 308 | 326 |
| 309 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity); | 327 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity); |
| 310 | 328 |
| 311 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion | 329 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion |
| 312 : public LayerTreeHostOcclusionTest { | 330 : public LayerTreeHostOcclusionTest { |
| 313 public: | 331 public: |
| 314 virtual void SetupTree() override { | 332 virtual void SetupTree() override { |
| 315 // If the child layer with non-opaque opacity is below child2, then | 333 // If the child layer with non-opaque opacity is below child2, then |
| 316 // child2 should contribute to occlusion on everything, and child shouldn't | 334 // child2 should contribute to occlusion on everything, and child shouldn't |
| 317 // contribute to the root_. | 335 // contribute to the root_. |
| 318 SetLayerPropertiesForTesting( | 336 SetLayerPropertiesForTesting(root_.get(), |
| 319 root_.get(), NULL, identity_matrix_, | 337 nullptr, |
| 320 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 338 identity_matrix_, |
| 339 gfx::PointF(0.f, 0.f), |
| 340 gfx::Size(200, 200), |
| 341 true); |
| 321 SetLayerPropertiesForTesting( | 342 SetLayerPropertiesForTesting( |
| 322 child_.get(), root_.get(), identity_matrix_, | 343 child_.get(), root_.get(), identity_matrix_, |
| 323 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 344 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 324 SetLayerPropertiesForTesting( | 345 SetLayerPropertiesForTesting( |
| 325 grand_child_.get(), child_.get(), identity_matrix_, | 346 grand_child_.get(), child_.get(), identity_matrix_, |
| 326 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 347 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 327 SetLayerPropertiesForTesting( | 348 SetLayerPropertiesForTesting( |
| 328 child2_.get(), root_.get(), identity_matrix_, | 349 child2_.get(), root_.get(), identity_matrix_, |
| 329 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 350 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 330 | 351 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 343 | 364 |
| 344 SINGLE_AND_MULTI_THREAD_TEST_F( | 365 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 345 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); | 366 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); |
| 346 | 367 |
| 347 class LayerTreeHostOcclusionTestOcclusionBlending | 368 class LayerTreeHostOcclusionTestOcclusionBlending |
| 348 : public LayerTreeHostOcclusionTest { | 369 : public LayerTreeHostOcclusionTest { |
| 349 public: | 370 public: |
| 350 virtual void SetupTree() override { | 371 virtual void SetupTree() override { |
| 351 // If the child layer has a blend mode, then it shouldn't | 372 // If the child layer has a blend mode, then it shouldn't |
| 352 // contribute to occlusion on stuff below it | 373 // contribute to occlusion on stuff below it |
| 353 SetLayerPropertiesForTesting( | 374 SetLayerPropertiesForTesting(root_.get(), |
| 354 root_.get(), NULL, identity_matrix_, | 375 nullptr, |
| 355 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 376 identity_matrix_, |
| 377 gfx::PointF(0.f, 0.f), |
| 378 gfx::Size(200, 200), |
| 379 true); |
| 356 SetLayerPropertiesForTesting( | 380 SetLayerPropertiesForTesting( |
| 357 child2_.get(), root_.get(), identity_matrix_, | 381 child2_.get(), root_.get(), identity_matrix_, |
| 358 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 382 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 359 SetLayerPropertiesForTesting( | 383 SetLayerPropertiesForTesting( |
| 360 child_.get(), root_.get(), identity_matrix_, | 384 child_.get(), root_.get(), identity_matrix_, |
| 361 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 385 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 362 SetLayerPropertiesForTesting( | 386 SetLayerPropertiesForTesting( |
| 363 grand_child_.get(), child_.get(), identity_matrix_, | 387 grand_child_.get(), child_.get(), identity_matrix_, |
| 364 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 388 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 365 | 389 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 377 | 401 |
| 378 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending); | 402 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending); |
| 379 | 403 |
| 380 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion | 404 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion |
| 381 : public LayerTreeHostOcclusionTest { | 405 : public LayerTreeHostOcclusionTest { |
| 382 public: | 406 public: |
| 383 virtual void SetupTree() override { | 407 virtual void SetupTree() override { |
| 384 // If the child layer with a blend mode is below child2, then | 408 // If the child layer with a blend mode is below child2, then |
| 385 // child2 should contribute to occlusion on everything, and child shouldn't | 409 // child2 should contribute to occlusion on everything, and child shouldn't |
| 386 // contribute to the root_. | 410 // contribute to the root_. |
| 387 SetLayerPropertiesForTesting( | 411 SetLayerPropertiesForTesting(root_.get(), |
| 388 root_.get(), NULL, identity_matrix_, | 412 nullptr, |
| 389 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 413 identity_matrix_, |
| 414 gfx::PointF(0.f, 0.f), |
| 415 gfx::Size(200, 200), |
| 416 true); |
| 390 SetLayerPropertiesForTesting( | 417 SetLayerPropertiesForTesting( |
| 391 child_.get(), root_.get(), identity_matrix_, | 418 child_.get(), root_.get(), identity_matrix_, |
| 392 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 419 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 393 SetLayerPropertiesForTesting( | 420 SetLayerPropertiesForTesting( |
| 394 grand_child_.get(), child_.get(), identity_matrix_, | 421 grand_child_.get(), child_.get(), identity_matrix_, |
| 395 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 422 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
| 396 SetLayerPropertiesForTesting( | 423 SetLayerPropertiesForTesting( |
| 397 child2_.get(), root_.get(), identity_matrix_, | 424 child2_.get(), root_.get(), identity_matrix_, |
| 398 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 425 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
| 399 | 426 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 415 class LayerTreeHostOcclusionTestOcclusionOpacityFilter | 442 class LayerTreeHostOcclusionTestOcclusionOpacityFilter |
| 416 : public LayerTreeHostOcclusionTest { | 443 : public LayerTreeHostOcclusionTest { |
| 417 public: | 444 public: |
| 418 virtual void SetupTree() override { | 445 virtual void SetupTree() override { |
| 419 FilterOperations filters; | 446 FilterOperations filters; |
| 420 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 447 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
| 421 | 448 |
| 422 // If the child layer has a filter that changes alpha values, and is below | 449 // If the child layer has a filter that changes alpha values, and is below |
| 423 // child2, then child2 should contribute to occlusion on everything, | 450 // child2, then child2 should contribute to occlusion on everything, |
| 424 // and child shouldn't contribute to the root | 451 // and child shouldn't contribute to the root |
| 425 SetLayerPropertiesForTesting( | 452 SetLayerPropertiesForTesting(root_.get(), |
| 426 root_.get(), NULL, identity_matrix_, | 453 nullptr, |
| 427 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 454 identity_matrix_, |
| 455 gfx::PointF(0.f, 0.f), |
| 456 gfx::Size(200, 200), |
| 457 true); |
| 428 SetLayerPropertiesForTesting(child_.get(), | 458 SetLayerPropertiesForTesting(child_.get(), |
| 429 root_.get(), | 459 root_.get(), |
| 430 identity_matrix_, | 460 identity_matrix_, |
| 431 gfx::PointF(0.f, 0.f), | 461 gfx::PointF(0.f, 0.f), |
| 432 gfx::Size(500, 500), | 462 gfx::Size(500, 500), |
| 433 true); | 463 true); |
| 434 SetLayerPropertiesForTesting(grand_child_.get(), | 464 SetLayerPropertiesForTesting(grand_child_.get(), |
| 435 child_.get(), | 465 child_.get(), |
| 436 identity_matrix_, | 466 identity_matrix_, |
| 437 gfx::PointF(0.f, 0.f), | 467 gfx::PointF(0.f, 0.f), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 child_transform.Translate(250.0, 250.0); | 502 child_transform.Translate(250.0, 250.0); |
| 473 child_transform.Rotate(90.0); | 503 child_transform.Rotate(90.0); |
| 474 child_transform.Translate(-250.0, -250.0); | 504 child_transform.Translate(-250.0, -250.0); |
| 475 | 505 |
| 476 FilterOperations filters; | 506 FilterOperations filters; |
| 477 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 507 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
| 478 | 508 |
| 479 // If the child layer has a filter that moves pixels/changes alpha, and is | 509 // If the child layer has a filter that moves pixels/changes alpha, and is |
| 480 // below child2, then child should not inherit occlusion from outside its | 510 // below child2, then child should not inherit occlusion from outside its |
| 481 // subtree, and should not contribute to the root | 511 // subtree, and should not contribute to the root |
| 482 SetLayerPropertiesForTesting( | 512 SetLayerPropertiesForTesting(root_.get(), |
| 483 root_.get(), NULL, identity_matrix_, | 513 nullptr, |
| 484 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 514 identity_matrix_, |
| 515 gfx::PointF(0.f, 0.f), |
| 516 gfx::Size(200, 200), |
| 517 true); |
| 485 SetLayerPropertiesForTesting( | 518 SetLayerPropertiesForTesting( |
| 486 child_.get(), root_.get(), child_transform, | 519 child_.get(), root_.get(), child_transform, |
| 487 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true); | 520 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true); |
| 488 SetLayerPropertiesForTesting( | 521 SetLayerPropertiesForTesting( |
| 489 grand_child_.get(), child_.get(), identity_matrix_, | 522 grand_child_.get(), child_.get(), identity_matrix_, |
| 490 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 523 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
| 491 SetLayerPropertiesForTesting( | 524 SetLayerPropertiesForTesting( |
| 492 child2_.get(), root_.get(), identity_matrix_, | 525 child2_.get(), root_.get(), identity_matrix_, |
| 493 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true); | 526 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true); |
| 494 | 527 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 509 class LayerTreeHostOcclusionTestOcclusionCopyRequest | 542 class LayerTreeHostOcclusionTestOcclusionCopyRequest |
| 510 : public LayerTreeHostOcclusionTest { | 543 : public LayerTreeHostOcclusionTest { |
| 511 public: | 544 public: |
| 512 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 545 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
| 513 | 546 |
| 514 virtual void SetupTree() override { | 547 virtual void SetupTree() override { |
| 515 // If the child layer has copy request, and is below child2, | 548 // If the child layer has copy request, and is below child2, |
| 516 // then child should not inherit occlusion from outside its subtree. | 549 // then child should not inherit occlusion from outside its subtree. |
| 517 // The child layer will still receive occlusion from inside, and | 550 // The child layer will still receive occlusion from inside, and |
| 518 // the root layer will recive occlusion from child. | 551 // the root layer will recive occlusion from child. |
| 519 SetLayerPropertiesForTesting( | 552 SetLayerPropertiesForTesting(root_.get(), |
| 520 root_.get(), NULL, identity_matrix_, | 553 nullptr, |
| 521 gfx::PointF(), gfx::Size(100, 100), true); | 554 identity_matrix_, |
| 555 gfx::PointF(), |
| 556 gfx::Size(100, 100), |
| 557 true); |
| 522 SetLayerPropertiesForTesting( | 558 SetLayerPropertiesForTesting( |
| 523 child_.get(), root_.get(), identity_matrix_, | 559 child_.get(), root_.get(), identity_matrix_, |
| 524 gfx::PointF(), gfx::Size(75, 75), true); | 560 gfx::PointF(), gfx::Size(75, 75), true); |
| 525 SetLayerPropertiesForTesting( | 561 SetLayerPropertiesForTesting( |
| 526 grand_child_.get(), child_.get(), identity_matrix_, | 562 grand_child_.get(), child_.get(), identity_matrix_, |
| 527 gfx::PointF(), gfx::Size(75, 50), true); | 563 gfx::PointF(), gfx::Size(75, 50), true); |
| 528 SetLayerPropertiesForTesting( | 564 SetLayerPropertiesForTesting( |
| 529 child2_.get(), root_.get(), identity_matrix_, | 565 child2_.get(), root_.get(), identity_matrix_, |
| 530 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); | 566 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); |
| 531 | 567 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 544 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionCopyRequest); | 580 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionCopyRequest); |
| 545 | 581 |
| 546 class LayerTreeHostOcclusionTestOcclusionReplica | 582 class LayerTreeHostOcclusionTestOcclusionReplica |
| 547 : public LayerTreeHostOcclusionTest { | 583 : public LayerTreeHostOcclusionTest { |
| 548 public: | 584 public: |
| 549 virtual void SetupTree() override { | 585 virtual void SetupTree() override { |
| 550 // If the child layer has copy request, and is below child2, | 586 // If the child layer has copy request, and is below child2, |
| 551 // then child should not inherit occlusion from outside its subtree. | 587 // then child should not inherit occlusion from outside its subtree. |
| 552 // The child layer will still receive occlusion from inside, and | 588 // The child layer will still receive occlusion from inside, and |
| 553 // the root layer will recive occlusion from child. | 589 // the root layer will recive occlusion from child. |
| 554 SetLayerPropertiesForTesting( | 590 SetLayerPropertiesForTesting(root_.get(), |
| 555 root_.get(), NULL, identity_matrix_, | 591 nullptr, |
| 556 gfx::PointF(), gfx::Size(100, 100), true); | 592 identity_matrix_, |
| 593 gfx::PointF(), |
| 594 gfx::Size(100, 100), |
| 595 true); |
| 557 SetLayerPropertiesForTesting( | 596 SetLayerPropertiesForTesting( |
| 558 child_.get(), root_.get(), identity_matrix_, | 597 child_.get(), root_.get(), identity_matrix_, |
| 559 gfx::PointF(), gfx::Size(75, 75), true); | 598 gfx::PointF(), gfx::Size(75, 75), true); |
| 560 SetLayerPropertiesForTesting( | 599 SetLayerPropertiesForTesting( |
| 561 grand_child_.get(), child_.get(), identity_matrix_, | 600 grand_child_.get(), child_.get(), identity_matrix_, |
| 562 gfx::PointF(), gfx::Size(75, 50), true); | 601 gfx::PointF(), gfx::Size(75, 50), true); |
| 563 SetLayerPropertiesForTesting( | 602 SetLayerPropertiesForTesting( |
| 564 child2_.get(), root_.get(), identity_matrix_, | 603 child2_.get(), root_.get(), identity_matrix_, |
| 565 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); | 604 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); |
| 566 | 605 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 585 // We create enough RenderSurfaces that it will trigger Vector reallocation | 624 // We create enough RenderSurfaces that it will trigger Vector reallocation |
| 586 // while computing occlusion. | 625 // while computing occlusion. |
| 587 std::vector<scoped_refptr<TestLayer> > layers; | 626 std::vector<scoped_refptr<TestLayer> > layers; |
| 588 int num_surfaces = 200; | 627 int num_surfaces = 200; |
| 589 int root_width = 400; | 628 int root_width = 400; |
| 590 int root_height = 400; | 629 int root_height = 400; |
| 591 | 630 |
| 592 for (int i = 0; i < num_surfaces; ++i) { | 631 for (int i = 0; i < num_surfaces; ++i) { |
| 593 layers.push_back(TestLayer::Create()); | 632 layers.push_back(TestLayer::Create()); |
| 594 if (i == 0) { | 633 if (i == 0) { |
| 595 SetLayerPropertiesForTesting( | 634 SetLayerPropertiesForTesting(layers.back().get(), |
| 596 layers.back().get(), NULL, identity_matrix_, | 635 nullptr, |
| 597 gfx::PointF(0.f, 0.f), | 636 identity_matrix_, |
| 598 gfx::Size(root_width, root_height), true); | 637 gfx::PointF(0.f, 0.f), |
| 638 gfx::Size(root_width, root_height), |
| 639 true); |
| 599 } else { | 640 } else { |
| 600 SetLayerPropertiesForTesting( | 641 SetLayerPropertiesForTesting( |
| 601 layers.back().get(), layers[layers.size() - 2].get(), | 642 layers.back().get(), layers[layers.size() - 2].get(), |
| 602 identity_matrix_, | 643 identity_matrix_, |
| 603 gfx::PointF(1.f, 1.f), | 644 gfx::PointF(1.f, 1.f), |
| 604 gfx::Size(root_width-i, root_height-i), true); | 645 gfx::Size(root_width-i, root_height-i), true); |
| 605 layers.back()->SetForceRenderSurface(true); | 646 layers.back()->SetForceRenderSurface(true); |
| 606 } | 647 } |
| 607 } | 648 } |
| 608 | 649 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 620 | 661 |
| 621 layer_tree_host()->SetRootLayer(layers[0]); | 662 layer_tree_host()->SetRootLayer(layers[0]); |
| 622 LayerTreeTest::SetupTree(); | 663 LayerTreeTest::SetupTree(); |
| 623 } | 664 } |
| 624 }; | 665 }; |
| 625 | 666 |
| 626 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); | 667 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); |
| 627 | 668 |
| 628 } // namespace | 669 } // namespace |
| 629 } // namespace cc | 670 } // namespace cc |
| OLD | NEW |