| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 layer->draw_properties().drawable_content_rect = rect_in_target; | 101 layer->draw_properties().drawable_content_rect = rect_in_target; |
| 102 | 102 |
| 103 return layer.Pass(); | 103 return layer.Pass(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void AppendQuads(QuadList* quad_list, | 106 void AppendQuads(QuadList* quad_list, |
| 107 SharedQuadStateList* shared_state_list, | 107 SharedQuadStateList* shared_state_list, |
| 108 TiledLayerImpl* layer, | 108 TiledLayerImpl* layer, |
| 109 LayerIteratorType* it, | 109 LayerIteratorType* it, |
| 110 OcclusionTrackerImpl* occlusion_tracker) { | 110 OcclusionTrackerImpl* occlusion_tracker) { |
| 111 occlusion_tracker->EnterLayer(*it, false); | 111 occlusion_tracker->EnterLayer(*it); |
| 112 QuadCuller quad_culler( | 112 QuadCuller quad_culler( |
| 113 quad_list, shared_state_list, layer, *occlusion_tracker, false, false); | 113 quad_list, shared_state_list, layer, *occlusion_tracker, false, false); |
| 114 AppendQuadsData data; | 114 AppendQuadsData data; |
| 115 layer->AppendQuads(&quad_culler, &data); | 115 layer->AppendQuads(&quad_culler, &data); |
| 116 occlusion_tracker->LeaveLayer(*it); | 116 occlusion_tracker->LeaveLayer(*it); |
| 117 ++it; | 117 ++it; |
| 118 } | 118 } |
| 119 | 119 |
| 120 protected: | 120 protected: |
| 121 FakeImplProxy proxy_; | 121 FakeImplProxy proxy_; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 gfx::RectF(), | 812 gfx::RectF(), |
| 813 FilterOperations(), | 813 FilterOperations(), |
| 814 FilterOperations()); | 814 FilterOperations()); |
| 815 | 815 |
| 816 // Set a visible rect on the quads. | 816 // Set a visible rect on the quads. |
| 817 color_quad->visible_rect = gfx::Rect(20, 30, 10, 11); | 817 color_quad->visible_rect = gfx::Rect(20, 30, 10, 11); |
| 818 pass_quad->visible_rect = gfx::Rect(50, 60, 13, 14); | 818 pass_quad->visible_rect = gfx::Rect(50, 60, 13, 14); |
| 819 replica_quad->visible_rect = gfx::Rect(30, 40, 15, 16); | 819 replica_quad->visible_rect = gfx::Rect(30, 40, 15, 16); |
| 820 | 820 |
| 821 // Nothing is occluding. | 821 // Nothing is occluding. |
| 822 occlusion_tracker.EnterLayer(it, false); | 822 occlusion_tracker.EnterLayer(it); |
| 823 | 823 |
| 824 EXPECT_EQ(0u, quad_list.size()); | 824 EXPECT_EQ(0u, quad_list.size()); |
| 825 | 825 |
| 826 AppendQuadsData data; | 826 AppendQuadsData data; |
| 827 culler.Append(color_quad.PassAs<DrawQuad>(), &data); | 827 culler.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 828 culler.Append(pass_quad.PassAs<DrawQuad>(), &data); | 828 culler.Append(pass_quad.PassAs<DrawQuad>(), &data); |
| 829 culler.Append(replica_quad.PassAs<DrawQuad>(), &data); | 829 culler.Append(replica_quad.PassAs<DrawQuad>(), &data); |
| 830 | 830 |
| 831 ASSERT_EQ(3u, quad_list.size()); | 831 ASSERT_EQ(3u, quad_list.size()); |
| 832 | 832 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 gfx::RectF(), | 886 gfx::RectF(), |
| 887 FilterOperations(), | 887 FilterOperations(), |
| 888 FilterOperations()); | 888 FilterOperations()); |
| 889 | 889 |
| 890 // Set a visible rect on the quads. | 890 // Set a visible rect on the quads. |
| 891 color_quad->visible_rect = gfx::Rect(10, 10, 10, 11); | 891 color_quad->visible_rect = gfx::Rect(10, 10, 10, 11); |
| 892 pass_quad->visible_rect = gfx::Rect(10, 20, 13, 14); | 892 pass_quad->visible_rect = gfx::Rect(10, 20, 13, 14); |
| 893 replica_quad->visible_rect = gfx::Rect(10, 30, 15, 16); | 893 replica_quad->visible_rect = gfx::Rect(10, 30, 15, 16); |
| 894 | 894 |
| 895 // Occlude the left part of the visible rects. | 895 // Occlude the left part of the visible rects. |
| 896 occlusion_tracker.EnterLayer(it, false); | 896 occlusion_tracker.EnterLayer(it); |
| 897 occlusion_tracker.set_occlusion_from_outside_target(gfx::Rect(0, 0, 15, 100)); | 897 occlusion_tracker.set_occlusion_from_outside_target(gfx::Rect(0, 0, 15, 100)); |
| 898 | 898 |
| 899 EXPECT_EQ(0u, quad_list.size()); | 899 EXPECT_EQ(0u, quad_list.size()); |
| 900 | 900 |
| 901 AppendQuadsData data; | 901 AppendQuadsData data; |
| 902 culler.Append(color_quad.PassAs<DrawQuad>(), &data); | 902 culler.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 903 culler.Append(pass_quad.PassAs<DrawQuad>(), &data); | 903 culler.Append(pass_quad.PassAs<DrawQuad>(), &data); |
| 904 culler.Append(replica_quad.PassAs<DrawQuad>(), &data); | 904 culler.Append(replica_quad.PassAs<DrawQuad>(), &data); |
| 905 | 905 |
| 906 ASSERT_EQ(3u, quad_list.size()); | 906 ASSERT_EQ(3u, quad_list.size()); |
| 907 | 907 |
| 908 // The partial culling is preserved, while the left side of the quads is newly | 908 // The partial culling is preserved, while the left side of the quads is newly |
| 909 // occluded. | 909 // occluded. |
| 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 |