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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 3718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3729 LayerTreeHostImpl::FrameData frame; | 3729 LayerTreeHostImpl::FrameData frame; |
3730 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 3730 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
3731 host_impl_->DrawLayers(&frame); | 3731 host_impl_->DrawLayers(&frame); |
3732 host_impl_->DidDrawAllLayers(frame); | 3732 host_impl_->DidDrawAllLayers(frame); |
3733 host_impl_->SwapBuffers(frame); | 3733 host_impl_->SwapBuffers(frame); |
3734 | 3734 |
3735 for (size_t i = 0; i < cases.size(); ++i) { | 3735 for (size_t i = 0; i < cases.size(); ++i) { |
3736 // Clean up host_impl_ state. | 3736 // Clean up host_impl_ state. |
3737 const auto& testcase = cases[i]; | 3737 const auto& testcase = cases[i]; |
3738 std::vector<LayerImpl*> to_remove; | 3738 std::vector<LayerImpl*> to_remove; |
3739 for (const auto& child : root->test_properties()->children) | 3739 for (auto* child : root->test_properties()->children) |
3740 to_remove.push_back(child); | 3740 to_remove.push_back(child); |
3741 for (auto* child : to_remove) | 3741 for (auto* child : to_remove) |
3742 root->test_properties()->RemoveChild(child); | 3742 root->test_properties()->RemoveChild(child); |
3743 timeline()->ClearPlayers(); | 3743 timeline()->ClearPlayers(); |
3744 | 3744 |
3745 std::ostringstream scope; | 3745 std::ostringstream scope; |
3746 scope << "Test case: " << i; | 3746 scope << "Test case: " << i; |
3747 SCOPED_TRACE(scope.str()); | 3747 SCOPED_TRACE(scope.str()); |
3748 | 3748 |
3749 root->test_properties()->AddChild(MissingTextureAnimatingLayer::Create( | 3749 root->test_properties()->AddChild(MissingTextureAnimatingLayer::Create( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3824 host_impl_->active_tree()->root_layer_for_testing()); | 3824 host_impl_->active_tree()->root_layer_for_testing()); |
3825 root->test_properties()->force_render_surface = true; | 3825 root->test_properties()->force_render_surface = true; |
3826 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 3826 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
3827 | 3827 |
3828 host_impl_->OnDraw(external_transform, external_viewport, external_clip, | 3828 host_impl_->OnDraw(external_transform, external_viewport, external_clip, |
3829 resourceless_software_draw); | 3829 resourceless_software_draw); |
3830 | 3830 |
3831 for (size_t i = 0; i < cases.size(); ++i) { | 3831 for (size_t i = 0; i < cases.size(); ++i) { |
3832 const auto& testcase = cases[i]; | 3832 const auto& testcase = cases[i]; |
3833 std::vector<LayerImpl*> to_remove; | 3833 std::vector<LayerImpl*> to_remove; |
3834 for (const auto& child : root->test_properties()->children) | 3834 for (auto* child : root->test_properties()->children) |
3835 to_remove.push_back(child); | 3835 to_remove.push_back(child); |
3836 for (auto* child : to_remove) | 3836 for (auto* child : to_remove) |
3837 root->test_properties()->RemoveChild(child); | 3837 root->test_properties()->RemoveChild(child); |
3838 | 3838 |
3839 std::ostringstream scope; | 3839 std::ostringstream scope; |
3840 scope << "Test case: " << i; | 3840 scope << "Test case: " << i; |
3841 SCOPED_TRACE(scope.str()); | 3841 SCOPED_TRACE(scope.str()); |
3842 | 3842 |
3843 root->test_properties()->AddChild(MissingTextureAnimatingLayer::Create( | 3843 root->test_properties()->AddChild(MissingTextureAnimatingLayer::Create( |
3844 host_impl_->active_tree(), 2, testcase.layer_before.has_missing_tile, | 3844 host_impl_->active_tree(), 2, testcase.layer_before.has_missing_tile, |
(...skipping 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6869 void set_gutter_quad_material(DrawQuad::Material material) { | 6869 void set_gutter_quad_material(DrawQuad::Material material) { |
6870 gutter_quad_material_ = material; | 6870 gutter_quad_material_ = material; |
6871 } | 6871 } |
6872 void set_gutter_texture_size(const gfx::Size& gutter_texture_size) { | 6872 void set_gutter_texture_size(const gfx::Size& gutter_texture_size) { |
6873 gutter_texture_size_ = gutter_texture_size; | 6873 gutter_texture_size_ = gutter_texture_size; |
6874 } | 6874 } |
6875 | 6875 |
6876 protected: | 6876 protected: |
6877 size_t CountGutterQuads(const QuadList& quad_list) { | 6877 size_t CountGutterQuads(const QuadList& quad_list) { |
6878 size_t num_gutter_quads = 0; | 6878 size_t num_gutter_quads = 0; |
6879 for (const auto& quad : quad_list) { | 6879 for (auto* quad : quad_list) { |
6880 num_gutter_quads += (quad->material == gutter_quad_material_) ? 1 : 0; | 6880 num_gutter_quads += (quad->material == gutter_quad_material_) ? 1 : 0; |
6881 } | 6881 } |
6882 return num_gutter_quads; | 6882 return num_gutter_quads; |
6883 } | 6883 } |
6884 | 6884 |
6885 void VerifyQuadsExactlyCoverViewport(const QuadList& quad_list) { | 6885 void VerifyQuadsExactlyCoverViewport(const QuadList& quad_list) { |
6886 LayerTestCommon::VerifyQuadsExactlyCoverRect( | 6886 LayerTestCommon::VerifyQuadsExactlyCoverRect( |
6887 quad_list, gfx::Rect(DipSizeToPixelSize(viewport_size_))); | 6887 quad_list, gfx::Rect(DipSizeToPixelSize(viewport_size_))); |
6888 } | 6888 } |
6889 | 6889 |
6890 // Make sure that the texture coordinates match their expectations. | 6890 // Make sure that the texture coordinates match their expectations. |
6891 void ValidateTextureDrawQuads(const QuadList& quad_list) { | 6891 void ValidateTextureDrawQuads(const QuadList& quad_list) { |
6892 for (const auto& quad : quad_list) { | 6892 for (auto* quad : quad_list) { |
6893 if (quad->material != DrawQuad::TEXTURE_CONTENT) | 6893 if (quad->material != DrawQuad::TEXTURE_CONTENT) |
6894 continue; | 6894 continue; |
6895 const TextureDrawQuad* texture_quad = TextureDrawQuad::MaterialCast(quad); | 6895 const TextureDrawQuad* texture_quad = TextureDrawQuad::MaterialCast(quad); |
6896 gfx::SizeF gutter_texture_size_pixels = | 6896 gfx::SizeF gutter_texture_size_pixels = |
6897 gfx::ScaleSize(gfx::SizeF(gutter_texture_size_), | 6897 gfx::ScaleSize(gfx::SizeF(gutter_texture_size_), |
6898 host_impl_->active_tree()->device_scale_factor()); | 6898 host_impl_->active_tree()->device_scale_factor()); |
6899 EXPECT_EQ(texture_quad->uv_top_left.x(), | 6899 EXPECT_EQ(texture_quad->uv_top_left.x(), |
6900 texture_quad->rect.x() / gutter_texture_size_pixels.width()); | 6900 texture_quad->rect.x() / gutter_texture_size_pixels.width()); |
6901 EXPECT_EQ(texture_quad->uv_top_left.y(), | 6901 EXPECT_EQ(texture_quad->uv_top_left.y(), |
6902 texture_quad->rect.y() / gutter_texture_size_pixels.height()); | 6902 texture_quad->rect.y() / gutter_texture_size_pixels.height()); |
(...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11052 | 11052 |
11053 // Re-initialize with a software output surface. | 11053 // Re-initialize with a software output surface. |
11054 output_surface_ = FakeOutputSurface::CreateSoftware( | 11054 output_surface_ = FakeOutputSurface::CreateSoftware( |
11055 base::WrapUnique(new SoftwareOutputDevice)); | 11055 base::WrapUnique(new SoftwareOutputDevice)); |
11056 host_impl_->InitializeRenderer(output_surface_.get()); | 11056 host_impl_->InitializeRenderer(output_surface_.get()); |
11057 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 11057 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
11058 } | 11058 } |
11059 | 11059 |
11060 } // namespace | 11060 } // namespace |
11061 } // namespace cc | 11061 } // namespace cc |
OLD | NEW |