Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1388)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/nine_patch_layer_unittest.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/debug/test_web_graphics_context_3d.h"
9 #include "cc/layers/append_quads_data.h" 10 #include "cc/layers/append_quads_data.h"
10 #include "cc/layers/picture_layer.h" 11 #include "cc/layers/picture_layer.h"
11 #include "cc/test/fake_content_layer_client.h" 12 #include "cc/test/fake_content_layer_client.h"
12 #include "cc/test/fake_impl_proxy.h" 13 #include "cc/test/fake_impl_proxy.h"
13 #include "cc/test/fake_layer_tree_host_impl.h" 14 #include "cc/test/fake_layer_tree_host_impl.h"
14 #include "cc/test/fake_output_surface.h" 15 #include "cc/test/fake_output_surface.h"
15 #include "cc/test/fake_picture_layer_impl.h" 16 #include "cc/test/fake_picture_layer_impl.h"
16 #include "cc/test/fake_picture_pile_impl.h" 17 #include "cc/test/fake_picture_pile_impl.h"
17 #include "cc/test/geometry_test_utils.h" 18 #include "cc/test/geometry_test_utils.h"
18 #include "cc/test/impl_side_painting_settings.h" 19 #include "cc/test/impl_side_painting_settings.h"
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 EXPECT_EQ(gfx::Size(256, 256).ToString(), 816 EXPECT_EQ(gfx::Size(256, 256).ToString(),
816 tile->content_rect().size().ToString()); 817 tile->content_rect().size().ToString());
817 818
818 pending_layer_->DidLoseOutputSurface(); 819 pending_layer_->DidLoseOutputSurface();
819 820
820 // Change the max texture size on the output surface context. 821 // Change the max texture size on the output surface context.
821 scoped_ptr<TestWebGraphicsContext3D> context = 822 scoped_ptr<TestWebGraphicsContext3D> context =
822 TestWebGraphicsContext3D::Create(); 823 TestWebGraphicsContext3D::Create();
823 context->set_max_texture_size(140); 824 context->set_max_texture_size(140);
824 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( 825 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d(
825 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>()); 826 context.Pass()).PassAs<OutputSurface>());
826 827
827 pending_layer_->CalculateContentsScale( 828 pending_layer_->CalculateContentsScale(
828 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 829 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
829 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 830 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
830 831
831 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 832 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
832 833
833 // Verify the tiles are not larger than the context's max texture size. 834 // Verify the tiles are not larger than the context's max texture size.
834 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 835 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
835 EXPECT_GE(140, tile->content_rect().width()); 836 EXPECT_GE(140, tile->content_rect().width());
(...skipping 30 matching lines...) Expand all
866 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0); 867 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0);
867 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); 868 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size());
868 869
869 pending_layer_->DidLoseOutputSurface(); 870 pending_layer_->DidLoseOutputSurface();
870 871
871 // Change the max texture size on the output surface context. 872 // Change the max texture size on the output surface context.
872 scoped_ptr<TestWebGraphicsContext3D> context = 873 scoped_ptr<TestWebGraphicsContext3D> context =
873 TestWebGraphicsContext3D::Create(); 874 TestWebGraphicsContext3D::Create();
874 context->set_max_texture_size(140); 875 context->set_max_texture_size(140);
875 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( 876 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d(
876 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>()); 877 context.Pass()).PassAs<OutputSurface>());
877 878
878 pending_layer_->CalculateContentsScale( 879 pending_layer_->CalculateContentsScale(
879 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 880 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
880 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); 881 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings());
881 882
882 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 883 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
883 884
884 // There should be more than one tile since the max texture size won't cover 885 // There should be more than one tile since the max texture size won't cover
885 // the layer. 886 // the layer.
886 high_res_tiling = pending_layer_->tilings()->tiling_at(0); 887 high_res_tiling = pending_layer_->tilings()->tiling_at(0);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 num_offscreen++; 1003 num_offscreen++;
1003 } 1004 }
1004 } 1005 }
1005 1006
1006 EXPECT_GT(num_visible, 0); 1007 EXPECT_GT(num_visible, 0);
1007 EXPECT_GT(num_offscreen, 0); 1008 EXPECT_GT(num_offscreen, 0);
1008 } 1009 }
1009 1010
1010 } // namespace 1011 } // namespace
1011 } // namespace cc 1012 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/nine_patch_layer_unittest.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698