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