| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
| 10 #include "cc/scheduler/begin_frame_source.h" | 10 #include "cc/scheduler/begin_frame_source.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 PixelTestOutputSurface::PixelTestOutputSurface( | 38 PixelTestOutputSurface::PixelTestOutputSurface( |
| 39 std::unique_ptr<SoftwareOutputDevice> software_device, | 39 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 40 std::unique_ptr<BeginFrameSource> begin_frame_source) | 40 std::unique_ptr<BeginFrameSource> begin_frame_source) |
| 41 : OutputSurface(nullptr, nullptr, std::move(software_device)), | 41 : OutputSurface(nullptr, nullptr, std::move(software_device)), |
| 42 begin_frame_source_(std::move(begin_frame_source)), | 42 begin_frame_source_(std::move(begin_frame_source)), |
| 43 external_stencil_test_(false) {} | 43 external_stencil_test_(false) {} |
| 44 | 44 |
| 45 PixelTestOutputSurface::~PixelTestOutputSurface() {} | 45 PixelTestOutputSurface::~PixelTestOutputSurface() {} |
| 46 | 46 |
| 47 bool PixelTestOutputSurface::BindToClient(OutputSurfaceClient* client) { | |
| 48 if (!OutputSurface::BindToClient(client)) | |
| 49 return false; | |
| 50 | |
| 51 // TODO(enne): Once the renderer uses begin frame sources, this will | |
| 52 // always be valid. | |
| 53 if (begin_frame_source_) | |
| 54 client->SetBeginFrameSource(begin_frame_source_.get()); | |
| 55 return true; | |
| 56 } | |
| 57 | |
| 58 void PixelTestOutputSurface::Reshape(const gfx::Size& size, | 47 void PixelTestOutputSurface::Reshape(const gfx::Size& size, |
| 59 float scale_factor, | 48 float scale_factor, |
| 60 bool has_alpha) { | 49 bool has_alpha) { |
| 61 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), | 50 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), |
| 62 size.height() + surface_expansion_size_.height()); | 51 size.height() + surface_expansion_size_.height()); |
| 63 OutputSurface::Reshape(expanded_size, scale_factor, has_alpha); | 52 OutputSurface::Reshape(expanded_size, scale_factor, has_alpha); |
| 64 } | 53 } |
| 65 | 54 |
| 66 bool PixelTestOutputSurface::HasExternalStencilTest() const { | 55 bool PixelTestOutputSurface::HasExternalStencilTest() const { |
| 67 return external_stencil_test_; | 56 return external_stencil_test_; |
| 68 } | 57 } |
| 69 | 58 |
| 70 void PixelTestOutputSurface::SwapBuffers(CompositorFrame* frame) { | 59 void PixelTestOutputSurface::SwapBuffers(CompositorFrame* frame) { |
| 71 PostSwapBuffersComplete(); | 60 PostSwapBuffersComplete(); |
| 72 client_->DidSwapBuffers(); | 61 client_->DidSwapBuffers(); |
| 73 } | 62 } |
| 74 | 63 |
| 75 } // namespace cc | 64 } // namespace cc |
| OLD | NEW |