| 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/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
| 11 #include "cc/test/fake_output_surface.h" | 12 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_picture_layer_tiling_client.h" | 13 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 13 #include "cc/test/impl_side_painting_settings.h" | 14 #include "cc/test/impl_side_painting_settings.h" |
| 14 #include "cc/test/mock_quad_culler.h" | 15 #include "cc/test/mock_occlusion_tracker.h" |
| 15 #include "cc/test/test_shared_bitmap_manager.h" | 16 #include "cc/test/test_shared_bitmap_manager.h" |
| 16 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { | 23 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { |
| 23 public: | 24 public: |
| 24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) | 25 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Create tile and resource. | 162 // Create tile and resource. |
| 162 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 163 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
| 163 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 164 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| 164 active_layer->tilings()->tiling_at(0)->AllTilesForTesting()); | 165 active_layer->tilings()->tiling_at(0)->AllTilesForTesting()); |
| 165 | 166 |
| 166 // Draw. | 167 // Draw. |
| 167 active_layer->draw_properties().visible_content_rect = | 168 active_layer->draw_properties().visible_content_rect = |
| 168 gfx::Rect(active_layer->bounds()); | 169 gfx::Rect(active_layer->bounds()); |
| 169 MockOcclusionTracker<LayerImpl> occlusion_tracker; | 170 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
| 170 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 171 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 171 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); | |
| 172 AppendQuadsData data; | 172 AppendQuadsData data; |
| 173 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 173 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 174 active_layer->AppendQuads(&quad_culler, &data); | 174 active_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
| 175 active_layer->DidDraw(NULL); | 175 active_layer->DidDraw(NULL); |
| 176 | 176 |
| 177 EXPECT_EQ(DrawQuad::TILED_CONTENT, quad_culler.quad_list()[0]->material); | 177 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list[0]->material); |
| 178 | 178 |
| 179 // Tiles are ready at correct scale, so should not set had_incomplete_tile. | 179 // Tiles are ready at correct scale, so should not set had_incomplete_tile. |
| 180 EXPECT_FALSE(data.had_incomplete_tile); | 180 EXPECT_FALSE(data.had_incomplete_tile); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace | 183 } // namespace |
| 184 } // namespace cc | 184 } // namespace cc |
| OLD | NEW |