| 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/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| 11 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" |
| 12 #include "ui/gfx/transform.h" | 12 #include "ui/gfx/transform.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 PixelTestOutputSurface::PixelTestOutputSurface( | 16 PixelTestOutputSurface::PixelTestOutputSurface( |
| 17 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider, |
| 18 scoped_refptr<ContextProvider> worker_context_provider, | |
| 19 bool flipped_output_surface) | 18 bool flipped_output_surface) |
| 20 : OutputSurface(std::move(context_provider), | 19 : OutputSurface(std::move(context_provider)), |
| 21 std::move(worker_context_provider), | |
| 22 nullptr), | |
| 23 external_stencil_test_(false) { | 20 external_stencil_test_(false) { |
| 24 capabilities_.adjust_deadline_for_parent = false; | |
| 25 capabilities_.flipped_output_surface = flipped_output_surface; | 21 capabilities_.flipped_output_surface = flipped_output_surface; |
| 26 } | 22 } |
| 27 | 23 |
| 28 PixelTestOutputSurface::PixelTestOutputSurface( | 24 PixelTestOutputSurface::PixelTestOutputSurface( |
| 29 scoped_refptr<ContextProvider> context_provider, | |
| 30 bool flipped_output_surface) | |
| 31 : PixelTestOutputSurface(std::move(context_provider), | |
| 32 nullptr, | |
| 33 flipped_output_surface) {} | |
| 34 | |
| 35 PixelTestOutputSurface::PixelTestOutputSurface( | |
| 36 std::unique_ptr<SoftwareOutputDevice> software_device) | 25 std::unique_ptr<SoftwareOutputDevice> software_device) |
| 37 : OutputSurface(nullptr, nullptr, std::move(software_device)), | 26 : OutputSurface(std::move(software_device)), |
| 38 external_stencil_test_(false) {} | 27 external_stencil_test_(false) {} |
| 39 | 28 |
| 40 PixelTestOutputSurface::~PixelTestOutputSurface() {} | 29 PixelTestOutputSurface::~PixelTestOutputSurface() = default; |
| 41 | 30 |
| 42 void PixelTestOutputSurface::Reshape(const gfx::Size& size, | 31 void PixelTestOutputSurface::Reshape(const gfx::Size& size, |
| 43 float scale_factor, | 32 float scale_factor, |
| 44 const gfx::ColorSpace& color_space, | 33 const gfx::ColorSpace& color_space, |
| 45 bool has_alpha) { | 34 bool has_alpha) { |
| 46 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), | 35 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), |
| 47 size.height() + surface_expansion_size_.height()); | 36 size.height() + surface_expansion_size_.height()); |
| 48 OutputSurface::Reshape(expanded_size, scale_factor, color_space, has_alpha); | 37 OutputSurface::Reshape(expanded_size, scale_factor, color_space, has_alpha); |
| 49 } | 38 } |
| 50 | 39 |
| 51 bool PixelTestOutputSurface::HasExternalStencilTest() const { | 40 bool PixelTestOutputSurface::HasExternalStencilTest() const { |
| 52 return external_stencil_test_; | 41 return external_stencil_test_; |
| 53 } | 42 } |
| 54 | 43 |
| 55 void PixelTestOutputSurface::SwapBuffers(CompositorFrame frame) { | 44 void PixelTestOutputSurface::SwapBuffers(CompositorFrame frame) { |
| 56 PostSwapBuffersComplete(); | 45 PostSwapBuffersComplete(); |
| 57 } | 46 } |
| 58 | 47 |
| 59 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() { | 48 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() { |
| 60 // This format will work if the |context_provider| has an RGB or RGBA | 49 // This format will work if the |context_provider| has an RGB or RGBA |
| 61 // framebuffer. For now assume tests do not want/care about alpha in | 50 // framebuffer. For now assume tests do not want/care about alpha in |
| 62 // the root render pass. | 51 // the root render pass. |
| 63 return GL_RGB; | 52 return GL_RGB; |
| 64 } | 53 } |
| 65 | 54 |
| 66 } // namespace cc | 55 } // namespace cc |
| OLD | NEW |