OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/trees/quad_culler.h" | 5 #include "cc/trees/quad_culler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/layers/append_quads_data.h" | 10 #include "cc/layers/append_quads_data.h" |
11 #include "cc/layers/render_surface_impl.h" | 11 #include "cc/layers/render_surface_impl.h" |
12 #include "cc/layers/tiled_layer_impl.h" | 12 #include "cc/layers/tiled_layer_impl.h" |
13 #include "cc/quads/render_pass_draw_quad.h" | 13 #include "cc/quads/render_pass_draw_quad.h" |
14 #include "cc/quads/solid_color_draw_quad.h" | 14 #include "cc/quads/solid_color_draw_quad.h" |
15 #include "cc/quads/tile_draw_quad.h" | 15 #include "cc/quads/tile_draw_quad.h" |
16 #include "cc/resources/layer_tiling_data.h" | 16 #include "cc/resources/layer_tiling_data.h" |
17 #include "cc/test/fake_impl_proxy.h" | 17 #include "cc/test/fake_impl_proxy.h" |
18 #include "cc/test/fake_layer_tree_host_impl.h" | 18 #include "cc/test/fake_layer_tree_host_impl.h" |
19 #include "cc/test/test_occlusion_tracker.h" | 19 #include "cc/test/test_occlusion_tracker.h" |
| 20 #include "cc/test/test_shared_bitmap_manager.h" |
20 #include "cc/trees/occlusion_tracker.h" | 21 #include "cc/trees/occlusion_tracker.h" |
21 #include "cc/trees/single_thread_proxy.h" | 22 #include "cc/trees/single_thread_proxy.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
25 | 26 |
26 namespace cc { | 27 namespace cc { |
27 namespace { | 28 namespace { |
28 | 29 |
29 typedef LayerIterator<LayerImpl> LayerIteratorType; | 30 typedef LayerIterator<LayerImpl> LayerIteratorType; |
30 | 31 |
31 class QuadCullerTest : public testing::Test { | 32 class QuadCullerTest : public testing::Test { |
32 public: | 33 public: |
33 QuadCullerTest() | 34 QuadCullerTest() |
34 : host_impl_(&proxy_), | 35 : host_impl_(&proxy_, &shared_bitmap_manager_), layer_id_(1) {} |
35 layer_id_(1) {} | |
36 | 36 |
37 scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent, | 37 scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent, |
38 const gfx::Transform& draw_transform, | 38 const gfx::Transform& draw_transform, |
39 const gfx::Rect& layer_rect, | 39 const gfx::Rect& layer_rect, |
40 float opacity, | 40 float opacity, |
41 bool opaque, | 41 bool opaque, |
42 const gfx::Rect& layer_opaque_rect, | 42 const gfx::Rect& layer_opaque_rect, |
43 LayerImplList& surface_layer_list) { | 43 LayerImplList& surface_layer_list) { |
44 scoped_ptr<TiledLayerImpl> layer = | 44 scoped_ptr<TiledLayerImpl> layer = |
45 TiledLayerImpl::Create(host_impl_.active_tree(), layer_id_++); | 45 TiledLayerImpl::Create(host_impl_.active_tree(), layer_id_++); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 QuadCuller quad_culler( | 96 QuadCuller quad_culler( |
97 quad_list, shared_state_list, layer, *occlusion_tracker, false); | 97 quad_list, shared_state_list, layer, *occlusion_tracker, false); |
98 AppendQuadsData data; | 98 AppendQuadsData data; |
99 layer->AppendQuads(&quad_culler, &data); | 99 layer->AppendQuads(&quad_culler, &data); |
100 occlusion_tracker->LeaveLayer(*it); | 100 occlusion_tracker->LeaveLayer(*it); |
101 ++it; | 101 ++it; |
102 } | 102 } |
103 | 103 |
104 protected: | 104 protected: |
105 FakeImplProxy proxy_; | 105 FakeImplProxy proxy_; |
| 106 TestSharedBitmapManager shared_bitmap_manager_; |
106 FakeLayerTreeHostImpl host_impl_; | 107 FakeLayerTreeHostImpl host_impl_; |
107 int layer_id_; | 108 int layer_id_; |
108 | 109 |
109 private: | 110 private: |
110 DISALLOW_COPY_AND_ASSIGN(QuadCullerTest); | 111 DISALLOW_COPY_AND_ASSIGN(QuadCullerTest); |
111 }; | 112 }; |
112 | 113 |
113 #define DECLARE_AND_INITIALIZE_TEST_QUADS() \ | 114 #define DECLARE_AND_INITIALIZE_TEST_QUADS() \ |
114 QuadList quad_list; \ | 115 QuadList quad_list; \ |
115 SharedQuadStateList shared_state_list; \ | 116 SharedQuadStateList shared_state_list; \ |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 EXPECT_EQ(gfx::Rect(15, 10, 5, 11).ToString(), | 776 EXPECT_EQ(gfx::Rect(15, 10, 5, 11).ToString(), |
776 quad_list[0]->visible_rect.ToString()); | 777 quad_list[0]->visible_rect.ToString()); |
777 EXPECT_EQ(gfx::Rect(15, 20, 8, 14).ToString(), | 778 EXPECT_EQ(gfx::Rect(15, 20, 8, 14).ToString(), |
778 quad_list[1]->visible_rect.ToString()); | 779 quad_list[1]->visible_rect.ToString()); |
779 EXPECT_EQ(gfx::Rect(15, 30, 10, 16).ToString(), | 780 EXPECT_EQ(gfx::Rect(15, 30, 10, 16).ToString(), |
780 quad_list[2]->visible_rect.ToString()); | 781 quad_list[2]->visible_rect.ToString()); |
781 } | 782 } |
782 | 783 |
783 } // namespace | 784 } // namespace |
784 } // namespace cc | 785 } // namespace cc |
OLD | NEW |