Chromium Code Reviews| 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/test/layer_test_common.h" | 5 #include "cc/test/layer_test_common.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/animation/animation_id_provider.h" | 10 #include "cc/animation/animation_id_provider.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), | 41 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), |
| 42 std::floor(r.width()), std::floor(r.height())); | 42 std::floor(r.width()), std::floor(r.height())); |
| 43 return floored_rect == r; | 43 return floored_rect == r; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void LayerTestCommon::VerifyQuadsExactlyCoverRect(const QuadList& quads, | 46 void LayerTestCommon::VerifyQuadsExactlyCoverRect(const QuadList& quads, |
| 47 const gfx::Rect& rect) { | 47 const gfx::Rect& rect) { |
| 48 Region remaining = rect; | 48 Region remaining = rect; |
| 49 | 49 |
| 50 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { | 50 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { |
| 51 EXPECT_TRUE(iter->rect.Contains(iter->visible_rect)); | |
|
danakj
2017/02/10 20:35:44
In order to exactly cover, would the rects not nee
malaykeshav
2017/02/10 21:02:50
I think its: all the |quads| (visible) combined sh
danakj
2017/02/10 22:06:45
OK I think you're right, and checking that the vis
| |
| 52 | |
| 51 gfx::RectF quad_rectf = MathUtil::MapClippedRect( | 53 gfx::RectF quad_rectf = MathUtil::MapClippedRect( |
| 52 iter->shared_quad_state->quad_to_target_transform, | 54 iter->shared_quad_state->quad_to_target_transform, |
| 53 gfx::RectF(iter->rect)); | 55 gfx::RectF(iter->visible_rect)); |
| 54 | 56 |
| 55 // Before testing for exact coverage in the integer world, assert that | 57 // Before testing for exact coverage in the integer world, assert that |
| 56 // rounding will not round the rect incorrectly. | 58 // rounding will not round the rect incorrectly. |
| 57 ASSERT_TRUE(CanRectFBeSafelyRoundedToRect(quad_rectf)); | 59 ASSERT_TRUE(CanRectFBeSafelyRoundedToRect(quad_rectf)); |
| 58 | 60 |
| 59 gfx::Rect quad_rect = gfx::ToEnclosingRect(quad_rectf); | 61 gfx::Rect quad_rect = gfx::ToEnclosingRect(quad_rectf); |
| 60 | 62 |
| 61 EXPECT_TRUE(rect.Contains(quad_rect)) << quad_string << iter.index() | 63 EXPECT_TRUE(rect.Contains(quad_rect)) << quad_string << iter.index() |
| 62 << " rect: " << rect.ToString() | 64 << " rect: " << rect.ToString() |
| 63 << " quad: " << quad_rect.ToString(); | 65 << " quad: " << quad_rect.ToString(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 } | 209 } |
| 208 | 210 |
| 209 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 211 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 210 | 212 |
| 211 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { | 213 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { |
| 212 root_layer_for_testing()->test_properties()->copy_requests.push_back( | 214 root_layer_for_testing()->test_properties()->copy_requests.push_back( |
| 213 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 215 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 214 } | 216 } |
| 215 | 217 |
| 216 } // namespace cc | 218 } // namespace cc |
| OLD | NEW |