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 "cc/draw_quad.h" | 7 #include "cc/draw_quad.h" |
8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
9 #include "cc/region.h" | 9 #include "cc/region.h" |
10 #include "cc/render_pass.h" | 10 #include "cc/render_pass.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 return false; | 32 return false; |
33 } | 33 } |
34 | 34 |
35 void verifyQuadsExactlyCoverRect(const cc::QuadList& quads, | 35 void verifyQuadsExactlyCoverRect(const cc::QuadList& quads, |
36 const gfx::Rect& rect) { | 36 const gfx::Rect& rect) { |
37 cc::Region remaining = rect; | 37 cc::Region remaining = rect; |
38 | 38 |
39 for (size_t i = 0; i < quads.size(); ++i) { | 39 for (size_t i = 0; i < quads.size(); ++i) { |
40 cc::DrawQuad* quad = quads[i]; | 40 cc::DrawQuad* quad = quads[i]; |
41 gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->shared_quad_st
ate->quadTransform, gfx::RectF(quad->rect)); | 41 gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->quadTransform(
), gfx::RectF(quad->rect)); |
42 | 42 |
43 // Before testing for exact coverage in the integer world, assert that r
ounding | 43 // Before testing for exact coverage in the integer world, assert that r
ounding |
44 // will not round the rect incorrectly. | 44 // will not round the rect incorrectly. |
45 ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF)); | 45 ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF)); |
46 | 46 |
47 gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF); | 47 gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF); |
48 | 48 |
49 EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i; | 49 EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i; |
50 EXPECT_TRUE(remaining.Contains(quadRect)) << quadString << i; | 50 EXPECT_TRUE(remaining.Contains(quadRect)) << quadString << i; |
51 remaining.Subtract(quadRect); | 51 remaining.Subtract(quadRect); |
52 } | 52 } |
53 | 53 |
54 EXPECT_TRUE(remaining.IsEmpty()); | 54 EXPECT_TRUE(remaining.IsEmpty()); |
55 } | 55 } |
56 | 56 |
57 } // namespace LayerTestCommon | 57 } // namespace LayerTestCommon |
OLD | NEW |