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/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
28 namespace { | 28 namespace { |
29 | 29 |
30 class TestOcclusionTrackerImpl | 30 class TestOcclusionTrackerImpl |
31 : public TestOcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> { | 31 : public TestOcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> { |
32 public: | 32 public: |
33 TestOcclusionTrackerImpl(gfx::Rect scissor_rect_in_screen, | 33 TestOcclusionTrackerImpl(const gfx::Rect& scissor_rect_in_screen, |
34 bool record_metrics_for_frame = true) | 34 bool record_metrics_for_frame = true) |
35 : TestOcclusionTrackerBase(scissor_rect_in_screen, | 35 : TestOcclusionTrackerBase(scissor_rect_in_screen, |
36 record_metrics_for_frame) {} | 36 record_metrics_for_frame) {} |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(TestOcclusionTrackerImpl); | 39 DISALLOW_COPY_AND_ASSIGN(TestOcclusionTrackerImpl); |
40 }; | 40 }; |
41 | 41 |
42 typedef LayerIterator<LayerImpl, | 42 typedef LayerIterator<LayerImpl, |
43 LayerImplList, | 43 LayerImplList, |
44 RenderSurfaceImpl, | 44 RenderSurfaceImpl, |
45 LayerIteratorActions::FrontToBack> LayerIteratorType; | 45 LayerIteratorActions::FrontToBack> LayerIteratorType; |
46 | 46 |
47 class QuadCullerTest : public testing::Test { | 47 class QuadCullerTest : public testing::Test { |
48 public: | 48 public: |
49 QuadCullerTest() | 49 QuadCullerTest() |
50 : host_impl_(&proxy_), | 50 : host_impl_(&proxy_), |
51 layer_id_(1) {} | 51 layer_id_(1) {} |
52 | 52 |
53 scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent, | 53 scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent, |
54 const gfx::Transform& draw_transform, | 54 const gfx::Transform& draw_transform, |
55 gfx::Rect layer_rect, | 55 const gfx::Rect& layer_rect, |
56 float opacity, | 56 float opacity, |
57 bool opaque, | 57 bool opaque, |
58 gfx::Rect layer_opaque_rect, | 58 const gfx::Rect& layer_opaque_rect, |
59 LayerImplList& surface_layer_list) { | 59 LayerImplList& surface_layer_list) { |
60 scoped_ptr<TiledLayerImpl> layer = | 60 scoped_ptr<TiledLayerImpl> layer = |
61 TiledLayerImpl::Create(host_impl_.active_tree(), layer_id_++); | 61 TiledLayerImpl::Create(host_impl_.active_tree(), layer_id_++); |
62 scoped_ptr<LayerTilingData> tiler = LayerTilingData::Create( | 62 scoped_ptr<LayerTilingData> tiler = LayerTilingData::Create( |
63 gfx::Size(100, 100), LayerTilingData::NO_BORDER_TEXELS); | 63 gfx::Size(100, 100), LayerTilingData::NO_BORDER_TEXELS); |
64 tiler->SetBounds(layer_rect.size()); | 64 tiler->SetBounds(layer_rect.size()); |
65 layer->SetTilingData(*tiler); | 65 layer->SetTilingData(*tiler); |
66 layer->set_skips_draw(false); | 66 layer->set_skips_draw(false); |
67 layer->SetDrawsContent(true); | 67 layer->SetDrawsContent(true); |
68 layer->draw_properties().target_space_transform = draw_transform; | 68 layer->draw_properties().target_space_transform = draw_transform; |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 EXPECT_EQ(gfx::Rect(15, 10, 5, 11).ToString(), | 910 EXPECT_EQ(gfx::Rect(15, 10, 5, 11).ToString(), |
911 quad_list[0]->visible_rect.ToString()); | 911 quad_list[0]->visible_rect.ToString()); |
912 EXPECT_EQ(gfx::Rect(15, 20, 8, 14).ToString(), | 912 EXPECT_EQ(gfx::Rect(15, 20, 8, 14).ToString(), |
913 quad_list[1]->visible_rect.ToString()); | 913 quad_list[1]->visible_rect.ToString()); |
914 EXPECT_EQ(gfx::Rect(15, 30, 10, 16).ToString(), | 914 EXPECT_EQ(gfx::Rect(15, 30, 10, 16).ToString(), |
915 quad_list[2]->visible_rect.ToString()); | 915 quad_list[2]->visible_rect.ToString()); |
916 } | 916 } |
917 | 917 |
918 } // namespace | 918 } // namespace |
919 } // namespace cc | 919 } // namespace cc |
OLD | NEW |