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

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

Issue 2051343002: Make various gfx classes more amenable to use as compile-time constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile and test fixes Created 4 years, 6 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 <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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DCHECK(quad->shared_quad_state->quad_to_target_transform 90 DCHECK(quad->shared_quad_state->quad_to_target_transform
91 .IsPositiveScaleOrTranslation()) 91 .IsPositiveScaleOrTranslation())
92 << quad->shared_quad_state->quad_to_target_transform.ToString(); 92 << quad->shared_quad_state->quad_to_target_transform.ToString();
93 gfx::RectF target_rectf = MathUtil::MapClippedRect( 93 gfx::RectF target_rectf = MathUtil::MapClippedRect(
94 quad->shared_quad_state->quad_to_target_transform, 94 quad->shared_quad_state->quad_to_target_transform,
95 gfx::RectF(quad->rect)); 95 gfx::RectF(quad->rect));
96 // Scale transforms allowed, as long as the final transformed rect 96 // Scale transforms allowed, as long as the final transformed rect
97 // ends up on integer boundaries for ease of testing. 97 // ends up on integer boundaries for ease of testing.
98 ASSERT_EQ(target_rectf, gfx::RectF(target_rect)); 98 ASSERT_EQ(target_rectf, gfx::RectF(target_rect));
99 } 99 }
100 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect(
101 quad->shared_quad_state->quad_to_target_transform, quad->visible_rect);
102 100
103 bool fully_occluded_horizontal = target_rect.x() >= occluded.x() && 101 bool fully_occluded_horizontal = target_rect.x() >= occluded.x() &&
104 target_rect.right() <= occluded.right(); 102 target_rect.right() <= occluded.right();
105 bool fully_occluded_vertical = target_rect.y() >= occluded.y() && 103 bool fully_occluded_vertical = target_rect.y() >= occluded.y() &&
106 target_rect.bottom() <= occluded.bottom(); 104 target_rect.bottom() <= occluded.bottom();
107 bool should_be_occluded = 105 bool should_be_occluded =
108 target_rect.Intersects(occluded) && 106 target_rect.Intersects(occluded) &&
109 (fully_occluded_vertical || fully_occluded_horizontal); 107 (fully_occluded_vertical || fully_occluded_horizontal);
110 if (!should_be_occluded) { 108 if (!should_be_occluded) {
111 EXPECT_EQ(quad->rect.ToString(), quad->visible_rect.ToString()); 109 EXPECT_EQ(quad->rect.ToString(), quad->visible_rect.ToString());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 205 }
208 206
209 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} 207 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
210 208
211 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { 209 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() {
212 root_layer()->test_properties()->copy_requests.push_back( 210 root_layer()->test_properties()->copy_requests.push_back(
213 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 211 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
214 } 212 }
215 213
216 } // namespace cc 214 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698