Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/direct_renderer.h" | 5 #include "cc/output/direct_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 overlay_processor_->GetAndResetOverlayDamage()); | 260 overlay_processor_->GetAndResetOverlayDamage()); |
| 261 current_frame()->root_damage_rect.Intersect(gfx::Rect(device_viewport_size)); | 261 current_frame()->root_damage_rect.Intersect(gfx::Rect(device_viewport_size)); |
| 262 current_frame()->device_viewport_size = device_viewport_size; | 262 current_frame()->device_viewport_size = device_viewport_size; |
| 263 | 263 |
| 264 // Only reshape when we know we are going to draw. Otherwise, the reshape | 264 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 265 // can leave the window at the wrong size if we never draw and the proper | 265 // can leave the window at the wrong size if we never draw and the proper |
| 266 // viewport size is never set. | 266 // viewport size is never set. |
| 267 bool frame_has_alpha = | 267 bool frame_has_alpha = |
| 268 current_frame()->root_render_pass->has_transparent_background; | 268 current_frame()->root_render_pass->has_transparent_background; |
| 269 bool use_stencil = overdraw_feedback_; | 269 bool use_stencil = overdraw_feedback_; |
| 270 bool was_reshaped = false; | |
| 270 if (device_viewport_size != reshape_surface_size_ || | 271 if (device_viewport_size != reshape_surface_size_ || |
| 271 device_scale_factor != reshape_device_scale_factor_ || | 272 device_scale_factor != reshape_device_scale_factor_ || |
| 272 root_render_pass->color_space != reshape_device_color_space_ || | 273 root_render_pass->color_space != reshape_device_color_space_ || |
| 273 frame_has_alpha != reshape_has_alpha_ || | 274 frame_has_alpha != reshape_has_alpha_ || |
| 274 use_stencil != reshape_use_stencil_) { | 275 use_stencil != reshape_use_stencil_) { |
| 275 reshape_surface_size_ = device_viewport_size; | 276 reshape_surface_size_ = device_viewport_size; |
| 276 reshape_device_scale_factor_ = device_scale_factor; | 277 reshape_device_scale_factor_ = device_scale_factor; |
| 277 reshape_device_color_space_ = root_render_pass->color_space; | 278 reshape_device_color_space_ = root_render_pass->color_space; |
| 278 reshape_has_alpha_ = | 279 reshape_has_alpha_ = |
| 279 current_frame()->root_render_pass->has_transparent_background; | 280 current_frame()->root_render_pass->has_transparent_background; |
| 280 reshape_use_stencil_ = overdraw_feedback_; | 281 reshape_use_stencil_ = overdraw_feedback_; |
| 281 output_surface_->Reshape( | 282 output_surface_->Reshape( |
| 282 reshape_surface_size_, reshape_device_scale_factor_, | 283 reshape_surface_size_, reshape_device_scale_factor_, |
| 283 reshape_device_color_space_, reshape_has_alpha_, reshape_use_stencil_); | 284 reshape_device_color_space_, reshape_has_alpha_, reshape_use_stencil_); |
| 285 was_reshaped = true; | |
|
ccameron
2017/05/11 08:49:17
Would it be easier call something like
overlay_p
| |
| 284 } | 286 } |
| 285 | 287 |
| 286 BeginDrawingFrame(); | 288 BeginDrawingFrame(); |
| 287 | 289 |
| 288 for (const auto& pass : *render_passes_in_draw_order) { | 290 for (const auto& pass : *render_passes_in_draw_order) { |
| 289 if (!pass->filters.IsEmpty()) | 291 if (!pass->filters.IsEmpty()) |
| 290 render_pass_filters_[pass->id] = &pass->filters; | 292 render_pass_filters_[pass->id] = &pass->filters; |
| 291 if (!pass->background_filters.IsEmpty()) | 293 if (!pass->background_filters.IsEmpty()) |
| 292 render_pass_background_filters_[pass->id] = &pass->background_filters; | 294 render_pass_background_filters_[pass->id] = &pass->background_filters; |
| 293 } | 295 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 308 output_surface_plane.quad_rect_in_target_space = | 310 output_surface_plane.quad_rect_in_target_space = |
| 309 root_render_pass->output_rect; | 311 root_render_pass->output_rect; |
| 310 output_surface_plane.use_output_surface_for_resource = true; | 312 output_surface_plane.use_output_surface_for_resource = true; |
| 311 output_surface_plane.overlay_handled = true; | 313 output_surface_plane.overlay_handled = true; |
| 312 current_frame()->overlay_list.push_back(output_surface_plane); | 314 current_frame()->overlay_list.push_back(output_surface_plane); |
| 313 } | 315 } |
| 314 | 316 |
| 315 // Attempt to replace some or all of the quads of the root render pass with | 317 // Attempt to replace some or all of the quads of the root render pass with |
| 316 // overlays. | 318 // overlays. |
| 317 overlay_processor_->ProcessForOverlays( | 319 overlay_processor_->ProcessForOverlays( |
| 318 resource_provider_, root_render_pass, render_pass_filters_, | 320 resource_provider_, root_render_pass, was_reshaped, render_pass_filters_, |
| 319 render_pass_background_filters_, ¤t_frame()->overlay_list, | 321 render_pass_background_filters_, ¤t_frame()->overlay_list, |
| 320 ¤t_frame()->ca_layer_overlay_list, | 322 ¤t_frame()->ca_layer_overlay_list, |
| 321 ¤t_frame()->dc_layer_overlay_list, | 323 ¤t_frame()->dc_layer_overlay_list, |
| 322 ¤t_frame()->root_damage_rect, | 324 ¤t_frame()->root_damage_rect, |
| 323 ¤t_frame()->root_content_bounds); | 325 ¤t_frame()->root_content_bounds); |
| 324 bool was_using_dc_layers = using_dc_layers_; | 326 bool was_using_dc_layers = using_dc_layers_; |
| 325 if (!current_frame()->dc_layer_overlay_list.empty()) { | 327 if (!current_frame()->dc_layer_overlay_list.empty()) { |
| 326 DCHECK(supports_dc_layers_); | 328 DCHECK(supports_dc_layers_); |
| 327 using_dc_layers_ = true; | 329 using_dc_layers_ = true; |
| 328 frames_since_using_dc_layers_ = 0; | 330 frames_since_using_dc_layers_ = 0; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 642 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 641 return render_pass->output_rect.size(); | 643 return render_pass->output_rect.size(); |
| 642 } | 644 } |
| 643 | 645 |
| 644 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { | 646 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { |
| 645 current_frame_valid_ = true; | 647 current_frame_valid_ = true; |
| 646 current_frame_ = frame; | 648 current_frame_ = frame; |
| 647 } | 649 } |
| 648 | 650 |
| 649 } // namespace cc | 651 } // namespace cc |
| OLD | NEW |