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

Side by Side Diff: cc/trees/damage_tracker_unittest.cc

Issue 23043011: cc: Use SkMScalar instead of doubles everywhere in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: danakj review Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/geometry_test_utils.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/output/filter_operation.h" 9 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 10 #include "cc/output/filter_operations.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // With the anchor on the layer's center, now we can test the rotation more 333 // With the anchor on the layer's center, now we can test the rotation more
334 // intuitively, since it applies about the layer's anchor. 334 // intuitively, since it applies about the layer's anchor.
335 ClearDamageForAllSurfaces(root.get()); 335 ClearDamageForAllSurfaces(root.get());
336 child->SetTransform(rotation); 336 child->SetTransform(rotation);
337 EmulateDrawingOneFrame(root.get()); 337 EmulateDrawingOneFrame(root.get());
338 338
339 // Since the child layer is square, rotation by 45 degrees about the center 339 // Since the child layer is square, rotation by 45 degrees about the center
340 // should increase the size of the expected rect by sqrt(2), centered around 340 // should increase the size of the expected rect by sqrt(2), centered around
341 // (100, 100). The old exposed region should be fully contained in the new 341 // (100, 100). The old exposed region should be fully contained in the new
342 // region. 342 // region.
343 double expected_width = 30.0 * sqrt(2.0); 343 float expected_width = 30.f * sqrt(2.f);
344 double expected_position = 100.0 - 0.5 * expected_width; 344 float expected_position = 100.f - 0.5f * expected_width;
345 gfx::RectF expected_rect(expected_position, 345 gfx::RectF expected_rect(
346 expected_position, 346 expected_position, expected_position, expected_width, expected_width);
347 expected_width,
348 expected_width);
349 root_damage_rect = 347 root_damage_rect =
350 root->render_surface()->damage_tracker()->current_damage_rect(); 348 root->render_surface()->damage_tracker()->current_damage_rect();
351 EXPECT_FLOAT_RECT_EQ(expected_rect, root_damage_rect); 349 EXPECT_FLOAT_RECT_EQ(expected_rect, root_damage_rect);
352 } 350 }
353 351
354 TEST_F(DamageTrackerTest, VerifyDamageForPerspectiveClippedLayer) { 352 TEST_F(DamageTrackerTest, VerifyDamageForPerspectiveClippedLayer) {
355 // If a layer has a perspective transform that causes w < 0, then not 353 // If a layer has a perspective transform that causes w < 0, then not
356 // clipping the layer can cause an invalid damage rect. This test checks that 354 // clipping the layer can cause an invalid damage rect. This test checks that
357 // the w < 0 case is tracked properly. 355 // the w < 0 case is tracked properly.
358 // 356 //
359 // The transform is constructed so that if w < 0 clipping is not performed, 357 // The transform is constructed so that if w < 0 clipping is not performed,
360 // the incorrect rect will be very small, specifically: position (500.972504, 358 // the incorrect rect will be very small, specifically: position (500.972504,
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 // Damage should remain empty even after one frame, since there's yet no new 1338 // Damage should remain empty even after one frame, since there's yet no new
1341 // damage. 1339 // damage.
1342 EmulateDrawingOneFrame(root.get()); 1340 EmulateDrawingOneFrame(root.get());
1343 root_damage_rect = 1341 root_damage_rect =
1344 root->render_surface()->damage_tracker()->current_damage_rect(); 1342 root->render_surface()->damage_tracker()->current_damage_rect();
1345 EXPECT_TRUE(root_damage_rect.IsEmpty()); 1343 EXPECT_TRUE(root_damage_rect.IsEmpty());
1346 } 1344 }
1347 1345
1348 } // namespace 1346 } // namespace
1349 } // namespace cc 1347 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/geometry_test_utils.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698