| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, | 191 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, |
| 192 float device_scale_factor, | 192 float device_scale_factor, |
| 193 const gfx::Rect& device_viewport_rect, | 193 const gfx::Rect& device_viewport_rect, |
| 194 const gfx::Rect& device_clip_rect, | 194 const gfx::Rect& device_clip_rect, |
| 195 bool disable_picture_quad_image_filtering) { | 195 bool disable_picture_quad_image_filtering) { |
| 196 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); | 196 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); |
| 197 UMA_HISTOGRAM_COUNTS( | 197 UMA_HISTOGRAM_COUNTS( |
| 198 "Renderer4.renderPassCount", | 198 "Renderer4.renderPassCount", |
| 199 base::saturated_cast<int>(render_passes_in_draw_order->size())); | 199 base::saturated_cast<int>(render_passes_in_draw_order->size())); |
| 200 | 200 |
| 201 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 201 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); |
| 253 } |
| 245 } | 254 } |
| 246 | 255 |
| 247 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | 256 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
| 248 RenderPass* pass = render_passes_in_draw_order->at(i); | 257 RenderPass* pass = render_passes_in_draw_order->at(i); |
| 249 DrawRenderPass(&frame, pass); | 258 DrawRenderPass(&frame, pass); |
| 250 | 259 |
| 251 for (ScopedPtrVector<CopyOutputRequest>::iterator it = | 260 for (ScopedPtrVector<CopyOutputRequest>::iterator it = |
| 252 pass->copy_requests.begin(); | 261 pass->copy_requests.begin(); |
| 253 it != pass->copy_requests.end(); | 262 it != pass->copy_requests.end(); |
| 254 ++it) { | 263 ++it) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 ScopedResource* texture = render_pass_textures_.get(id); | 546 ScopedResource* texture = render_pass_textures_.get(id); |
| 538 return texture && texture->id(); | 547 return texture && texture->id(); |
| 539 } | 548 } |
| 540 | 549 |
| 541 // static | 550 // static |
| 542 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 551 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 543 return render_pass->output_rect.size(); | 552 return render_pass->output_rect.size(); |
| 544 } | 553 } |
| 545 | 554 |
| 546 } // namespace cc | 555 } // namespace cc |
| OLD | NEW |