#ifndef UI_OZONE_COMMON_GL_SURFACE_EGL_READBACK_H_
#define UI_OZONE_COMMON_GL_SURFACE_EGL_READBACK_H_
#include "base/containers/heap_array.h"
#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
#include "ui/gfx/native_ui_types.h"
#include "ui/gl/gl_surface_egl.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace ui {
class GLSurfaceEglReadback : public gl::PbufferGLSurfaceEGL {
public:
explicit GLSurfaceEglReadback(gl::GLDisplayEGL* display);
GLSurfaceEglReadback(const GLSurfaceEglReadback&) = delete;
GLSurfaceEglReadback& operator=(const GLSurfaceEglReadback&) = delete;
bool Resize(const gfx::Size& size,
float scale_factor,
const gfx::ColorSpace& color_space,
bool has_alpha) override;
gfx::SwapResult SwapBuffers(PresentationCallback callback,
gfx::FrameData data) override;
gfx::SurfaceOrigin GetOrigin() const override;
protected:
~GLSurfaceEglReadback() override;
UNSAFE_BUFFER_USAGE virtual bool HandlePixels(uint8_t* pixels);
void ReadPixels(base::span<uint8_t> buffer);
private:
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::HeapArray<uint8_t> pixels_;
};
}
#endif