| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/painted_scrollbar_layer_impl.h" | 5 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
| 10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 gfx::Rect thumb_rect = scrollbar_layer_impl->ComputeThumbQuadRect(); | 65 gfx::Rect thumb_rect = scrollbar_layer_impl->ComputeThumbQuadRect(); |
| 66 EXPECT_EQ(gfx::Rect(0, 500 / 4, 10, layer_size.height() / 2).ToString(), | 66 EXPECT_EQ(gfx::Rect(0, 500 / 4, 10, layer_size.height() / 2).ToString(), |
| 67 thumb_rect.ToString()); | 67 thumb_rect.ToString()); |
| 68 | 68 |
| 69 { | 69 { |
| 70 SCOPED_TRACE("No occlusion"); | 70 SCOPED_TRACE("No occlusion"); |
| 71 gfx::Rect occluded; | 71 gfx::Rect occluded; |
| 72 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 72 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
| 73 | 73 |
| 74 size_t partially_occluded_count = 0; | 74 size_t partially_occluded_count = 0; |
| 75 LayerTestCommon::VerifyQuadsAreOccluded( | 75 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, false, |
| 76 impl.quad_list(), occluded, &partially_occluded_count); | 76 &partially_occluded_count); |
| 77 EXPECT_EQ(2u, impl.quad_list().size()); | 77 EXPECT_EQ(2u, impl.quad_list().size()); |
| 78 EXPECT_EQ(0u, partially_occluded_count); | 78 EXPECT_EQ(0u, partially_occluded_count); |
| 79 | 79 |
| 80 // Note: this is also testing that the thumb and track are both | 80 // Note: this is also testing that the thumb and track are both |
| 81 // scaled by the internal contents scale. It's not occlusion-related | 81 // scaled by the internal contents scale. It's not occlusion-related |
| 82 // but is easy to verify here. | 82 // but is easy to verify here. |
| 83 const DrawQuad* thumb_draw_quad = impl.quad_list().ElementAt(0); | 83 const DrawQuad* thumb_draw_quad = impl.quad_list().ElementAt(0); |
| 84 const DrawQuad* track_draw_quad = impl.quad_list().ElementAt(1); | 84 const DrawQuad* track_draw_quad = impl.quad_list().ElementAt(1); |
| 85 | 85 |
| 86 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, thumb_draw_quad->material); | 86 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, thumb_draw_quad->material); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 117 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); | 117 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); |
| 118 EXPECT_EQ(impl.quad_list().size(), 0u); | 118 EXPECT_EQ(impl.quad_list().size(), 0u); |
| 119 } | 119 } |
| 120 | 120 |
| 121 { | 121 { |
| 122 SCOPED_TRACE("Partial occlusion"); | 122 SCOPED_TRACE("Partial occlusion"); |
| 123 gfx::Rect occluded(0, 0, 5, 1000); | 123 gfx::Rect occluded(0, 0, 5, 1000); |
| 124 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 124 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
| 125 | 125 |
| 126 size_t partially_occluded_count = 0; | 126 size_t partially_occluded_count = 0; |
| 127 LayerTestCommon::VerifyQuadsAreOccluded( | 127 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, false, |
| 128 impl.quad_list(), occluded, &partially_occluded_count); | 128 &partially_occluded_count); |
| 129 // The layer outputs two quads, which is partially occluded. | 129 // The layer outputs two quads, which is partially occluded. |
| 130 EXPECT_EQ(2u, impl.quad_list().size()); | 130 EXPECT_EQ(2u, impl.quad_list().size()); |
| 131 EXPECT_EQ(2u, partially_occluded_count); | 131 EXPECT_EQ(2u, partially_occluded_count); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace | 135 } // namespace |
| 136 } // namespace cc | 136 } // namespace cc |
| OLD | NEW |