Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: cc/test/layer_test_common.cc

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Quads that are fully occluded on one axis only should be shrunken. 77 // Quads that are fully occluded on one axis only should be shrunken.
78 for (const auto& quad : quads) { 78 for (const auto& quad : quads) {
79 gfx::Rect target_rect = MathUtil::MapEnclosingClippedRect( 79 gfx::Rect target_rect = MathUtil::MapEnclosingClippedRect(
80 quad->shared_quad_state->quad_to_target_transform, quad->rect); 80 quad->shared_quad_state->quad_to_target_transform, quad->rect);
81 if (!quad->shared_quad_state->quad_to_target_transform 81 if (!quad->shared_quad_state->quad_to_target_transform
82 .IsIdentityOrIntegerTranslation()) { 82 .IsIdentityOrIntegerTranslation()) {
83 DCHECK(quad->shared_quad_state->quad_to_target_transform 83 DCHECK(quad->shared_quad_state->quad_to_target_transform
84 .IsPositiveScaleOrTranslation()) 84 .IsPositiveScaleOrTranslation())
85 << quad->shared_quad_state->quad_to_target_transform.ToString(); 85 << quad->shared_quad_state->quad_to_target_transform.ToString();
86 gfx::RectF target_rectf = MathUtil::MapClippedRect( 86 gfx::RectF target_rectf = MathUtil::MapClippedRect(
87 quad->shared_quad_state->quad_to_target_transform, quad->rect); 87 quad->shared_quad_state->quad_to_target_transform,
88 gfx::RectF(quad->rect));
88 // Scale transforms allowed, as long as the final transformed rect 89 // Scale transforms allowed, as long as the final transformed rect
89 // ends up on integer boundaries for ease of testing. 90 // ends up on integer boundaries for ease of testing.
90 DCHECK_EQ(target_rectf.ToString(), gfx::RectF(target_rect).ToString()); 91 ASSERT_EQ(target_rectf, gfx::RectF(target_rect));
vmpstr 2015/08/29 00:02:46 Why assert?
danakj 2015/08/29 00:13:37 Cuz then we don't need to ToString(). And it was a
vmpstr 2015/08/31 20:08:38 Ohh I thought this was EXPECT -> ASSERT change, no
91 } 92 }
92 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( 93 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect(
93 quad->shared_quad_state->quad_to_target_transform, quad->visible_rect); 94 quad->shared_quad_state->quad_to_target_transform, quad->visible_rect);
94 95
95 bool fully_occluded_horizontal = target_rect.x() >= occluded.x() && 96 bool fully_occluded_horizontal = target_rect.x() >= occluded.x() &&
96 target_rect.right() <= occluded.right(); 97 target_rect.right() <= occluded.right();
97 bool fully_occluded_vertical = target_rect.y() >= occluded.y() && 98 bool fully_occluded_vertical = target_rect.y() >= occluded.y() &&
98 target_rect.bottom() <= occluded.bottom(); 99 target_rect.bottom() <= occluded.bottom();
99 bool should_be_occluded = 100 bool should_be_occluded =
100 target_rect.Intersects(occluded) && 101 target_rect.Intersects(occluded) &&
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 render_pass_->shared_quad_state_list.clear(); 181 render_pass_->shared_quad_state_list.clear();
181 182
182 surface_impl->AppendQuads( 183 surface_impl->AppendQuads(
183 render_pass_.get(), gfx::Transform(), 184 render_pass_.get(), gfx::Transform(),
184 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded), 185 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded),
185 SimpleEnclosedRegion()), 186 SimpleEnclosedRegion()),
186 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); 187 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1));
187 } 188 }
188 189
189 } // namespace cc 190 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698