| 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" |
| 11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
| 12 #include "cc/test/fake_output_surface.h" | 12 #include "cc/test/fake_output_surface.h" |
| 13 #include "cc/test/fake_picture_layer_tiling_client.h" | 13 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 14 #include "cc/test/impl_side_painting_settings.h" | 14 #include "cc/test/impl_side_painting_settings.h" |
| 15 #include "cc/test/mock_occlusion_tracker.h" | |
| 16 #include "cc/test/test_shared_bitmap_manager.h" | 15 #include "cc/test/test_shared_bitmap_manager.h" |
| 17 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
| 20 | 19 |
| 21 namespace cc { | 20 namespace cc { |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { | 23 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { |
| 25 public: | 24 public: |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale()); | 141 EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale()); |
| 143 | 142 |
| 144 // Create tile and resource. | 143 // Create tile and resource. |
| 145 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 144 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
| 146 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 145 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| 147 active_layer->tilings()->tiling_at(0)->AllTilesForTesting()); | 146 active_layer->tilings()->tiling_at(0)->AllTilesForTesting()); |
| 148 | 147 |
| 149 // Draw. | 148 // Draw. |
| 150 active_layer->draw_properties().visible_content_rect = | 149 active_layer->draw_properties().visible_content_rect = |
| 151 gfx::Rect(gfx::ToCeiledSize(active_layer->bounds())); | 150 gfx::Rect(gfx::ToCeiledSize(active_layer->bounds())); |
| 152 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 153 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 151 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 154 AppendQuadsData data; | 152 AppendQuadsData data; |
| 155 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 153 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 156 active_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 154 active_layer->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 157 active_layer->DidDraw(NULL); | 155 active_layer->DidDraw(NULL); |
| 158 | 156 |
| 159 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); | 157 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); |
| 160 | 158 |
| 161 // 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. |
| 162 EXPECT_EQ(0, data.num_incomplete_tiles); | 160 EXPECT_EQ(0, data.num_incomplete_tiles); |
| 163 } | 161 } |
| 164 | 162 |
| 165 } // namespace | 163 } // namespace |
| 166 } // namespace cc | 164 } // namespace cc |
| OLD | NEW |