10#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
38 AHardwareBuffer_Desc bufferDesc;
39 AHardwareBuffer_describe(graphicBuffer, &bufferDesc);
42 AHardwareBufferUtils::GetSkColorTypeFromBufferFormat(bufferDesc.format);
44 alphaType, std::move(colorSpace));
46 bool createProtectedImage = 0 != (bufferDesc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT);
48 info, graphicBuffer, alphaType, createProtectedImage,
49 bufferDesc.format, surfaceOrigin));
52GrAHardwareBufferImageGenerator::GrAHardwareBufferImageGenerator(
const SkImageInfo&
info,
56 , fHardwareBuffer(hardwareBuffer)
57 , fBufferFormat(bufferFormat)
58 , fIsProtectedContent(isProtectedContent)
59 , fSurfaceOrigin(surfaceOrigin) {
60 AHardwareBuffer_acquire(fHardwareBuffer);
64 AHardwareBuffer_release(fHardwareBuffer);
79 GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(direct,
92 AHardwareBuffer_acquire(hardwareBuffer);
94 class AutoAHBRelease {
98 AutoAHBRelease(
const AutoAHBRelease&) {
SkASSERT(0); }
99 AutoAHBRelease(AutoAHBRelease&& that) : fAhb(that.fAhb) { that.fAhb =
nullptr; }
100 ~AutoAHBRelease() { fAhb ? AHardwareBuffer_release(fAhb) : void(); }
102 AutoAHBRelease& operator=(AutoAHBRelease&& that) {
103 fAhb = std::exchange(that.fAhb,
nullptr);
106 AutoAHBRelease& operator=(
const AutoAHBRelease&) =
delete;
115 [direct,
buffer = AutoAHBRelease(hardwareBuffer)](
119 GrAHardwareBufferUtils::DeleteImageProc deleteImageProc =
nullptr;
120 GrAHardwareBufferUtils::UpdateImageProc updateImageProc =
nullptr;
121 GrAHardwareBufferUtils::TexImageCtx texImageCtx =
nullptr;
125 GrAHardwareBufferUtils::MakeBackendTexture(direct,
127 desc.fDimensions.width(),
128 desc.fDimensions.height(),
138 SkASSERT(deleteImageProc && texImageCtx);
152 deleteImageProc(texImageCtx);
156 if (deleteImageProc) {
157 tex->
setRelease(deleteImageProc, texImageCtx);
171 "AHardwareBufferImageGenerator_MakeView");
184 if (!texProxyView.
proxy()) {
200 std::move(texProxyView),
205 "AHardwareBufferImageGenerator_GenerateTexture");
209 if (
nullptr == context) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
struct AHardwareBuffer AHardwareBuffer
@ kBorrow_GrWrapOwnership
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
skgpu::Protected GrProtected
@ kNew_Uncached_Unbudgeted
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static std::unique_ptr< SkImageGenerator > Make(AHardwareBuffer *, SkAlphaType, sk_sp< SkColorSpace >, GrSurfaceOrigin)
~GrAHardwareBufferImageGenerator() override
const GrCaps * caps() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
virtual GrDirectContext * asDirectContext()
SK_API GrBackendApi backend() const
GrProxyProvider * proxyProvider()
GrRecordingContextPriv priv()
bool abandoned() override
sk_sp< GrTexture > wrapBackendTexture(const GrBackendTexture &tex, GrWrapOwnership, GrWrapCacheable, GrIOType)
GrTextureProxy * asTextureProxy() const
GrSurfaceProxy * proxy() const
static GrSurfaceProxyView Copy(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Mipmapped mipmapped, SkIRect srcRect, SkBackingFit fit, skgpu::Budgeted budgeted, std::string_view label)
void setRelease(sk_sp< skgpu::RefCntedCallback > releaseHelper)
const SkImageInfo & getInfo() const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
const myers::Point & get(const myers::Segment &)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)