OLD | NEW |
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_image_layer_impl.h" | 5 #include "cc/layers/picture_image_layer_impl.h" |
6 | 6 |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class PictureImageLayerImplTest : public testing::Test { | 37 class PictureImageLayerImplTest : public testing::Test { |
38 public: | 38 public: |
39 PictureImageLayerImplTest() | 39 PictureImageLayerImplTest() |
40 : proxy_(base::MessageLoopProxy::current()), | 40 : proxy_(base::MessageLoopProxy::current()), |
41 host_impl_(ImplSidePaintingSettings(), | 41 host_impl_(ImplSidePaintingSettings(), |
42 &proxy_, | 42 &proxy_, |
43 &shared_bitmap_manager_) { | 43 &shared_bitmap_manager_) { |
44 tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size); | 44 tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size); |
45 host_impl_.CreatePendingTree(); | 45 host_impl_.CreatePendingTree(); |
46 host_impl_.InitializeRenderer( | 46 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); |
47 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); | |
48 } | 47 } |
49 | 48 |
50 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, | 49 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, |
51 WhichTree which_tree) { | 50 WhichTree which_tree) { |
52 LayerTreeImpl* tree = NULL; | 51 LayerTreeImpl* tree = NULL; |
53 switch (which_tree) { | 52 switch (which_tree) { |
54 case ACTIVE_TREE: | 53 case ACTIVE_TREE: |
55 tree = host_impl_.active_tree(); | 54 tree = host_impl_.active_tree(); |
56 break; | 55 break; |
57 case PENDING_TREE: | 56 case PENDING_TREE: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const bool animating_transform_to_screen = false; | 118 const bool animating_transform_to_screen = false; |
120 SetupDrawPropertiesAndUpdateTiles(pending_layer.get(), | 119 SetupDrawPropertiesAndUpdateTiles(pending_layer.get(), |
121 suggested_ideal_contents_scale, | 120 suggested_ideal_contents_scale, |
122 device_scale_factor, | 121 device_scale_factor, |
123 page_scale_factor, | 122 page_scale_factor, |
124 maximum_animation_contents_scale, | 123 maximum_animation_contents_scale, |
125 animating_transform_to_screen); | 124 animating_transform_to_screen); |
126 EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale()); | 125 EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale()); |
127 | 126 |
128 // Push to active layer. | 127 // Push to active layer. |
129 host_impl_.pending_tree()->SetRootLayer(pending_layer.PassAs<LayerImpl>()); | 128 host_impl_.pending_tree()->SetRootLayer(pending_layer.Pass()); |
130 host_impl_.ActivateSyncTree(); | 129 host_impl_.ActivateSyncTree(); |
131 TestablePictureImageLayerImpl* active_layer = | 130 TestablePictureImageLayerImpl* active_layer = |
132 static_cast<TestablePictureImageLayerImpl*>( | 131 static_cast<TestablePictureImageLayerImpl*>( |
133 host_impl_.active_tree()->root_layer()); | 132 host_impl_.active_tree()->root_layer()); |
134 SetupDrawPropertiesAndUpdateTiles(active_layer, | 133 SetupDrawPropertiesAndUpdateTiles(active_layer, |
135 suggested_ideal_contents_scale, | 134 suggested_ideal_contents_scale, |
136 device_scale_factor, | 135 device_scale_factor, |
137 page_scale_factor, | 136 page_scale_factor, |
138 maximum_animation_contents_scale, | 137 maximum_animation_contents_scale, |
139 animating_transform_to_screen); | 138 animating_transform_to_screen); |
(...skipping 15 matching lines...) Expand all Loading... |
155 active_layer->DidDraw(NULL); | 154 active_layer->DidDraw(NULL); |
156 | 155 |
157 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); | 156 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); |
158 | 157 |
159 // Tiles are ready at correct scale, so should not set had_incomplete_tile. | 158 // Tiles are ready at correct scale, so should not set had_incomplete_tile. |
160 EXPECT_EQ(0, data.num_incomplete_tiles); | 159 EXPECT_EQ(0, data.num_incomplete_tiles); |
161 } | 160 } |
162 | 161 |
163 } // namespace | 162 } // namespace |
164 } // namespace cc | 163 } // namespace cc |
OLD | NEW |