Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_processor.h" | 5 #include "cc/output/overlay_processor.h" |
| 6 | 6 |
| 7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
| 8 #include "cc/output/overlay_strategy_single_on_top.h" | 8 #include "cc/output/overlay_strategy_single_on_top.h" |
| 9 #include "cc/output/overlay_strategy_underlay.h" | 9 #include "cc/output/overlay_strategy_underlay.h" |
| 10 #include "ui/gfx/geometry/rect_conversions.h" | 10 #include "ui/gfx/geometry/rect_conversions.h" |
| 11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { | 15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 void OverlayProcessor::Initialize() { | 18 void OverlayProcessor::Initialize() { |
| 19 DCHECK(surface_); | 19 DCHECK(surface_); |
| 20 OverlayCandidateValidator* validator = | 20 OverlayCandidateValidator* validator = |
| 21 surface_->GetOverlayCandidateValidator(); | 21 surface_->GetOverlayCandidateValidator(); |
| 22 if (validator) | 22 if (validator) |
| 23 validator->GetStrategies(&strategies_); | 23 validator->GetStrategies(&strategies_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 OverlayProcessor::~OverlayProcessor() {} | 26 OverlayProcessor::~OverlayProcessor() {} |
| 27 | 27 |
| 28 void OverlayProcessor::ProcessForOverlays( | 28 void OverlayProcessor::ProcessForOverlays( |
|
achaulk
2015/09/30 19:04:19
This doesn't always get called, because there are
| |
| 29 RenderPassList* render_passes_in_draw_order, | 29 RenderPassList* render_passes_in_draw_order, |
| 30 OverlayCandidateList* candidate_list) { | 30 OverlayCandidateList* candidate_list) { |
| 31 RenderPass* root_render_pass = render_passes_in_draw_order->back(); | |
| 32 DCHECK(root_render_pass); | |
| 33 | |
| 34 // If we had no validator, or it had no strategies, schedule no planes. | |
| 35 if (strategies_.empty()) | |
|
achaulk
2015/09/30 19:04:19
Having no strategies should be valid, but this wil
ccameron
2015/10/01 18:59:31
Moving the primary plane to DirectRenderer cleared
| |
| 36 return; | |
| 37 | |
| 38 // Create the overlay candidate for the primary surface, and mark it as always | |
| 39 // handled. | |
| 40 OverlayCandidate primary_surface; | |
| 41 primary_surface.display_rect = gfx::RectF(root_render_pass->output_rect); | |
|
achaulk
2015/09/30 19:04:19
This needs to be in texture coordinates, eg 0..1
ccameron
2015/10/01 18:59:31
Are you sure -- display_rect is read in GLRenderer
achaulk
2015/10/01 19:41:46
Oh right, this one is pixel coordinates. You do ne
ccameron
2015/10/01 21:08:48
That's done by the ctor at
https://code.google.co
| |
| 42 primary_surface.quad_rect_in_target_space = root_render_pass->output_rect; | |
| 43 primary_surface.use_output_surface_for_resource = true; | |
| 44 primary_surface.overlay_handled = true; | |
| 45 DCHECK(candidate_list->empty()); | |
| 46 candidate_list->push_back(primary_surface); | |
| 47 | |
| 31 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); | 48 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); |
| 32 ++it) { | 49 ++it) { |
| 33 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list, | 50 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list, |
| 34 surface_->device_scale_factor())) { | 51 surface_->device_scale_factor())) { |
| 35 return; | 52 return; |
| 36 } | 53 } |
| 37 } | 54 } |
| 38 } | 55 } |
| 39 | 56 |
| 40 } // namespace cc | 57 } // namespace cc |
| OLD | NEW |