| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 window_rect.set_y(current_surface_size_.height() - window_rect.bottom()); | 126 window_rect.set_y(current_surface_size_.height() - window_rect.bottom()); |
| 127 return window_rect; | 127 return window_rect; |
| 128 } | 128 } |
| 129 | 129 |
| 130 DirectRenderer::DirectRenderer(RendererClient* client, | 130 DirectRenderer::DirectRenderer(RendererClient* client, |
| 131 const LayerTreeSettings* settings, | 131 const LayerTreeSettings* settings, |
| 132 OutputSurface* output_surface, | 132 OutputSurface* output_surface, |
| 133 ResourceProvider* resource_provider) | 133 ResourceProvider* resource_provider) |
| 134 : Renderer(client, settings), | 134 : Renderer(client, settings), |
| 135 output_surface_(output_surface), | 135 output_surface_(output_surface), |
| 136 resource_provider_(resource_provider) {} | 136 resource_provider_(resource_provider), |
| 137 overlay_processor_( |
| 138 new OverlayProcessor(output_surface, resource_provider)) { |
| 139 overlay_processor_->Initialize(); |
| 140 } |
| 137 | 141 |
| 138 DirectRenderer::~DirectRenderer() {} | 142 DirectRenderer::~DirectRenderer() {} |
| 139 | 143 |
| 140 bool DirectRenderer::CanReadPixels() const { return true; } | 144 bool DirectRenderer::CanReadPixels() const { return true; } |
| 141 | 145 |
| 142 void DirectRenderer::SetEnlargePassTextureAmountForTesting( | 146 void DirectRenderer::SetEnlargePassTextureAmountForTesting( |
| 143 const gfx::Vector2d& amount) { | 147 const gfx::Vector2d& amount) { |
| 144 enlarge_pass_texture_amount_ = amount; | 148 enlarge_pass_texture_amount_ = amount; |
| 145 } | 149 } |
| 146 | 150 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 frame.root_damage_rect = Capabilities().using_partial_swap | 215 frame.root_damage_rect = Capabilities().using_partial_swap |
| 212 ? root_render_pass->damage_rect | 216 ? root_render_pass->damage_rect |
| 213 : root_render_pass->output_rect; | 217 : root_render_pass->output_rect; |
| 214 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); | 218 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); |
| 215 frame.device_viewport_rect = device_viewport_rect; | 219 frame.device_viewport_rect = device_viewport_rect; |
| 216 frame.device_clip_rect = device_clip_rect; | 220 frame.device_clip_rect = device_clip_rect; |
| 217 frame.offscreen_context_provider = offscreen_context_provider; | 221 frame.offscreen_context_provider = offscreen_context_provider; |
| 218 frame.disable_picture_quad_image_filtering = | 222 frame.disable_picture_quad_image_filtering = |
| 219 disable_picture_quad_image_filtering; | 223 disable_picture_quad_image_filtering; |
| 220 | 224 |
| 225 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order, |
| 226 &frame.overlay_list); |
| 227 |
| 221 EnsureBackbuffer(); | 228 EnsureBackbuffer(); |
| 222 | 229 |
| 223 // Only reshape when we know we are going to draw. Otherwise, the reshape | 230 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 224 // can leave the window at the wrong size if we never draw and the proper | 231 // can leave the window at the wrong size if we never draw and the proper |
| 225 // viewport size is never set. | 232 // viewport size is never set. |
| 226 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); | 233 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); |
| 227 | 234 |
| 228 BeginDrawingFrame(&frame); | 235 BeginDrawingFrame(&frame); |
| 229 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | 236 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
| 230 RenderPass* pass = render_passes_in_draw_order->at(i); | 237 RenderPass* pass = render_passes_in_draw_order->at(i); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 ScopedResource* texture = render_pass_textures_.get(id); | 455 ScopedResource* texture = render_pass_textures_.get(id); |
| 449 return texture && texture->id(); | 456 return texture && texture->id(); |
| 450 } | 457 } |
| 451 | 458 |
| 452 // static | 459 // static |
| 453 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 460 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 454 return render_pass->output_rect.size(); | 461 return render_pass->output_rect.size(); |
| 455 } | 462 } |
| 456 | 463 |
| 457 } // namespace cc | 464 } // namespace cc |
| OLD | NEW |