| 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/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
| 6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
| 7 #include "cc/layers/picture_layer.h" | 7 #include "cc/layers/picture_layer.h" |
| 8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
| 9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
| 10 #include "cc/test/layer_tree_pixel_test.h" | 10 #include "cc/test/layer_tree_pixel_test.h" |
| 11 #include "cc/test/mock_quad_culler.h" | 11 #include "cc/test/mock_occlusion_tracker.h" |
| 12 #include "cc/trees/layer_tree_impl.h" | 12 #include "cc/trees/layer_tree_impl.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 #include "ui/gfx/rect_f.h" | 16 #include "ui/gfx/rect_f.h" |
| 17 | 17 |
| 18 #if !defined(OS_ANDROID) | 18 #if !defined(OS_ANDROID) |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 namespace { | 21 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 36 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
| 37 bool result) OVERRIDE { | 37 bool result) OVERRIDE { |
| 38 // Find the PictureLayerImpl ask it to append quads to check their material. | 38 // Find the PictureLayerImpl ask it to append quads to check their material. |
| 39 // The PictureLayerImpl is assumed to be the first child of the root layer | 39 // The PictureLayerImpl is assumed to be the first child of the root layer |
| 40 // in the active tree. | 40 // in the active tree. |
| 41 PictureLayerImpl* picture_layer = static_cast<PictureLayerImpl*>( | 41 PictureLayerImpl* picture_layer = static_cast<PictureLayerImpl*>( |
| 42 host_impl->active_tree()->root_layer()->child_at(0)); | 42 host_impl->active_tree()->root_layer()->child_at(0)); |
| 43 | 43 |
| 44 MockOcclusionTracker<LayerImpl> occlusion_tracker; | 44 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
| 45 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 45 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 46 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); | |
| 47 | 46 |
| 48 AppendQuadsData data; | 47 AppendQuadsData data; |
| 49 picture_layer->AppendQuads(&quad_culler, &data); | 48 picture_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
| 50 | 49 |
| 51 for (size_t i = 0; i < render_pass->quad_list.size(); ++i) | 50 for (size_t i = 0; i < render_pass->quad_list.size(); ++i) |
| 52 EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT); | 51 EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT); |
| 53 | 52 |
| 54 // Triggers pixel readback and ends the test. | 53 // Triggers pixel readback and ends the test. |
| 55 LayerTreePixelTest::SwapBuffersOnThread(host_impl, result); | 54 LayerTreePixelTest::SwapBuffersOnThread(host_impl, result); |
| 56 } | 55 } |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 class BlueYellowLayerClient : public ContentLayerClient { | 58 class BlueYellowLayerClient : public ContentLayerClient { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 104 |
| 106 RunPixelTest(GL_WITH_BITMAP, | 105 RunPixelTest(GL_WITH_BITMAP, |
| 107 layer, | 106 layer, |
| 108 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); | 107 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); |
| 109 } | 108 } |
| 110 | 109 |
| 111 } // namespace | 110 } // namespace |
| 112 } // namespace cc | 111 } // namespace cc |
| 113 | 112 |
| 114 #endif // OS_ANDROID | 113 #endif // OS_ANDROID |
| OLD | NEW |