| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 201 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
| 202 DCHECK(root_render_pass); | 202 DCHECK(root_render_pass); |
| 203 | 203 |
| 204 DrawingFrame frame; | 204 DrawingFrame frame; |
| 205 frame.render_passes_in_draw_order = render_passes_in_draw_order; | 205 frame.render_passes_in_draw_order = render_passes_in_draw_order; |
| 206 frame.root_render_pass = root_render_pass; | 206 frame.root_render_pass = root_render_pass; |
| 207 frame.root_damage_rect = Capabilities().using_partial_swap | 207 frame.root_damage_rect = Capabilities().using_partial_swap |
| 208 ? root_render_pass->damage_rect | 208 ? root_render_pass->damage_rect |
| 209 : root_render_pass->output_rect; | 209 : root_render_pass->output_rect; |
| 210 frame.root_damage_rect.Union(next_root_damage_rect_); |
| 211 next_root_damage_rect_ = gfx::Rect(); |
| 210 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); | 212 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); |
| 211 frame.device_viewport_rect = device_viewport_rect; | 213 frame.device_viewport_rect = device_viewport_rect; |
| 212 frame.device_clip_rect = device_clip_rect; | 214 frame.device_clip_rect = device_clip_rect; |
| 213 frame.disable_picture_quad_image_filtering = | 215 frame.disable_picture_quad_image_filtering = |
| 214 disable_picture_quad_image_filtering; | 216 disable_picture_quad_image_filtering; |
| 215 | 217 |
| 216 EnsureBackbuffer(); | 218 EnsureBackbuffer(); |
| 217 | 219 |
| 218 // Only reshape when we know we are going to draw. Otherwise, the reshape | 220 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 219 // can leave the window at the wrong size if we never draw and the proper | 221 // can leave the window at the wrong size if we never draw and the proper |
| (...skipping 12 matching lines...) Expand all Loading... |
| 232 output_surface_plane.quad_rect_in_target_space = | 234 output_surface_plane.quad_rect_in_target_space = |
| 233 root_render_pass->output_rect; | 235 root_render_pass->output_rect; |
| 234 output_surface_plane.use_output_surface_for_resource = true; | 236 output_surface_plane.use_output_surface_for_resource = true; |
| 235 output_surface_plane.overlay_handled = true; | 237 output_surface_plane.overlay_handled = true; |
| 236 frame.overlay_list.push_back(output_surface_plane); | 238 frame.overlay_list.push_back(output_surface_plane); |
| 237 } | 239 } |
| 238 | 240 |
| 239 // If we have any copy requests, we can't remove any quads for overlays, | 241 // If we have any copy requests, we can't remove any quads for overlays, |
| 240 // otherwise the framebuffer will be missing the overlay contents. | 242 // otherwise the framebuffer will be missing the overlay contents. |
| 241 if (root_render_pass->copy_requests.empty()) { | 243 if (root_render_pass->copy_requests.empty()) { |
| 242 overlay_processor_->ProcessForOverlays( | 244 if (overlay_processor_->ProcessForCALayers( |
| 243 resource_provider_, render_passes_in_draw_order, &frame.overlay_list, | 245 resource_provider_, render_passes_in_draw_order, |
| 244 &frame.root_damage_rect); | 246 &frame.ca_layer_overlay_list, &frame.overlay_list)) { |
| 247 // Ensure that the next frame to use the backbuffer will do a full redraw. |
| 248 next_root_damage_rect_.Union(root_render_pass->output_rect); |
| 249 } else { |
| 250 overlay_processor_->ProcessForOverlays( |
| 251 resource_provider_, render_passes_in_draw_order, &frame.overlay_list, |
| 252 &frame.root_damage_rect); |
| 245 | 253 |
| 246 // No need to render in case the damage rect is completely composited using | 254 // No need to render in case the damage rect is completely composited |
| 247 // overlays and dont have any copy requests. | 255 // using |
| 248 if (frame.root_damage_rect.IsEmpty()) { | 256 // overlays and dont have any copy requests. |
| 249 bool handle_copy_requests = false; | 257 if (frame.root_damage_rect.IsEmpty()) { |
| 250 for (auto* pass : *render_passes_in_draw_order) { | 258 bool handle_copy_requests = false; |
| 251 if (!pass->copy_requests.empty()) { | 259 for (auto* pass : *render_passes_in_draw_order) { |
| 252 handle_copy_requests = true; | 260 if (!pass->copy_requests.empty()) { |
| 253 break; | 261 handle_copy_requests = true; |
| 262 break; |
| 263 } |
| 254 } | 264 } |
| 255 } | |
| 256 | 265 |
| 257 if (!handle_copy_requests) { | 266 if (!handle_copy_requests) { |
| 258 BindFramebufferToOutputSurface(&frame); | 267 BindFramebufferToOutputSurface(&frame); |
| 259 FinishDrawingFrame(&frame); | 268 FinishDrawingFrame(&frame); |
| 260 render_passes_in_draw_order->clear(); | 269 render_passes_in_draw_order->clear(); |
| 261 return; | 270 return; |
| 271 } |
| 272 overlay_processor_->ProcessForOverlays( |
| 273 resource_provider_, render_passes_in_draw_order, |
| 274 &frame.overlay_list, &frame.root_damage_rect); |
| 262 } | 275 } |
| 263 } | 276 } |
| 264 } | 277 } |
| 265 | 278 |
| 266 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | 279 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
| 267 RenderPass* pass = render_passes_in_draw_order->at(i); | 280 RenderPass* pass = render_passes_in_draw_order->at(i); |
| 268 DrawRenderPass(&frame, pass); | 281 DrawRenderPass(&frame, pass); |
| 269 | 282 |
| 270 for (ScopedPtrVector<CopyOutputRequest>::iterator it = | 283 for (ScopedPtrVector<CopyOutputRequest>::iterator it = |
| 271 pass->copy_requests.begin(); | 284 pass->copy_requests.begin(); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 ScopedResource* texture = render_pass_textures_.get(id); | 570 ScopedResource* texture = render_pass_textures_.get(id); |
| 558 return texture && texture->id(); | 571 return texture && texture->id(); |
| 559 } | 572 } |
| 560 | 573 |
| 561 // static | 574 // static |
| 562 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 575 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 563 return render_pass->output_rect.size(); | 576 return render_pass->output_rect.size(); |
| 564 } | 577 } |
| 565 | 578 |
| 566 } // namespace cc | 579 } // namespace cc |
| OLD | NEW |