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

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

Issue 1383293002: Revert of Overlays: Remove special casing of primary overlay plane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/output_surface.cc ('k') | cc/output/overlay_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_common.h" 5 #include "cc/output/overlay_strategy_common.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/quads/io_surface_draw_quad.h" 10 #include "cc/quads/io_surface_draw_quad.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order, 29 bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order,
30 OverlayCandidateList* candidate_list, 30 OverlayCandidateList* candidate_list,
31 float device_scale_factor) { 31 float device_scale_factor) {
32 if (!capability_checker_) 32 if (!capability_checker_)
33 return false; 33 return false;
34 RenderPass* root_render_pass = render_passes_in_draw_order->back(); 34 RenderPass* root_render_pass = render_passes_in_draw_order->back();
35 DCHECK(root_render_pass); 35 DCHECK(root_render_pass);
36 36
37 // Add our primary surface.
38 OverlayCandidate main_image;
39 main_image.display_rect = gfx::RectF(root_render_pass->output_rect);
40 DCHECK(candidate_list->empty());
41 candidate_list->push_back(main_image);
42
37 bool created_overlay = false; 43 bool created_overlay = false;
38 QuadList& quad_list = root_render_pass->quad_list; 44 QuadList& quad_list = root_render_pass->quad_list;
39 for (auto it = quad_list.begin(); it != quad_list.end();) { 45 for (auto it = quad_list.begin(); it != quad_list.end();) {
40 OverlayCandidate candidate; 46 OverlayCandidate candidate;
41 if (!GetCandidateQuadInfo(**it, &candidate)) { 47 if (!GetCandidateQuadInfo(**it, &candidate)) {
42 ++it; 48 ++it;
43 continue; 49 continue;
44 } 50 }
45 51
46 OverlayResult result = delegate_->TryOverlay( 52 OverlayResult result = delegate_->TryOverlay(
47 capability_checker_, render_passes_in_draw_order, candidate_list, 53 capability_checker_, render_passes_in_draw_order, candidate_list,
48 candidate, &it, device_scale_factor); 54 candidate, &it, device_scale_factor);
49 switch (result) { 55 switch (result) {
50 case DID_NOT_CREATE_OVERLAY: 56 case DID_NOT_CREATE_OVERLAY:
51 ++it; 57 ++it;
52 break; 58 break;
53 case CREATED_OVERLAY_STOP_LOOKING: 59 case CREATED_OVERLAY_STOP_LOOKING:
54 return true; 60 return true;
55 case CREATED_OVERLAY_KEEP_LOOKING: 61 case CREATED_OVERLAY_KEEP_LOOKING:
56 created_overlay = true; 62 created_overlay = true;
57 break; 63 break;
58 } 64 }
59 } 65 }
60 66
67 if (!created_overlay) {
68 DCHECK_EQ(1u, candidate_list->size());
69 candidate_list->clear();
70 }
71
61 return created_overlay; 72 return created_overlay;
62 } 73 }
63 74
64 // static 75 // static
65 bool OverlayStrategyCommon::IsInvisibleQuad(const DrawQuad* draw_quad) { 76 bool OverlayStrategyCommon::IsInvisibleQuad(const DrawQuad* draw_quad) {
66 if (draw_quad->material == DrawQuad::SOLID_COLOR) { 77 if (draw_quad->material == DrawQuad::SOLID_COLOR) {
67 const SolidColorDrawQuad* solid_quad = 78 const SolidColorDrawQuad* solid_quad =
68 SolidColorDrawQuad::MaterialCast(draw_quad); 79 SolidColorDrawQuad::MaterialCast(draw_quad);
69 SkColor color = solid_quad->color; 80 SkColor color = solid_quad->color;
70 float opacity = solid_quad->shared_quad_state->opacity; 81 float opacity = solid_quad->shared_quad_state->opacity;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 quad_info->display_rect = OverlayCandidate::GetOverlayRect( 196 quad_info->display_rect = OverlayCandidate::GetOverlayRect(
186 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); 197 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect);
187 quad_info->quad_rect_in_target_space = MathUtil::MapEnclosingClippedRect( 198 quad_info->quad_rect_in_target_space = MathUtil::MapEnclosingClippedRect(
188 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); 199 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect);
189 quad_info->clip_rect = draw_quad.shared_quad_state->clip_rect; 200 quad_info->clip_rect = draw_quad.shared_quad_state->clip_rect;
190 quad_info->is_clipped = draw_quad.shared_quad_state->is_clipped; 201 quad_info->is_clipped = draw_quad.shared_quad_state->is_clipped;
191 return true; 202 return true;
192 } 203 }
193 204
194 } // namespace cc 205 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698