#ifndef FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SURFACE_SOFTWARE_H_
#define FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SURFACE_SOFTWARE_H_
#include "flutter/fml/macros.h"
#include "flutter/shell/gpu/gpu_surface_software.h"
#include "flutter/shell/platform/ohos/ohos_surface.h"
namespace flutter {
class OhosSurfaceSoftware final : public OhosSurface, public GPUSurfaceSoftwareDelegate {
public:
OhosSurfaceSoftware();
~OhosSurfaceSoftware() override = default;
bool IsValid() const override;
std::unique_ptr<Surface> CreateGPUSurface() override;
bool OnScreenSurfaceResize(const SkISize& size) override;
void SetPlatformWindow(const OHOS::sptr<OHOS::Rosen::Window> &window) override;
sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override;
bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
void SurfaceDrawBuffer(
OHOS::BufferRequestConfig& requestConfig, OHOS::sptr<OHOS::SurfaceBuffer> surfaceBuffer, SkPixmap& pixmap);
void SurfaceFlushBuffer(OHOS::sptr<OHOS::SurfaceBuffer>);
ExternalViewEmbedder* GetExternalViewEmbedder() override;
virtual bool ResourceContextMakeCurrent() override;
virtual bool ResourceContextClearCurrent() override;
virtual void TeardownOnScreenContext() override;
private:
sk_sp<SkSurface> sk_surface_;
SkColorType target_color_type_;
SkAlphaType target_alpha_type_;
OHOS::sptr<OHOS::Rosen::Window> window_ = nullptr;
OHOS::BufferRequestConfig requestConfig_;
OHOS::sptr<OHOS::Surface> surface_ = nullptr;
FML_DISALLOW_COPY_AND_ASSIGN(OhosSurfaceSoftware);
};
}
#endif