#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_H_
#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_H_
#include <Metal/Metal.h>
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/surface.h"
#include "third_party/skia/include/gpu/GrContext.h"
@class CAMetalLayer;
namespace flutter {
class GPUSurfaceMetal : public Surface {
public:
GPUSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer);
~GPUSurfaceMetal() override;
private:
fml::scoped_nsobject<CAMetalLayer> layer_;
sk_sp<GrContext> context_;
fml::scoped_nsprotocol<id<MTLCommandQueue>> command_queue_;
bool IsValid() override;
std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
SkMatrix GetRootTransformation() const override;
GrContext* GetContext() override;
bool MakeRenderContextCurrent() override;
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceMetal);
};
}
#endif