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

Side by Side Diff: cc/output/overlay_strategy_single_on_top.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: rectfconvert-cc: rebase-and-sandwich-strategy 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
« no previous file with comments | « cc/output/overlay_strategy_sandwich.cc ('k') | cc/output/overlay_strategy_underlay.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 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 "cc/output/overlay_strategy_single_on_top.h" 5 #include "cc/output/overlay_strategy_single_on_top.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "cc/base/math_util.h"
9 #include "cc/output/overlay_candidate_validator.h" 10 #include "cc/output/overlay_candidate_validator.h"
10 #include "cc/quads/draw_quad.h" 11 #include "cc/quads/draw_quad.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 OverlayStrategySingleOnTop::~OverlayStrategySingleOnTop() {} 15 OverlayStrategySingleOnTop::~OverlayStrategySingleOnTop() {}
15 16
16 bool OverlayStrategySingleOnTop::TryOverlay( 17 bool OverlayStrategySingleOnTop::TryOverlay(
17 OverlayCandidateValidator* capability_checker, 18 OverlayCandidateValidator* capability_checker,
18 RenderPassList* render_passes_in_draw_order, 19 RenderPassList* render_passes_in_draw_order,
19 OverlayCandidateList* candidate_list, 20 OverlayCandidateList* candidate_list,
20 const OverlayCandidate& candidate, 21 const OverlayCandidate& candidate,
21 QuadList::Iterator candidate_iterator, 22 QuadList::Iterator candidate_iterator,
22 float device_scale_factor) { 23 float device_scale_factor) {
23 RenderPass* root_render_pass = render_passes_in_draw_order->back(); 24 RenderPass* root_render_pass = render_passes_in_draw_order->back();
24 QuadList& quad_list = root_render_pass->quad_list; 25 QuadList& quad_list = root_render_pass->quad_list;
25 const DrawQuad* draw_quad = *candidate_iterator; 26 const DrawQuad* draw_quad = *candidate_iterator;
26 gfx::RectF rect = draw_quad->rect; 27 gfx::RectF rect = MathUtil::MapClippedRect(
27 draw_quad->shared_quad_state->quad_to_target_transform.TransformRect(&rect); 28 draw_quad->shared_quad_state->quad_to_target_transform,
29 gfx::RectF(draw_quad->rect));
28 30
29 // Check that no prior quads overlap it. 31 // Check that no prior quads overlap it.
30 for (auto overlap_iter = quad_list.cbegin(); 32 for (auto overlap_iter = quad_list.cbegin();
31 overlap_iter != candidate_iterator; ++overlap_iter) { 33 overlap_iter != candidate_iterator; ++overlap_iter) {
32 gfx::RectF overlap_rect = overlap_iter->rect; 34 gfx::RectF overlap_rect = MathUtil::MapClippedRect(
33 overlap_iter->shared_quad_state->quad_to_target_transform.TransformRect( 35 overlap_iter->shared_quad_state->quad_to_target_transform,
34 &overlap_rect); 36 gfx::RectF(overlap_iter->rect));
35 if (rect.Intersects(overlap_rect) && 37 if (rect.Intersects(overlap_rect) &&
36 !OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter)) 38 !OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter))
37 return false; 39 return false;
38 } 40 }
39 41
40 // Add our primary surface. 42 // Add our primary surface.
41 OverlayCandidateList candidates; 43 OverlayCandidateList candidates;
42 OverlayCandidate main_image; 44 OverlayCandidate main_image;
43 main_image.display_rect = root_render_pass->output_rect; 45 main_image.display_rect = gfx::RectF(root_render_pass->output_rect);
44 candidates.push_back(main_image); 46 candidates.push_back(main_image);
45 47
46 // Add the overlay. 48 // Add the overlay.
47 candidates.push_back(candidate); 49 candidates.push_back(candidate);
48 candidates.back().plane_z_order = 1; 50 candidates.back().plane_z_order = 1;
49 51
50 // Check for support. 52 // Check for support.
51 capability_checker->CheckOverlaySupport(&candidates); 53 capability_checker->CheckOverlaySupport(&candidates);
52 54
53 // If the candidate can be handled by an overlay, create a pass for it. 55 // If the candidate can be handled by an overlay, create a pass for it.
54 if (candidates[1].overlay_handled) { 56 if (candidates[1].overlay_handled) {
55 quad_list.EraseAndInvalidateAllPointers(candidate_iterator); 57 quad_list.EraseAndInvalidateAllPointers(candidate_iterator);
56 candidate_list->swap(candidates); 58 candidate_list->swap(candidates);
57 return true; 59 return true;
58 } 60 }
59 return false; 61 return false;
60 } 62 }
61 63
62 } // namespace cc 64 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_sandwich.cc ('k') | cc/output/overlay_strategy_underlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698