| 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/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 capabilities_.max_msaa_samples = caps.gpu.max_samples; | 59 capabilities_.max_msaa_samples = caps.gpu.max_samples; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 DelegatingRenderer::~DelegatingRenderer() {} | 63 DelegatingRenderer::~DelegatingRenderer() {} |
| 64 | 64 |
| 65 const RendererCapabilitiesImpl& DelegatingRenderer::Capabilities() const { | 65 const RendererCapabilitiesImpl& DelegatingRenderer::Capabilities() const { |
| 66 return capabilities_; | 66 return capabilities_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void DelegatingRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, | 69 DrawFrameResult DelegatingRenderer::DrawFrame( |
| 70 float device_scale_factor, | 70 RenderPassList* render_passes_in_draw_order, |
| 71 const gfx::Rect& device_viewport_rect, | 71 float device_scale_factor, |
| 72 const gfx::Rect& device_clip_rect, | 72 const gfx::Rect& device_viewport_rect, |
| 73 bool disable_picture_quad_image_filtering) { | 73 const gfx::Rect& device_clip_rect, |
| 74 bool disable_picture_quad_image_filtering) { |
| 74 TRACE_EVENT0("cc", "DelegatingRenderer::DrawFrame"); | 75 TRACE_EVENT0("cc", "DelegatingRenderer::DrawFrame"); |
| 75 | 76 |
| 76 DCHECK(!delegated_frame_data_); | 77 DCHECK(!delegated_frame_data_); |
| 77 | 78 |
| 78 delegated_frame_data_ = make_scoped_ptr(new DelegatedFrameData); | 79 delegated_frame_data_ = make_scoped_ptr(new DelegatedFrameData); |
| 79 DelegatedFrameData& out_data = *delegated_frame_data_; | 80 DelegatedFrameData& out_data = *delegated_frame_data_; |
| 80 out_data.device_scale_factor = device_scale_factor; | 81 out_data.device_scale_factor = device_scale_factor; |
| 81 // Move the render passes and resources into the |out_frame|. | 82 // Move the render passes and resources into the |out_frame|. |
| 82 out_data.render_pass_list.swap(*render_passes_in_draw_order); | 83 out_data.render_pass_list.swap(*render_passes_in_draw_order); |
| 83 | 84 |
| 84 // Collect all resource ids in the render passes into a ResourceIdArray. | 85 // Collect all resource ids in the render passes into a ResourceIdArray. |
| 85 ResourceProvider::ResourceIdArray resources; | 86 ResourceProvider::ResourceIdArray resources; |
| 86 for (const auto& render_pass : out_data.render_pass_list) { | 87 for (const auto& render_pass : out_data.render_pass_list) { |
| 87 for (const auto& quad : render_pass->quad_list) { | 88 for (const auto& quad : render_pass->quad_list) { |
| 88 for (ResourceId resource_id : quad->resources) | 89 for (ResourceId resource_id : quad->resources) |
| 89 resources.push_back(resource_id); | 90 resources.push_back(resource_id); |
| 90 } | 91 } |
| 91 } | 92 } |
| 92 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); | 93 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); |
| 94 return DrawFrameResult::DID_DRAW; |
| 93 } | 95 } |
| 94 | 96 |
| 95 void DelegatingRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { | 97 void DelegatingRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { |
| 96 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); | 98 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); |
| 97 CompositorFrame compositor_frame; | 99 CompositorFrame compositor_frame; |
| 98 compositor_frame.metadata = metadata; | 100 compositor_frame.metadata = metadata; |
| 99 compositor_frame.delegated_frame_data = std::move(delegated_frame_data_); | 101 compositor_frame.delegated_frame_data = std::move(delegated_frame_data_); |
| 100 output_surface_->SwapBuffers(&compositor_frame); | 102 output_surface_->SwapBuffers(&compositor_frame); |
| 101 } | 103 } |
| 102 | 104 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 120 if (context_provider) { | 122 if (context_provider) { |
| 121 context_provider->ContextSupport()->SetSurfaceVisible(visible()); | 123 context_provider->ContextSupport()->SetSurfaceVisible(visible()); |
| 122 | 124 |
| 123 // If we are not visible, we ask the context to aggressively free resources. | 125 // If we are not visible, we ask the context to aggressively free resources. |
| 124 context_provider->ContextSupport()->SetAggressivelyFreeResources( | 126 context_provider->ContextSupport()->SetAggressivelyFreeResources( |
| 125 !visible()); | 127 !visible()); |
| 126 } | 128 } |
| 127 } | 129 } |
| 128 | 130 |
| 129 } // namespace cc | 131 } // namespace cc |
| OLD | NEW |