| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/pixel_test_delegating_output_surface.h" | 5 #include "cc/test/pixel_test_delegating_output_surface.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 delegated_surface_id_ = surface_id_allocator_->GenerateId(); | 127 delegated_surface_id_ = surface_id_allocator_->GenerateId(); |
| 128 surface_factory_->Create(delegated_surface_id_); | 128 surface_factory_->Create(delegated_surface_id_); |
| 129 } | 129 } |
| 130 display_->SetSurfaceId(delegated_surface_id_, | 130 display_->SetSurfaceId(delegated_surface_id_, |
| 131 frame.metadata.device_scale_factor); | 131 frame.metadata.device_scale_factor); |
| 132 | 132 |
| 133 gfx::Size frame_size = | 133 gfx::Size frame_size = |
| 134 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); | 134 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 135 display_->Resize(frame_size); | 135 display_->Resize(frame_size); |
| 136 | 136 |
| 137 std::unique_ptr<CompositorFrame> frame_copy(new CompositorFrame); | |
| 138 *frame_copy = std::move(frame); | |
| 139 surface_factory_->SubmitCompositorFrame( | 137 surface_factory_->SubmitCompositorFrame( |
| 140 delegated_surface_id_, std::move(frame_copy), | 138 delegated_surface_id_, std::move(frame), |
| 141 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback, | 139 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback, |
| 142 weak_ptrs_.GetWeakPtr())); | 140 weak_ptrs_.GetWeakPtr())); |
| 143 | 141 |
| 144 if (synchronous_composite_) | 142 if (synchronous_composite_) |
| 145 display_->DrawAndSwap(); | 143 display_->DrawAndSwap(); |
| 146 } | 144 } |
| 147 | 145 |
| 148 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount( | 146 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount( |
| 149 const gfx::Size& amount) { | 147 const gfx::Size& amount) { |
| 150 DCHECK(!HasClient()); | 148 DCHECK(!HasClient()); |
| 151 enlarge_pass_texture_amount_ = amount; | 149 enlarge_pass_texture_amount_ = amount; |
| 152 } | 150 } |
| 153 | 151 |
| 154 void PixelTestDelegatingOutputSurface::DrawCallback(SurfaceDrawStatus) { | 152 void PixelTestDelegatingOutputSurface::DrawCallback(SurfaceDrawStatus) { |
| 155 client_->DidSwapBuffersComplete(); | 153 client_->DidSwapBuffersComplete(); |
| 156 } | 154 } |
| 157 | 155 |
| 158 void PixelTestDelegatingOutputSurface::ForceReclaimResources() { | 156 void PixelTestDelegatingOutputSurface::ForceReclaimResources() { |
| 159 if (allow_force_reclaim_resources_ && !delegated_surface_id_.is_null()) { | 157 if (allow_force_reclaim_resources_ && !delegated_surface_id_.is_null()) { |
| 160 surface_factory_->SubmitCompositorFrame(delegated_surface_id_, nullptr, | 158 surface_factory_->SubmitCompositorFrame(delegated_surface_id_, |
| 159 CompositorFrame(), |
| 161 SurfaceFactory::DrawCallback()); | 160 SurfaceFactory::DrawCallback()); |
| 162 } | 161 } |
| 163 } | 162 } |
| 164 | 163 |
| 165 void PixelTestDelegatingOutputSurface::BindFramebuffer() { | 164 void PixelTestDelegatingOutputSurface::BindFramebuffer() { |
| 166 // This is a delegating output surface, no framebuffer/direct drawing support. | 165 // This is a delegating output surface, no framebuffer/direct drawing support. |
| 167 NOTREACHED(); | 166 NOTREACHED(); |
| 168 } | 167 } |
| 169 | 168 |
| 170 uint32_t PixelTestDelegatingOutputSurface::GetFramebufferCopyTextureFormat() { | 169 uint32_t PixelTestDelegatingOutputSurface::GetFramebufferCopyTextureFormat() { |
| 171 // This is a delegating output surface, no framebuffer/direct drawing support. | 170 // This is a delegating output surface, no framebuffer/direct drawing support. |
| 172 NOTREACHED(); | 171 NOTREACHED(); |
| 173 return 0; | 172 return 0; |
| 174 } | 173 } |
| 175 | 174 |
| 176 void PixelTestDelegatingOutputSurface::ReturnResources( | 175 void PixelTestDelegatingOutputSurface::ReturnResources( |
| 177 const ReturnedResourceArray& resources) { | 176 const ReturnedResourceArray& resources) { |
| 178 CompositorFrameAck ack; | 177 CompositorFrameAck ack; |
| 179 ack.resources = resources; | 178 ack.resources = resources; |
| 180 client_->ReclaimResources(&ack); | 179 client_->ReclaimResources(&ack); |
| 181 } | 180 } |
| 182 | 181 |
| 183 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( | 182 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( |
| 184 BeginFrameSource* begin_frame_source) { | 183 BeginFrameSource* begin_frame_source) { |
| 185 client_->SetBeginFrameSource(begin_frame_source); | 184 client_->SetBeginFrameSource(begin_frame_source); |
| 186 } | 185 } |
| 187 | 186 |
| 188 } // namespace cc | 187 } // namespace cc |
| OLD | NEW |