10#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
94 AHardwareBuffer_Desc bufferDesc;
95 AHardwareBuffer_describe(hardwareBuffer, &bufferDesc);
97 if (!
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE)) {
102 GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(dContext,
107 if (!backendFormat.
isValid()) {
111 GrAHardwareBufferUtils::DeleteImageProc deleteImageProc =
nullptr;
112 GrAHardwareBufferUtils::UpdateImageProc updateImageProc =
nullptr;
113 GrAHardwareBufferUtils::TexImageCtx deleteImageCtx =
nullptr;
115 const bool isRenderable =
SkToBool(bufferDesc.usage & AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER);
118 GrAHardwareBufferUtils::MakeBackendTexture(dContext, hardwareBuffer,
119 bufferDesc.width, bufferDesc.height,
120 &deleteImageProc, &updateImageProc,
121 &deleteImageCtx,
false, backendFormat,
123 if (!backendTexture.
isValid()) {
131 AHardwareBufferUtils::GetSkColorTypeFromBufferFormat(bufferDesc.format);
136 if (!proxyProvider) {
142 std::move(releaseHelper));
157 if (!drawingManager) {
164 surfaceContext.writePixels(dContext, pixmap, {0, 0});
struct AHardwareBuffer AHardwareBuffer
@ kBorrow_GrWrapOwnership
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
@ kTopLeft_GrSurfaceOrigin
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
static constexpr bool SkToBool(const T &x)
static std::unique_ptr< SkImageGenerator > Make(AHardwareBuffer *, SkAlphaType, sk_sp< SkColorSpace >, GrSurfaceOrigin)
const GrCaps * caps() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
GrDirectContextPriv priv()
bool flush(SkSpan< GrSurfaceProxy * > proxies, SkSurfaces::BackendSurfaceAccess access, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
GrDrawingManager * drawingManager()
GrProxyProvider * proxyProvider()
SkColorInfo makeColorType(SkColorType newColorType) const
const SkImageInfo & imageInfo() const
const SkImageInfo & info() const
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
SK_API sk_sp< SkImage > DeferredFromGenerator(std::unique_ptr< SkImageGenerator > imageGenerator)
SK_API sk_sp< SkImage > DeferredFromAHardwareBuffer(AHardwareBuffer *hardwareBuffer, SkAlphaType alphaType=kPremul_SkAlphaType)
SK_API sk_sp< SkImage > TextureFromAHardwareBufferWithData(GrDirectContext *context, const SkPixmap &pixmap, AHardwareBuffer *hardwareBuffer, GrSurfaceOrigin surfaceOrigin=kTopLeft_GrSurfaceOrigin)
sk_sp< const SkImage > image
@ kNoAccess
back-end surface will not be used by client
const SkColorInfo & colorInfo() const