| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_output_surface.h" | 5 #include "cc/test/pixel_test_output_surface.h" |
| 6 | 6 |
| 7 #include "cc/output/output_surface_client.h" | 7 #include "cc/output/output_surface_client.h" |
| 8 #include "cc/scheduler/begin_frame_source.h" |
| 8 #include "ui/gfx/transform.h" | 9 #include "ui/gfx/transform.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 PixelTestOutputSurface::PixelTestOutputSurface( | 13 PixelTestOutputSurface::PixelTestOutputSurface( |
| 13 scoped_refptr<ContextProvider> context_provider, | 14 scoped_refptr<ContextProvider> context_provider, |
| 14 scoped_refptr<ContextProvider> worker_context_provider, | 15 scoped_refptr<ContextProvider> worker_context_provider, |
| 15 bool flipped_output_surface) | 16 bool flipped_output_surface, |
| 17 scoped_ptr<BeginFrameSource> begin_frame_source) |
| 16 : OutputSurface(context_provider, worker_context_provider), | 18 : OutputSurface(context_provider, worker_context_provider), |
| 19 begin_frame_source_(std::move(begin_frame_source)), |
| 17 external_stencil_test_(false) { | 20 external_stencil_test_(false) { |
| 18 capabilities_.adjust_deadline_for_parent = false; | 21 capabilities_.adjust_deadline_for_parent = false; |
| 19 capabilities_.flipped_output_surface = flipped_output_surface; | 22 capabilities_.flipped_output_surface = flipped_output_surface; |
| 20 } | 23 } |
| 21 | 24 |
| 22 PixelTestOutputSurface::PixelTestOutputSurface( | 25 PixelTestOutputSurface::PixelTestOutputSurface( |
| 23 scoped_refptr<ContextProvider> context_provider, | 26 scoped_refptr<ContextProvider> context_provider, |
| 24 bool flipped_output_surface) | 27 bool flipped_output_surface, |
| 28 scoped_ptr<BeginFrameSource> begin_frame_source) |
| 25 : PixelTestOutputSurface(context_provider, | 29 : PixelTestOutputSurface(context_provider, |
| 26 nullptr, | 30 nullptr, |
| 27 flipped_output_surface) { | 31 flipped_output_surface, |
| 28 } | 32 std::move(begin_frame_source)) {} |
| 29 | 33 |
| 30 PixelTestOutputSurface::PixelTestOutputSurface( | 34 PixelTestOutputSurface::PixelTestOutputSurface( |
| 31 scoped_ptr<SoftwareOutputDevice> software_device) | 35 scoped_ptr<SoftwareOutputDevice> software_device, |
| 36 scoped_ptr<BeginFrameSource> begin_frame_source) |
| 32 : OutputSurface(std::move(software_device)), | 37 : OutputSurface(std::move(software_device)), |
| 38 begin_frame_source_(std::move(begin_frame_source)), |
| 33 external_stencil_test_(false) {} | 39 external_stencil_test_(false) {} |
| 34 | 40 |
| 41 PixelTestOutputSurface::~PixelTestOutputSurface() {} |
| 42 |
| 43 bool PixelTestOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 44 if (!OutputSurface::BindToClient(client)) |
| 45 return false; |
| 46 |
| 47 // TODO(enne): Once the renderer uses begin frame sources, this will |
| 48 // always be valid. |
| 49 if (begin_frame_source_) |
| 50 client->SetBeginFrameSource(begin_frame_source_.get()); |
| 51 return true; |
| 52 } |
| 53 |
| 35 void PixelTestOutputSurface::Reshape(const gfx::Size& size, | 54 void PixelTestOutputSurface::Reshape(const gfx::Size& size, |
| 36 float scale_factor, | 55 float scale_factor, |
| 37 bool has_alpha) { | 56 bool has_alpha) { |
| 38 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), | 57 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), |
| 39 size.height() + surface_expansion_size_.height()); | 58 size.height() + surface_expansion_size_.height()); |
| 40 OutputSurface::Reshape(expanded_size, scale_factor, has_alpha); | 59 OutputSurface::Reshape(expanded_size, scale_factor, has_alpha); |
| 41 } | 60 } |
| 42 | 61 |
| 43 bool PixelTestOutputSurface::HasExternalStencilTest() const { | 62 bool PixelTestOutputSurface::HasExternalStencilTest() const { |
| 44 return external_stencil_test_; | 63 return external_stencil_test_; |
| 45 } | 64 } |
| 46 | 65 |
| 47 void PixelTestOutputSurface::SwapBuffers(CompositorFrame* frame) { | 66 void PixelTestOutputSurface::SwapBuffers(CompositorFrame* frame) { |
| 48 PostSwapBuffersComplete(); | 67 PostSwapBuffersComplete(); |
| 49 client_->DidSwapBuffers(); | 68 client_->DidSwapBuffers(); |
| 50 } | 69 } |
| 51 | 70 |
| 52 } // namespace cc | 71 } // namespace cc |
| OLD | NEW |