#ifndef FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SURFACE_GL_H_
#define FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SURFACE_GL_H_
#include <memory>
#include "flutter/fml/macros.h"
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/ohos/ohos_surface.h"
#include "egl_surface.h"
namespace flutter {
class OhosSurfaceGL final : public GPUSurfaceGLDelegate, public OhosSurface {
public:
OhosSurfaceGL();
~OhosSurfaceGL() override = default;
bool IsValid() const override;
std::unique_ptr<Surface> CreateGPUSurface() override;
void SetPlatformWindow(const ::OHOS::sptr<OHOS::Rosen::Window>& window) override;
bool OnScreenSurfaceResize(const SkISize& size) override;
void TeardownOnScreenContext() override;
bool ResourceContextMakeCurrent() override;
bool ResourceContextClearCurrent() override;
bool GLContextPresent() override;
intptr_t GLContextFBO() const override;
bool GLContextFBOResetAfterPresent() const override;
bool UseOffscreenSurface() const override;
SkMatrix GLContextSurfaceTransformation() const override;
bool GLContextMakeCurrent() override;
bool GLContextClearCurrent() override;
ExternalViewEmbedder* GetExternalViewEmbedder() override;
private:
OHOS::sptr<OHOS::Rosen::Window> window_;
OHOS::sptr<OHOS::EglRenderSurface> eglRenderSurface_;
EGLDisplay eglDisplay_;
EGLContext eglContext_;
EGLSurface eglSurface_;
bool valid_ = false;
bool InitRenderSurface();
FML_DISALLOW_COPY_AND_ASSIGN(OhosSurfaceGL);
};
}
#endif