Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: cc/test/pixel_test_output_surface.cc

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "gpu/command_buffer/client/gles2_interface.h"
11 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
12 #include "ui/gfx/transform.h" 13 #include "ui/gfx/transform.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 PixelTestOutputSurface::PixelTestOutputSurface( 17 PixelTestOutputSurface::PixelTestOutputSurface(
17 scoped_refptr<ContextProvider> context_provider, 18 scoped_refptr<ContextProvider> context_provider,
18 bool flipped_output_surface) 19 bool flipped_output_surface)
19 : OutputSurface(std::move(context_provider)), 20 : OutputSurface(std::move(context_provider)),
20 external_stencil_test_(false) { 21 external_stencil_test_(false) {
21 capabilities_.flipped_output_surface = flipped_output_surface; 22 capabilities_.flipped_output_surface = flipped_output_surface;
22 } 23 }
23 24
24 PixelTestOutputSurface::PixelTestOutputSurface( 25 PixelTestOutputSurface::PixelTestOutputSurface(
25 std::unique_ptr<SoftwareOutputDevice> software_device) 26 std::unique_ptr<SoftwareOutputDevice> software_device)
26 : OutputSurface(std::move(software_device)), 27 : OutputSurface(std::move(software_device)),
27 external_stencil_test_(false) {} 28 external_stencil_test_(false) {}
28 29
29 PixelTestOutputSurface::~PixelTestOutputSurface() = default; 30 PixelTestOutputSurface::~PixelTestOutputSurface() = default;
30 31
32 void PixelTestOutputSurface::EnsureBackbuffer() {}
33
34 void PixelTestOutputSurface::DiscardBackbuffer() {}
35
36 void PixelTestOutputSurface::BindFramebuffer() {
37 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
38 }
39
31 void PixelTestOutputSurface::Reshape(const gfx::Size& size, 40 void PixelTestOutputSurface::Reshape(const gfx::Size& size,
32 float scale_factor, 41 float scale_factor,
33 const gfx::ColorSpace& color_space, 42 const gfx::ColorSpace& color_space,
34 bool has_alpha) { 43 bool has_alpha) {
35 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), 44 gfx::Size expanded_size(size.width() + surface_expansion_size_.width(),
36 size.height() + surface_expansion_size_.height()); 45 size.height() + surface_expansion_size_.height());
37 OutputSurface::Reshape(expanded_size, scale_factor, color_space, has_alpha); 46 OutputSurface::Reshape(expanded_size, scale_factor, color_space, has_alpha);
38 } 47 }
39 48
40 bool PixelTestOutputSurface::HasExternalStencilTest() const { 49 bool PixelTestOutputSurface::HasExternalStencilTest() const {
41 return external_stencil_test_; 50 return external_stencil_test_;
42 } 51 }
43 52
53 void PixelTestOutputSurface::ApplyExternalStencil() {}
54
44 void PixelTestOutputSurface::SwapBuffers(CompositorFrame frame) { 55 void PixelTestOutputSurface::SwapBuffers(CompositorFrame frame) {
45 PostSwapBuffersComplete(); 56 PostSwapBuffersComplete();
46 } 57 }
47 58
59 OverlayCandidateValidator*
60 PixelTestOutputSurface::GetOverlayCandidateValidator() const {
61 return nullptr;
62 }
63
64 bool PixelTestOutputSurface::IsDisplayedAsOverlayPlane() const {
65 return false;
66 }
67
68 unsigned PixelTestOutputSurface::GetOverlayTextureId() const {
69 return 0;
70 }
71
72 bool PixelTestOutputSurface::SurfaceIsSuspendForRecycle() const {
73 return false;
74 }
75
48 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() { 76 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() {
49 // This format will work if the |context_provider| has an RGB or RGBA 77 // This format will work if the |context_provider| has an RGB or RGBA
50 // framebuffer. For now assume tests do not want/care about alpha in 78 // framebuffer. For now assume tests do not want/care about alpha in
51 // the root render pass. 79 // the root render pass.
52 return GL_RGB; 80 return GL_RGB;
53 } 81 }
54 82
55 } // namespace cc 83 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/pixel_test_output_surface.h ('k') | content/browser/compositor/browser_compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698