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/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Align with expected and actual output. | 23 // Align with expected and actual output. |
24 const char* LayerTestCommon::quad_string = " Quad: "; | 24 const char* LayerTestCommon::quad_string = " Quad: "; |
25 | 25 |
26 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { | 26 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { |
27 // Ensure that range of float values is not beyond integer range. | 27 // Ensure that range of float values is not beyond integer range. |
28 if (!r.IsExpressibleAsRect()) | 28 if (!r.IsExpressibleAsRect()) |
29 return false; | 29 return false; |
30 | 30 |
31 // Ensure that the values are actually integers. | 31 // Ensure that the values are actually integers. |
32 if (gfx::ToFlooredPoint(r.origin()) == r.origin() && | 32 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), |
33 gfx::ToFlooredSize(r.size()) == r.size()) | 33 std::floor(r.width()), std::floor(r.height())); |
34 return true; | 34 return floored_rect == r; |
35 | |
36 return false; | |
37 } | 35 } |
38 | 36 |
39 void LayerTestCommon::VerifyQuadsExactlyCoverRect(const QuadList& quads, | 37 void LayerTestCommon::VerifyQuadsExactlyCoverRect(const QuadList& quads, |
40 const gfx::Rect& rect) { | 38 const gfx::Rect& rect) { |
41 Region remaining = rect; | 39 Region remaining = rect; |
42 | 40 |
43 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { | 41 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { |
44 gfx::RectF quad_rectf = MathUtil::MapClippedRect( | 42 gfx::RectF quad_rectf = MathUtil::MapClippedRect( |
45 iter->shared_quad_state->quad_to_target_transform, | 43 iter->shared_quad_state->quad_to_target_transform, |
46 gfx::RectF(iter->rect)); | 44 gfx::RectF(iter->rect)); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 render_pass_->shared_quad_state_list.clear(); | 179 render_pass_->shared_quad_state_list.clear(); |
182 | 180 |
183 surface_impl->AppendQuads( | 181 surface_impl->AppendQuads( |
184 render_pass_.get(), gfx::Transform(), | 182 render_pass_.get(), gfx::Transform(), |
185 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded), | 183 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded), |
186 SimpleEnclosedRegion()), | 184 SimpleEnclosedRegion()), |
187 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); | 185 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); |
188 } | 186 } |
189 | 187 |
190 } // namespace cc | 188 } // namespace cc |
OLD | NEW |