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(FakeOutputSurface::Create3d()); | 46 host_impl_.InitializeRenderer( |
| 47 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); |
47 } | 48 } |
48 | 49 |
49 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, | 50 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, |
50 WhichTree which_tree) { | 51 WhichTree which_tree) { |
51 LayerTreeImpl* tree = NULL; | 52 LayerTreeImpl* tree = NULL; |
52 switch (which_tree) { | 53 switch (which_tree) { |
53 case ACTIVE_TREE: | 54 case ACTIVE_TREE: |
54 tree = host_impl_.active_tree(); | 55 tree = host_impl_.active_tree(); |
55 break; | 56 break; |
56 case PENDING_TREE: | 57 case PENDING_TREE: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const bool animating_transform_to_screen = false; | 119 const bool animating_transform_to_screen = false; |
119 SetupDrawPropertiesAndUpdateTiles(pending_layer.get(), | 120 SetupDrawPropertiesAndUpdateTiles(pending_layer.get(), |
120 suggested_ideal_contents_scale, | 121 suggested_ideal_contents_scale, |
121 device_scale_factor, | 122 device_scale_factor, |
122 page_scale_factor, | 123 page_scale_factor, |
123 maximum_animation_contents_scale, | 124 maximum_animation_contents_scale, |
124 animating_transform_to_screen); | 125 animating_transform_to_screen); |
125 EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale()); | 126 EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale()); |
126 | 127 |
127 // Push to active layer. | 128 // Push to active layer. |
128 host_impl_.pending_tree()->SetRootLayer(pending_layer.Pass()); | 129 host_impl_.pending_tree()->SetRootLayer(pending_layer.PassAs<LayerImpl>()); |
129 host_impl_.ActivateSyncTree(); | 130 host_impl_.ActivateSyncTree(); |
130 TestablePictureImageLayerImpl* active_layer = | 131 TestablePictureImageLayerImpl* active_layer = |
131 static_cast<TestablePictureImageLayerImpl*>( | 132 static_cast<TestablePictureImageLayerImpl*>( |
132 host_impl_.active_tree()->root_layer()); | 133 host_impl_.active_tree()->root_layer()); |
133 SetupDrawPropertiesAndUpdateTiles(active_layer, | 134 SetupDrawPropertiesAndUpdateTiles(active_layer, |
134 suggested_ideal_contents_scale, | 135 suggested_ideal_contents_scale, |
135 device_scale_factor, | 136 device_scale_factor, |
136 page_scale_factor, | 137 page_scale_factor, |
137 maximum_animation_contents_scale, | 138 maximum_animation_contents_scale, |
138 animating_transform_to_screen); | 139 animating_transform_to_screen); |
(...skipping 15 matching lines...) Expand all Loading... |
154 active_layer->DidDraw(NULL); | 155 active_layer->DidDraw(NULL); |
155 | 156 |
156 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); | 157 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); |
157 | 158 |
158 // Tiles are ready at correct scale, so should not set had_incomplete_tile. | 159 // Tiles are ready at correct scale, so should not set had_incomplete_tile. |
159 EXPECT_EQ(0, data.num_incomplete_tiles); | 160 EXPECT_EQ(0, data.num_incomplete_tiles); |
160 } | 161 } |
161 | 162 |
162 } // namespace | 163 } // namespace |
163 } // namespace cc | 164 } // namespace cc |
OLD | NEW |