| 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 28 matching lines...) Expand all Loading... |
| 39 #include "cc/quads/tile_draw_quad.h" | 39 #include "cc/quads/tile_draw_quad.h" |
| 40 #include "cc/resources/layer_tiling_data.h" | 40 #include "cc/resources/layer_tiling_data.h" |
| 41 #include "cc/test/animation_test_common.h" | 41 #include "cc/test/animation_test_common.h" |
| 42 #include "cc/test/begin_frame_args_test.h" | 42 #include "cc/test/begin_frame_args_test.h" |
| 43 #include "cc/test/fake_layer_tree_host_impl.h" | 43 #include "cc/test/fake_layer_tree_host_impl.h" |
| 44 #include "cc/test/fake_output_surface.h" | 44 #include "cc/test/fake_output_surface.h" |
| 45 #include "cc/test/fake_output_surface_client.h" | 45 #include "cc/test/fake_output_surface_client.h" |
| 46 #include "cc/test/fake_picture_layer_impl.h" | 46 #include "cc/test/fake_picture_layer_impl.h" |
| 47 #include "cc/test/fake_picture_pile_impl.h" | 47 #include "cc/test/fake_picture_pile_impl.h" |
| 48 #include "cc/test/fake_proxy.h" | 48 #include "cc/test/fake_proxy.h" |
| 49 #include "cc/test/fake_rendering_stats_instrumentation.h" | |
| 50 #include "cc/test/geometry_test_utils.h" | 49 #include "cc/test/geometry_test_utils.h" |
| 51 #include "cc/test/layer_test_common.h" | 50 #include "cc/test/layer_test_common.h" |
| 52 #include "cc/test/render_pass_test_common.h" | 51 #include "cc/test/render_pass_test_common.h" |
| 53 #include "cc/test/test_gpu_memory_buffer_manager.h" | 52 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 54 #include "cc/test/test_shared_bitmap_manager.h" | 53 #include "cc/test/test_shared_bitmap_manager.h" |
| 55 #include "cc/test/test_web_graphics_context_3d.h" | 54 #include "cc/test/test_web_graphics_context_3d.h" |
| 56 #include "cc/trees/layer_tree_impl.h" | 55 #include "cc/trees/layer_tree_impl.h" |
| 57 #include "cc/trees/single_thread_proxy.h" | 56 #include "cc/trees/single_thread_proxy.h" |
| 58 #include "testing/gmock/include/gmock/gmock.h" | 57 #include "testing/gmock/include/gmock/gmock.h" |
| 59 #include "testing/gtest/include/gtest/gtest.h" | 58 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 5881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5941 EXPECT_EQ(gfx::Vector2dF(10.f / 50.f, 20.f / 50.f).ToString(), | 5940 EXPECT_EQ(gfx::Vector2dF(10.f / 50.f, 20.f / 50.f).ToString(), |
| 5942 render_pass_quad->mask_uv_scale.ToString()); | 5941 render_pass_quad->mask_uv_scale.ToString()); |
| 5943 | 5942 |
| 5944 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 5943 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5945 host_impl_->DidDrawAllLayers(frame); | 5944 host_impl_->DidDrawAllLayers(frame); |
| 5946 } | 5945 } |
| 5947 } | 5946 } |
| 5948 | 5947 |
| 5949 class GLRendererWithSetupQuadForAntialiasing : public GLRenderer { | 5948 class GLRendererWithSetupQuadForAntialiasing : public GLRenderer { |
| 5950 public: | 5949 public: |
| 5951 using GLRenderer::SetupQuadForAntialiasing; | 5950 using GLRenderer::ShouldAntialiasQuad; |
| 5952 }; | 5951 }; |
| 5953 | 5952 |
| 5954 TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { | 5953 TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { |
| 5955 // Due to precision issues (especially on Android), sometimes far | 5954 // Due to precision issues (especially on Android), sometimes far |
| 5956 // away quads can end up thinking they need AA. | 5955 // away quads can end up thinking they need AA. |
| 5957 float device_scale_factor = 4.f / 3.f; | 5956 float device_scale_factor = 4.f / 3.f; |
| 5958 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 5957 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
| 5959 gfx::Size root_size(2000, 1000); | 5958 gfx::Size root_size(2000, 1000); |
| 5960 gfx::Size device_viewport_size = | 5959 gfx::Size device_viewport_size = |
| 5961 gfx::ToCeiledSize(gfx::ScaleSize(root_size, device_scale_factor)); | 5960 gfx::ToCeiledSize(gfx::ScaleSize(root_size, device_scale_factor)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5999 host_impl_->active_tree()->UpdateDrawProperties(); | 5998 host_impl_->active_tree()->UpdateDrawProperties(); |
| 6000 ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 5999 ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); |
| 6001 | 6000 |
| 6002 LayerTreeHostImpl::FrameData frame; | 6001 LayerTreeHostImpl::FrameData frame; |
| 6003 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 6002 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 6004 | 6003 |
| 6005 ASSERT_EQ(1u, frame.render_passes.size()); | 6004 ASSERT_EQ(1u, frame.render_passes.size()); |
| 6006 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); | 6005 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); |
| 6007 const DrawQuad* quad = frame.render_passes[0]->quad_list.front(); | 6006 const DrawQuad* quad = frame.render_passes[0]->quad_list.front(); |
| 6008 | 6007 |
| 6009 float edge[24]; | |
| 6010 gfx::QuadF device_layer_quad; | |
| 6011 bool antialiased = | 6008 bool antialiased = |
| 6012 GLRendererWithSetupQuadForAntialiasing::SetupQuadForAntialiasing( | 6009 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad( |
| 6013 quad->quadTransform(), quad, &device_layer_quad, edge); | 6010 quad->quadTransform(), quad, false); |
| 6014 EXPECT_FALSE(antialiased); | 6011 EXPECT_FALSE(antialiased); |
| 6015 | 6012 |
| 6016 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 6013 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 6017 host_impl_->DidDrawAllLayers(frame); | 6014 host_impl_->DidDrawAllLayers(frame); |
| 6018 } | 6015 } |
| 6019 | 6016 |
| 6020 | 6017 |
| 6021 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { | 6018 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { |
| 6022 public: | 6019 public: |
| 6023 CompositorFrameMetadataTest() | 6020 CompositorFrameMetadataTest() |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7520 // surface. | 7517 // surface. |
| 7521 EXPECT_EQ(0, num_lost_surfaces_); | 7518 EXPECT_EQ(0, num_lost_surfaces_); |
| 7522 host_impl_->DidLoseOutputSurface(); | 7519 host_impl_->DidLoseOutputSurface(); |
| 7523 EXPECT_EQ(1, num_lost_surfaces_); | 7520 EXPECT_EQ(1, num_lost_surfaces_); |
| 7524 host_impl_->DidLoseOutputSurface(); | 7521 host_impl_->DidLoseOutputSurface(); |
| 7525 EXPECT_LE(1, num_lost_surfaces_); | 7522 EXPECT_LE(1, num_lost_surfaces_); |
| 7526 } | 7523 } |
| 7527 | 7524 |
| 7528 } // namespace | 7525 } // namespace |
| 7529 } // namespace cc | 7526 } // namespace cc |
| OLD | NEW |