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

Side by Side Diff: cc/output/overlay_unittest.cc

Issue 2844483004: Reset the state of the previous frame if overlay processing is skipped. (Closed)
Patch Set: Reset the state of the previous frame if hardware overlay processing is skipped. 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
« no previous file with comments | « cc/output/overlay_processor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/flat_map.h" 10 #include "base/containers/flat_map.h"
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 base::flat_map<int, FilterOperations*> render_pass_background_filters; 1391 base::flat_map<int, FilterOperations*> render_pass_background_filters;
1392 overlay_processor_->ProcessForOverlays( 1392 overlay_processor_->ProcessForOverlays(
1393 resource_provider_.get(), pass.get(), render_pass_filters, 1393 resource_provider_.get(), pass.get(), render_pass_filters,
1394 render_pass_background_filters, &candidate_list, nullptr, nullptr, 1394 render_pass_background_filters, &candidate_list, nullptr, nullptr,
1395 &damage_rect_, &content_bounds_); 1395 &damage_rect_, &content_bounds_);
1396 1396
1397 EXPECT_EQ(overlay_rects[i], damage_rect_); 1397 EXPECT_EQ(overlay_rects[i], damage_rect_);
1398 } 1398 }
1399 } 1399 }
1400 1400
1401 // Underlay damage can only be subtracted if the previous frame's underlay
1402 // exists.
1403 TEST_F(UnderlayTest, DamageNotSubtractedForNonConsecutiveIdenticalUnderlays) {
1404 bool has_fullscreen_candidate[] = {true, false, true};
1405
1406 for (int i = 0; i < 3; ++i) {
1407 std::unique_ptr<RenderPass> pass = CreateRenderPass();
1408
1409 if (has_fullscreen_candidate[i]) {
1410 CreateFullscreenCandidateQuad(resource_provider_.get(),
1411 pass->shared_quad_state_list.back(),
1412 pass.get());
1413 }
1414
1415 damage_rect_ = kOverlayRect;
1416
1417 // Add something behind it.
1418 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1419 pass->shared_quad_state_list.back(), pass.get());
1420
1421 OverlayCandidateList candidate_list;
1422 base::flat_map<int, FilterOperations*> render_pass_filters;
1423 base::flat_map<int, FilterOperations*> render_pass_background_filters;
1424 overlay_processor_->ProcessForOverlays(
1425 resource_provider_.get(), pass.get(), render_pass_filters,
1426 render_pass_background_filters, &candidate_list, nullptr, nullptr,
1427 &damage_rect_, &content_bounds_);
1428 }
1429
1430 EXPECT_EQ(kOverlayRect, damage_rect_);
1431 }
1432
1401 TEST_F(UnderlayTest, DamageNotSubtractedWhenQuadsAboveOverlap) { 1433 TEST_F(UnderlayTest, DamageNotSubtractedWhenQuadsAboveOverlap) {
1402 for (int i = 0; i < 2; ++i) { 1434 for (int i = 0; i < 2; ++i) {
1403 std::unique_ptr<RenderPass> pass = CreateRenderPass(); 1435 std::unique_ptr<RenderPass> pass = CreateRenderPass();
1404 // Add an overlapping quad above the candidate. 1436 // Add an overlapping quad above the candidate.
1405 CreateFullscreenOpaqueQuad(resource_provider_.get(), 1437 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1406 pass->shared_quad_state_list.back(), pass.get()); 1438 pass->shared_quad_state_list.back(), pass.get());
1407 CreateFullscreenCandidateQuad(resource_provider_.get(), 1439 CreateFullscreenCandidateQuad(resource_provider_.get(),
1408 pass->shared_quad_state_list.back(), 1440 pass->shared_quad_state_list.back(),
1409 pass.get()); 1441 pass.get());
1410 1442
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(), 2631 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(),
2600 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF()); 2632 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF());
2601 } 2633 }
2602 2634
2603 ProcessForOverlays(); 2635 ProcessForOverlays();
2604 EXPECT_EQ(0U, ca_layer_list_.size()); 2636 EXPECT_EQ(0U, ca_layer_list_.size());
2605 } 2637 }
2606 2638
2607 } // namespace 2639 } // namespace
2608 } // namespace cc 2640 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698