10#include "third_party/skia/include/core/SkImage.h"
11#include "third_party/skia/include/core/SkSize.h"
12#include "third_party/skia/include/gpu/ganesh/GrBackendSurface.h"
13#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
18 if (expected == actual) {
21 FML_LOG(ERROR) <<
"Invalid number of textures, expected: " << expected <<
", got: " << actual;
35void EmbedderExternalTextureMetal::Paint(
PaintContext& context,
39 if (last_image_ ==
nullptr) {
44 DlCanvas* canvas = context.
canvas;
45 const DlPaint* paint = context.paint;
49 if (bounds != image_bounds) {
50 canvas->DrawImageRect(last_image_, image_bounds, bounds, sampling, paint);
52 canvas->DrawImage(last_image_,
DlPoint(bounds.
GetX(), bounds.
GetY()), sampling, paint);
57sk_sp<DlImage> EmbedderExternalTextureMetal::ResolveTexture(int64_t
texture_id,
58 GrDirectContext* context,
60 const SkISize&
size) {
61 std::unique_ptr<FlutterMetalExternalTexture>
texture =
68 switch (
texture->pixel_format) {
71 id<MTLTexture> rgbaTex = (__bridge id<MTLTexture>)
texture->textures[0];
73 aiksContext:aiks_context];
79 id<MTLTexture> yTex = (__bridge id<MTLTexture>)
texture->textures[0];
80 id<MTLTexture> uvTex = (__bridge id<MTLTexture>)
texture->textures[1];
89 aiksContext:aiks_context];
99 switch (
texture->pixel_format) {
102 id<MTLTexture> rgbaTex = (__bridge id<MTLTexture>)
texture->textures[0];
112 id<MTLTexture> yTex = (__bridge id<MTLTexture>)
texture->textures[0];
113 id<MTLTexture> uvTex = (__bridge id<MTLTexture>)
texture->textures[1];
114 SkYUVColorSpace colorSpace =
116 ? kRec601_Limited_SkYUVColorSpace
117 : kJPEG_Full_SkYUVColorSpace;
138void EmbedderExternalTextureMetal::OnGrContextCreated() {}
141void EmbedderExternalTextureMetal::OnGrContextDestroyed() {}
144void EmbedderExternalTextureMetal::MarkNewFrameAvailable() {
145 last_image_ =
nullptr;
149void EmbedderExternalTextureMetal::OnTextureUnregistered() {}
static sk_sp< DlImage > Make(const SkImage *image)
EmbedderExternalTextureMetal(int64_t texture_identifier, const ExternalTextureCallback &callback)
std::function< std::unique_ptr< FlutterMetalExternalTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
~EmbedderExternalTextureMetal()
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
#define FML_LOG(severity)
#define FML_DCHECK(condition)
static bool ValidNumTextures(int expected, int actual)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
impeller::AiksContext * aiks_context
GrDirectContext * gr_context
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
static constexpr std::enable_if_t< std::is_floating_point_v< FT >, TRect > Make(const TRect< U > &rect)
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.