| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 5372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5383 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5383 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5384 | 5384 |
| 5385 if (!expect_to_draw) { | 5385 if (!expect_to_draw) { |
| 5386 // With no damage, we don't draw, and no quads are created. | 5386 // With no damage, we don't draw, and no quads are created. |
| 5387 ASSERT_EQ(0u, frame.render_passes.size()); | 5387 ASSERT_EQ(0u, frame.render_passes.size()); |
| 5388 } else { | 5388 } else { |
| 5389 ASSERT_EQ(1u, frame.render_passes.size()); | 5389 ASSERT_EQ(1u, frame.render_passes.size()); |
| 5390 | 5390 |
| 5391 // Verify the damage rect for the root render pass. | 5391 // Verify the damage rect for the root render pass. |
| 5392 const RenderPass* root_render_pass = frame.render_passes.back(); | 5392 const RenderPass* root_render_pass = frame.render_passes.back(); |
| 5393 EXPECT_RECT_EQ(expected_damage, root_render_pass->damage_rect); | 5393 EXPECT_EQ(expected_damage, root_render_pass->damage_rect); |
| 5394 | 5394 |
| 5395 // Verify the root and child layers' quads are generated and not being | 5395 // Verify the root and child layers' quads are generated and not being |
| 5396 // culled. | 5396 // culled. |
| 5397 ASSERT_EQ(2u, root_render_pass->quad_list.size()); | 5397 ASSERT_EQ(2u, root_render_pass->quad_list.size()); |
| 5398 | 5398 |
| 5399 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; | 5399 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; |
| 5400 gfx::RectF expected_child_visible_rect(child->content_bounds()); | 5400 gfx::RectF expected_child_visible_rect(child->content_bounds()); |
| 5401 EXPECT_RECT_EQ(expected_child_visible_rect, | 5401 EXPECT_EQ(expected_child_visible_rect, |
| 5402 root_render_pass->quad_list.front()->visible_rect); | 5402 root_render_pass->quad_list.front()->visible_rect); |
| 5403 | 5403 |
| 5404 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 5404 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
| 5405 gfx::RectF expected_root_visible_rect(root->content_bounds()); | 5405 gfx::RectF expected_root_visible_rect(root->content_bounds()); |
| 5406 EXPECT_RECT_EQ(expected_root_visible_rect, | 5406 EXPECT_EQ(expected_root_visible_rect, |
| 5407 root_render_pass->quad_list.ElementAt(1)->visible_rect); | 5407 root_render_pass->quad_list.ElementAt(1)->visible_rect); |
| 5408 } | 5408 } |
| 5409 | 5409 |
| 5410 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 5410 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5411 host_impl_->DidDrawAllLayers(frame); | 5411 host_impl_->DidDrawAllLayers(frame); |
| 5412 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); | 5412 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); |
| 5413 } | 5413 } |
| 5414 }; | 5414 }; |
| 5415 | 5415 |
| 5416 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { | 5416 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { |
| 5417 scoped_ptr<SolidColorLayerImpl> root = | 5417 scoped_ptr<SolidColorLayerImpl> root = |
| (...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7877 // surface. | 7877 // surface. |
| 7878 EXPECT_EQ(0, num_lost_surfaces_); | 7878 EXPECT_EQ(0, num_lost_surfaces_); |
| 7879 host_impl_->DidLoseOutputSurface(); | 7879 host_impl_->DidLoseOutputSurface(); |
| 7880 EXPECT_EQ(1, num_lost_surfaces_); | 7880 EXPECT_EQ(1, num_lost_surfaces_); |
| 7881 host_impl_->DidLoseOutputSurface(); | 7881 host_impl_->DidLoseOutputSurface(); |
| 7882 EXPECT_LE(1, num_lost_surfaces_); | 7882 EXPECT_LE(1, num_lost_surfaces_); |
| 7883 } | 7883 } |
| 7884 | 7884 |
| 7885 } // namespace | 7885 } // namespace |
| 7886 } // namespace cc | 7886 } // namespace cc |
| OLD | NEW |