5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_SURFACE_MTL_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_SURFACE_MTL_H_
8#include <QuartzCore/CAMetalLayer.h>
19#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-Wunguarded-availability-new"
38 const std::shared_ptr<Context>& context,
42 const std::shared_ptr<Context>& context,
44 std::optional<IRect> clip_rect = std::nullopt);
47 const std::shared_ptr<Context>& context,
49 std::optional<IRect> clip_rect,
51#pragma GCC diagnostic pop
56 id<MTLDrawable>
drawable()
const {
return drawable_; }
65 std::weak_ptr<Context> context_;
66 std::shared_ptr<Texture> resolve_texture_;
67 id<CAMetalDrawable> drawable_ = nil;
68 std::shared_ptr<Texture> source_texture_;
69 std::shared_ptr<Texture> destination_texture_;
70 bool requires_blit_ =
false;
71 std::optional<IRect> clip_rect_;
73 static bool ShouldPerformPartialRepaint(std::optional<IRect> damage_rect);
75 SurfaceMTL(
const std::weak_ptr<Context>& context,
77 std::shared_ptr<Texture> resolve_texture,
79 std::shared_ptr<Texture> source_texture,
80 std::shared_ptr<Texture> destination_texture,
82 std::optional<IRect> clip_rect);
bool Present() const override
id< MTLDrawable > drawable() const
static std::unique_ptr< SurfaceMTL > MakeFromTexture(const std::shared_ptr< Context > &context, id< MTLTexture > texture, std::optional< IRect > clip_rect, id< CAMetalDrawable > drawable=nil)
static id< CAMetalDrawable > GetMetalDrawableAndValidate(const std::shared_ptr< Context > &context, CAMetalLayer *layer)
Wraps the current drawable of the given Metal layer to create a surface Impeller can render to....
static std::unique_ptr< SurfaceMTL > MakeFromMetalLayerDrawable(const std::shared_ptr< Context > &context, id< CAMetalDrawable > drawable, std::optional< IRect > clip_rect=std::nullopt)