10#if __ANDROID_API__ >= 26
32 if (!recorder || !hardwareBuffer) {
36 AHardwareBuffer_Desc bufferDesc;
37 AHardwareBuffer_describe(hardwareBuffer, &bufferDesc);
39 if (!
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT) ||
40 !
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE)) {
47 bool isProtectedContent =
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT);
49 bool fromWindowLocal =
false;
50#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
51 fromWindowLocal = fromWindow;
61 if (!backendTexture.
isValid()) {
69 AHardwareBufferUtils::GetSkColorTypeFromBufferFormat(bufferDesc.format);
75 std::move(colorSpace),
struct AHardwareBuffer AHardwareBuffer
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr bool SkToBool(const T &x)
BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo &)
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)
void(*)(ReleaseContext) BufferReleaseProc
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)
static constexpr SkISize Make(int32_t w, int32_t h)