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

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

Issue 1376883004: Overlays: Remove special casing of primary overlay plane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missed file 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
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
43 bool created_overlay = false; 37 bool created_overlay = false;
44 QuadList& quad_list = root_render_pass->quad_list; 38 QuadList& quad_list = root_render_pass->quad_list;
45 for (auto it = quad_list.begin(); it != quad_list.end();) { 39 for (auto it = quad_list.begin(); it != quad_list.end();) {
46 OverlayCandidate candidate; 40 OverlayCandidate candidate;
47 if (!GetCandidateQuadInfo(**it, &candidate)) { 41 if (!GetCandidateQuadInfo(**it, &candidate)) {
48 ++it; 42 ++it;
49 continue; 43 continue;
50 } 44 }
51 45
52 OverlayResult result = delegate_->TryOverlay( 46 OverlayResult result = delegate_->TryOverlay(
53 capability_checker_, render_passes_in_draw_order, candidate_list, 47 capability_checker_, render_passes_in_draw_order, candidate_list,
54 candidate, &it, device_scale_factor); 48 candidate, &it, device_scale_factor);
55 switch (result) { 49 switch (result) {
56 case DID_NOT_CREATE_OVERLAY: 50 case DID_NOT_CREATE_OVERLAY:
57 ++it; 51 ++it;
58 break; 52 break;
59 case CREATED_OVERLAY_STOP_LOOKING: 53 case CREATED_OVERLAY_STOP_LOOKING:
60 return true; 54 return true;
61 case CREATED_OVERLAY_KEEP_LOOKING: 55 case CREATED_OVERLAY_KEEP_LOOKING:
62 created_overlay = true; 56 created_overlay = true;
63 break; 57 break;
64 } 58 }
65 } 59 }
66 60
67 if (!created_overlay) {
68 DCHECK_EQ(1u, candidate_list->size());
69 candidate_list->clear();
70 }
71
72 return created_overlay; 61 return created_overlay;
73 } 62 }
74 63
75 // static 64 // static
76 bool OverlayStrategyCommon::IsInvisibleQuad(const DrawQuad* draw_quad) { 65 bool OverlayStrategyCommon::IsInvisibleQuad(const DrawQuad* draw_quad) {
77 if (draw_quad->material == DrawQuad::SOLID_COLOR) { 66 if (draw_quad->material == DrawQuad::SOLID_COLOR) {
78 const SolidColorDrawQuad* solid_quad = 67 const SolidColorDrawQuad* solid_quad =
79 SolidColorDrawQuad::MaterialCast(draw_quad); 68 SolidColorDrawQuad::MaterialCast(draw_quad);
80 SkColor color = solid_quad->color; 69 SkColor color = solid_quad->color;
81 float opacity = solid_quad->shared_quad_state->opacity; 70 float opacity = solid_quad->shared_quad_state->opacity;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 quad_info->display_rect = OverlayCandidate::GetOverlayRect( 185 quad_info->display_rect = OverlayCandidate::GetOverlayRect(
197 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); 186 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect);
198 quad_info->quad_rect_in_target_space = MathUtil::MapEnclosingClippedRect( 187 quad_info->quad_rect_in_target_space = MathUtil::MapEnclosingClippedRect(
199 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); 188 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect);
200 quad_info->clip_rect = draw_quad.shared_quad_state->clip_rect; 189 quad_info->clip_rect = draw_quad.shared_quad_state->clip_rect;
201 quad_info->is_clipped = draw_quad.shared_quad_state->is_clipped; 190 quad_info->is_clipped = draw_quad.shared_quad_state->is_clipped;
202 return true; 191 return true;
203 } 192 }
204 193
205 } // namespace cc 194 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698