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

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

Issue 2866063002: Improve overdraw with multiple windows (Closed)
Patch Set: address comments Created 3 years, 7 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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.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/base/filter_operation.h" 10 #include "cc/base/filter_operation.h"
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 // needs should be removed from the occluded area, so that they are drawn 1458 // needs should be removed from the occluded area, so that they are drawn
1459 // when we get to the parent. 1459 // when we get to the parent.
1460 this->VisitContributingSurface(filtered_surface, &occlusion); 1460 this->VisitContributingSurface(filtered_surface, &occlusion);
1461 this->EnterLayer(parent, &occlusion); 1461 this->EnterLayer(parent, &occlusion);
1462 1462
1463 gfx::Rect expected_occlusion; 1463 gfx::Rect expected_occlusion;
1464 switch (i) { 1464 switch (i) {
1465 case LEFT: 1465 case LEFT:
1466 // The right half of the occlusion is close enough to cast a shadow 1466 // The right half of the occlusion is close enough to cast a shadow
1467 // that would be visible in the background filter. The shadow reaches 1467 // that would be visible in the background filter. The shadow reaches
1468 // 3*5 + 10 = 25 pixels to the right. 1468 // 3*5 + 10 = 25 pixels to the right, which is (0, 0, 25, 200). The
1469 expected_occlusion = gfx::Rect(0, 0, 25, 200); 1469 // rect created in filtered_surface is (50, 50, 100, 100), which
1470 // becomes (25, 25, 20, 80) after applying gfx::Transform
1471 // |scale_by_half|, adding FilterOperations |filters| and updating
1472 // opacity pixel outside the rect. Union (0, 0, 25, 200) and
1473 // (25, 25, 20, 80), it's (0, 25, 45, 80)
1474 expected_occlusion = gfx::Rect(0, 25, 45, 80);
1470 break; 1475 break;
1471 case RIGHT: 1476 case RIGHT:
1472 // The shadow spreads 3*5 - 10 = 5 pixels to the left, so the 1477 // The shadow spreads 3*5 - 10 = 5 pixels to the left, so the
1473 // occlusion must recede by 5 to account for that. 1478 // occlusion must recede by 5 to account for that.
1474 expected_occlusion = gfx::Rect(105, 0, 45, 200); 1479 expected_occlusion = gfx::Rect(105, 0, 45, 200);
1475 break; 1480 break;
1476 case TOP: 1481 case TOP:
1477 // Similar to LEFT. 1482 // Similar to LEFT.
1478 expected_occlusion = gfx::Rect(0, 0, 200, 25); 1483 expected_occlusion = gfx::Rect(25, 0, 80, 45);
1479 break; 1484 break;
1480 case BOTTOM: 1485 case BOTTOM:
1481 // Similar to RIGHT. 1486 // Similar to RIGHT.
1482 expected_occlusion = gfx::Rect(0, 105, 200, 45); 1487 expected_occlusion = gfx::Rect(0, 105, 200, 45);
1483 break; 1488 break;
1484 } 1489 }
1485 1490
1486 EXPECT_EQ(expected_occlusion.ToString(), 1491 EXPECT_EQ(expected_occlusion.ToString(),
1487 occlusion.occlusion_from_inside_target().ToString()); 1492 occlusion.occlusion_from_inside_target().ToString());
1488 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); 1493 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty());
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 EXPECT_EQ(gfx::Rect(), 2438 EXPECT_EQ(gfx::Rect(),
2434 occlusion.UnoccludedSurfaceContentRect( 2439 occlusion.UnoccludedSurfaceContentRect(
2435 surface, gfx::Rect(80, 70, 50, 50))); 2440 surface, gfx::Rect(80, 70, 50, 50)));
2436 } 2441 }
2437 }; 2442 };
2438 2443
2439 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 2444 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
2440 2445
2441 } // namespace 2446 } // namespace
2442 } // namespace cc 2447 } // namespace cc
OLDNEW
« cc/base/simple_enclosed_region.cc ('K') | « cc/base/simple_enclosed_region_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698