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