blob: 6e6a033a905ad633485df2f4e2358dfa500ceace [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TEST_PIXEL_TEST_OUTPUT_SURFACE_H_
#define CC_TEST_PIXEL_TEST_OUTPUT_SURFACE_H_
#include "base/memory/weak_ptr.h"
#include "components/viz/service/display/output_surface.h"
namespace cc {
class PixelTestOutputSurface : public viz::OutputSurface {
public:
explicit PixelTestOutputSurface(
scoped_refptr<viz::ContextProvider> context_provider,
bool flipped_output_surface);
explicit PixelTestOutputSurface(
std::unique_ptr<viz::SoftwareOutputDevice> software_device);
~PixelTestOutputSurface() override;
// OutputSurface implementation.
void BindToClient(viz::OutputSurfaceClient* client) override;
void EnsureBackbuffer() override;
void DiscardBackbuffer() override;
void BindFramebuffer() override;
void SetDrawRectangle(const gfx::Rect& rect) override;
void Reshape(const gfx::Size& size,
float device_scale_factor,
const gfx::ColorSpace& color_space,
bool has_alpha,
bool use_stencil) override;
bool HasExternalStencilTest() const override;
void ApplyExternalStencil() override;
void SwapBuffers(viz::OutputSurfaceFrame frame) override;
viz::OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
bool IsDisplayedAsOverlayPlane() const override;
unsigned GetOverlayTextureId() const override;
gfx::BufferFormat GetOverlayBufferFormat() const override;
bool SurfaceIsSuspendForRecycle() const override;
uint32_t GetFramebufferCopyTextureFormat() override;
#if BUILDFLAG(ENABLE_VULKAN)
gpu::VulkanSurface* GetVulkanSurface() override;
#endif
void set_has_external_stencil_test(bool has_test) {
external_stencil_test_ = has_test;
}
private:
void SwapBuffersCallback(uint64_t swap_id);
bool external_stencil_test_ = false;
viz::OutputSurfaceClient* client_ = nullptr;
uint64_t swap_id_ = 0;
base::WeakPtrFactory<PixelTestOutputSurface> weak_ptr_factory_;
};
} // namespace cc
#endif // CC_TEST_PIXEL_TEST_OUTPUT_SURFACE_H_