| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 RenderPass::Id target_render_pass_id = | 591 RenderPass::Id target_render_pass_id = |
| 592 it.target_render_surface_layer()->render_surface()->RenderPassId(); | 592 it.target_render_surface_layer()->render_surface()->RenderPassId(); |
| 593 RenderPass* target_render_pass = | 593 RenderPass* target_render_pass = |
| 594 frame->render_passes_by_id[target_render_pass_id]; | 594 frame->render_passes_by_id[target_render_pass_id]; |
| 595 | 595 |
| 596 bool prevent_occlusion = | 596 bool prevent_occlusion = |
| 597 it.target_render_surface_layer()->HasRequestCopyCallback(); | 597 it.target_render_surface_layer()->HasRequestCopyCallback(); |
| 598 occlusion_tracker.EnterLayer(it, prevent_occlusion); | 598 occlusion_tracker.EnterLayer(it, prevent_occlusion); |
| 599 | 599 |
| 600 AppendQuadsData append_quads_data(target_render_pass->id); | 600 AppendQuadsData append_quads_data(target_render_pass->id); |
| 601 if (output_surface_->ForcedDrawToSoftwareDevice()) |
| 602 append_quads_data.allow_tile_draw_quads = false; |
| 601 | 603 |
| 602 if (it.represents_target_render_surface()) { | 604 if (it.represents_target_render_surface()) { |
| 603 if (it->HasRequestCopyCallback()) { | 605 if (it->HasRequestCopyCallback()) { |
| 604 have_copy_request = true; | 606 have_copy_request = true; |
| 605 it->TakeRequestCopyCallbacks(&target_render_pass->copy_callbacks); | 607 it->TakeRequestCopyCallbacks(&target_render_pass->copy_callbacks); |
| 606 } | 608 } |
| 607 } else if (it.represents_contributing_render_surface()) { | 609 } else if (it.represents_contributing_render_surface()) { |
| 608 RenderPass::Id contributing_render_pass_id = | 610 RenderPass::Id contributing_render_pass_id = |
| 609 it->render_surface()->RenderPassId(); | 611 it->render_surface()->RenderPassId(); |
| 610 RenderPass* contributing_render_pass = | 612 RenderPass* contributing_render_pass = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 active_tree_->background_color(), | 704 active_tree_->background_color(), |
| 703 occlusion_tracker); | 705 occlusion_tracker); |
| 704 } | 706 } |
| 705 | 707 |
| 706 if (draw_frame) | 708 if (draw_frame) |
| 707 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); | 709 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); |
| 708 else | 710 else |
| 709 DCHECK(!have_copy_request); | 711 DCHECK(!have_copy_request); |
| 710 | 712 |
| 711 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); | 713 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); |
| 712 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); | 714 if (!output_surface_->ForcedDrawToSoftwareDevice()) |
| 715 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
| 713 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), | 716 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), |
| 714 frame); | 717 frame); |
| 715 | 718 |
| 716 // If we're making a frame to draw, it better have at least one render pass. | 719 // If we're making a frame to draw, it better have at least one render pass. |
| 717 DCHECK(!frame->render_passes.empty()); | 720 DCHECK(!frame->render_passes.empty()); |
| 718 return draw_frame; | 721 return draw_frame; |
| 719 } | 722 } |
| 720 | 723 |
| 721 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( | 724 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( |
| 722 bool should_background_tick) { | 725 bool should_background_tick) { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 "cc.debug", "cc::LayerTreeHostImpl", this, | 1108 "cc.debug", "cc::LayerTreeHostImpl", this, |
| 1106 TracedValue::FromValue(AsValue().release())); | 1109 TracedValue::FromValue(AsValue().release())); |
| 1107 } | 1110 } |
| 1108 | 1111 |
| 1109 // Because the contents of the HUD depend on everything else in the frame, the | 1112 // Because the contents of the HUD depend on everything else in the frame, the |
| 1110 // contents of its texture are updated as the last thing before the frame is | 1113 // contents of its texture are updated as the last thing before the frame is |
| 1111 // drawn. | 1114 // drawn. |
| 1112 if (active_tree_->hud_layer()) | 1115 if (active_tree_->hud_layer()) |
| 1113 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); | 1116 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); |
| 1114 | 1117 |
| 1115 renderer_->DrawFrame(&frame->render_passes); | 1118 if (output_surface_->ForcedDrawToSoftwareDevice()) { |
| 1119 scoped_ptr<SoftwareRenderer> temp_software_renderer = |
| 1120 SoftwareRenderer::Create(this, output_surface_.get(), NULL); |
| 1121 temp_software_renderer->DrawFrame(&frame->render_passes); |
| 1122 } else { |
| 1123 renderer_->DrawFrame(&frame->render_passes); |
| 1124 } |
| 1116 // The render passes should be consumed by the renderer. | 1125 // The render passes should be consumed by the renderer. |
| 1117 DCHECK(frame->render_passes.empty()); | 1126 DCHECK(frame->render_passes.empty()); |
| 1118 frame->render_passes_by_id.clear(); | 1127 frame->render_passes_by_id.clear(); |
| 1119 | 1128 |
| 1120 // The next frame should start by assuming nothing has changed, and changes | 1129 // The next frame should start by assuming nothing has changed, and changes |
| 1121 // are noted as they occur. | 1130 // are noted as they occur. |
| 1122 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { | 1131 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { |
| 1123 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> | 1132 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> |
| 1124 DidDrawDamagedArea(); | 1133 DidDrawDamagedArea(); |
| 1125 } | 1134 } |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 } | 2161 } |
| 2153 | 2162 |
| 2154 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2163 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2155 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2164 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2156 paint_time_counter_->ClearHistory(); | 2165 paint_time_counter_->ClearHistory(); |
| 2157 | 2166 |
| 2158 debug_state_ = debug_state; | 2167 debug_state_ = debug_state; |
| 2159 } | 2168 } |
| 2160 | 2169 |
| 2161 } // namespace cc | 2170 } // namespace cc |
| OLD | NEW |