| 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 <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 overlay_processor_->Initialize(); | 80 overlay_processor_->Initialize(); |
| 81 | 81 |
| 82 auto* context_provider = output_surface_->context_provider(); | 82 auto* context_provider = output_surface_->context_provider(); |
| 83 | 83 |
| 84 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap(); | 84 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap(); |
| 85 allow_empty_swap_ = use_partial_swap_; | 85 allow_empty_swap_ = use_partial_swap_; |
| 86 if (context_provider && | 86 if (context_provider && |
| 87 context_provider->ContextCapabilities().commit_overlay_planes) | 87 context_provider->ContextCapabilities().commit_overlay_planes) |
| 88 allow_empty_swap_ = true; | 88 allow_empty_swap_ = true; |
| 89 | 89 |
| 90 overdraw_feedback_ = settings_->overdraw_feedback && |
| 91 output_surface_->capabilities().supports_stencil; |
| 92 LOG_IF(WARNING, overdraw_feedback_ != settings_->overdraw_feedback) |
| 93 << "Overdraw feedback enabled without output surface stencil support."; |
| 94 |
| 90 initialized_ = true; | 95 initialized_ = true; |
| 91 } | 96 } |
| 92 | 97 |
| 93 // static | 98 // static |
| 94 gfx::RectF DirectRenderer::QuadVertexRect() { | 99 gfx::RectF DirectRenderer::QuadVertexRect() { |
| 95 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); | 100 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); |
| 96 } | 101 } |
| 97 | 102 |
| 98 // static | 103 // static |
| 99 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, | 104 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 frame.root_damage_rect = root_render_pass->damage_rect; | 236 frame.root_damage_rect = root_render_pass->damage_rect; |
| 232 frame.root_damage_rect.Union(overlay_processor_->GetAndResetOverlayDamage()); | 237 frame.root_damage_rect.Union(overlay_processor_->GetAndResetOverlayDamage()); |
| 233 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_size)); | 238 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_size)); |
| 234 frame.device_viewport_size = device_viewport_size; | 239 frame.device_viewport_size = device_viewport_size; |
| 235 frame.device_color_space = device_color_space; | 240 frame.device_color_space = device_color_space; |
| 236 | 241 |
| 237 // Only reshape when we know we are going to draw. Otherwise, the reshape | 242 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 238 // can leave the window at the wrong size if we never draw and the proper | 243 // can leave the window at the wrong size if we never draw and the proper |
| 239 // viewport size is never set. | 244 // viewport size is never set. |
| 240 bool frame_has_alpha = frame.root_render_pass->has_transparent_background; | 245 bool frame_has_alpha = frame.root_render_pass->has_transparent_background; |
| 246 bool use_stencil = overdraw_feedback_; |
| 241 if (device_viewport_size != reshape_surface_size_ || | 247 if (device_viewport_size != reshape_surface_size_ || |
| 242 device_scale_factor != reshape_device_scale_factor_ || | 248 device_scale_factor != reshape_device_scale_factor_ || |
| 243 device_color_space != reshape_device_color_space_ || | 249 device_color_space != reshape_device_color_space_ || |
| 244 frame_has_alpha != reshape_has_alpha_) { | 250 frame_has_alpha != reshape_has_alpha_) { |
| 245 reshape_surface_size_ = device_viewport_size; | 251 reshape_surface_size_ = device_viewport_size; |
| 246 reshape_device_scale_factor_ = device_scale_factor; | 252 reshape_device_scale_factor_ = device_scale_factor; |
| 247 reshape_device_color_space_ = device_color_space; | 253 reshape_device_color_space_ = device_color_space; |
| 248 reshape_has_alpha_ = frame.root_render_pass->has_transparent_background; | 254 reshape_has_alpha_ = frame.root_render_pass->has_transparent_background; |
| 249 output_surface_->Reshape(reshape_surface_size_, | 255 output_surface_->Reshape( |
| 250 reshape_device_scale_factor_, | 256 reshape_surface_size_, reshape_device_scale_factor_, |
| 251 reshape_device_color_space_, reshape_has_alpha_); | 257 reshape_device_color_space_, reshape_has_alpha_, use_stencil); |
| 252 } | 258 } |
| 253 | 259 |
| 254 BeginDrawingFrame(&frame); | 260 BeginDrawingFrame(&frame); |
| 255 | 261 |
| 256 for (const auto& pass : *render_passes_in_draw_order) { | 262 for (const auto& pass : *render_passes_in_draw_order) { |
| 257 if (!pass->filters.IsEmpty()) | 263 if (!pass->filters.IsEmpty()) |
| 258 render_pass_filters_.push_back(std::make_pair(pass->id, &pass->filters)); | 264 render_pass_filters_.push_back(std::make_pair(pass->id, &pass->filters)); |
| 259 if (!pass->background_filters.IsEmpty()) { | 265 if (!pass->background_filters.IsEmpty()) { |
| 260 render_pass_background_filters_.push_back( | 266 render_pass_background_filters_.push_back( |
| 261 std::make_pair(pass->id, &pass->background_filters)); | 267 std::make_pair(pass->id, &pass->background_filters)); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 auto iter = render_pass_textures_.find(render_pass_id); | 614 auto iter = render_pass_textures_.find(render_pass_id); |
| 609 return iter != render_pass_textures_.end() && iter->second->id(); | 615 return iter != render_pass_textures_.end() && iter->second->id(); |
| 610 } | 616 } |
| 611 | 617 |
| 612 // static | 618 // static |
| 613 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 619 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 614 return render_pass->output_rect.size(); | 620 return render_pass->output_rect.size(); |
| 615 } | 621 } |
| 616 | 622 |
| 617 } // namespace cc | 623 } // namespace cc |
| OLD | NEW |