10#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
71 AHardwareBuffer_Desc bufferDesc;
72 AHardwareBuffer_describe(hardwareBuffer, &bufferDesc);
74 if (!
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT)) {
78 bool isTextureable =
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE);
83 GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(
84 dContext, hardwareBuffer, bufferDesc.format,
true);
89 GrAHardwareBufferUtils::DeleteImageProc deleteImageProc =
nullptr;
90 GrAHardwareBufferUtils::UpdateImageProc updateImageProc =
nullptr;
91 GrAHardwareBufferUtils::TexImageCtx deleteImageCtx =
nullptr;
93 bool isProtectedContent =
94 SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT);
96 bool fromWindowLocal =
false;
97#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
98 fromWindowLocal = fromWindow;
102 GrAHardwareBufferUtils::MakeBackendTexture(dContext,
113 if (!backendTexture.
isValid()) {
118 AHardwareBufferUtils::GetSkColorTypeFromBufferFormat(bufferDesc.format);
126 std::move(colorSpace),
struct AHardwareBuffer AHardwareBuffer
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr bool SkToBool(const T &x)
SK_API sk_sp< SkSurface > WrapAndroidHardwareBuffer(skgpu::graphite::Recorder *recorder, AHardwareBuffer *hardwareBuffer, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, BufferReleaseProc=nullptr, ReleaseContext=nullptr, bool fromWindow=false)
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)