78 std::move(imageColorSpace)),
80 , fYUVAProxies(
std::move(proxies)) {
89 ColorSpaceMode csMode)
91 image->imageInfo().makeColorSpace(
std::move(targetCS)),
93 , fYUVAProxies(
image->fYUVAProxies)
96 , fFromColorSpace(csMode == ColorSpaceMode::kReinterpret
98 : (
image->colorSpace() ?
image->refColorSpace()
111 for (
int i = 0;
i < n; ++
i) {
119 newProxies[
i] = newView.detachProxy();
135 if (
info.fSubmittedProc) {
136 info.fSubmittedProc(
info.fSubmittedContext,
false);
138 if (
info.fFinishedProc) {
139 info.fFinishedProc(
info.fFinishedContext);
145 size_t numProxies = fYUVAProxies.
numPlanes();
146 for (
size_t i = 0;
i < numProxies; ++
i) {
147 proxies[
i] = fYUVAProxies.
proxy(
i);
184 if (fOnMakeColorSpaceTarget &&
186 return fOnMakeColorSpaceResult;
191 fOnMakeColorSpaceTarget = targetCS;
192 fOnMakeColorSpaceResult =
result;
209 "Image_GpuYUVA_ReinterpretColorSpace",
222 if (fFromColorSpace) {
224 fFromColorSpace.
get(),
229 sfc->fillWithFP(std::move(
fp));
231 return {sfc->readSurfaceView(), sfc->colorInfo().colorType()};
240 const SkRect* domain)
const {
270 if (fFromColorSpace) {
272 fFromColorSpace.
get(),
297 for (
int plane = 0; plane < numPlanes; ++plane) {
303 if (!proxies[plane]) {
314 return sk_make_sp<SkImage_GaneshYUVA>(
321 bool limitToMaxTextureSize) {
328 bool limitToMaxTextureSize,
350 if (maxDim > maxTextureSize) {
351 if (!limitToMaxTextureSize) {
354 float scale =
static_cast<float>(maxTextureSize) / maxDim;
365 for (
int i = 0;
i < numPlanes; ++
i) {
370 pixmapsToUpload = &tempPixmaps;
376 for (
int i = 0;
i < numPlanes; ++
i) {
389 return sk_make_sp<SkImage_GaneshYUVA>(
sk_ref_sp(context),
391 std::move(yuvaProxies),
392 std::move(imageColorSpace));
401 if (!backendTextureInfo.
isValid()) {
410 textureReleaseProc = textureReleaseProc ? textureReleaseProc : [](
void*) {};
412 for (
int i = 0;
i < n; ++
i) {
416 if (!threadSafeProxy) {
430 for (
int i = 0;
i < n; ++
i) {
437 std::move(releaseHelpers[
i]));
446 return sk_make_sp<SkImage_GaneshYUVA>(std::move(ctx),
448 std::move(yuvaTextureProxies),
449 std::move(imageColorSpace));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kBorrow_GrWrapOwnership
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
GrSurfaceProxyView GrCopyBaseMipMapToView(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Budgeted budgeted)
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeUncachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, skgpu::Mipmapped mipmapped, SkBackingFit fit, skgpu::Budgeted budgeted)
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
static bool SkImageInfoIsValid(const SkImageInfo &info)
static constexpr auto kAssumedColorType
#define INHERITED(method,...)
sk_sp< T > sk_ref_sp(T *obj)
bool matches(GrContext_Base *candidate) const
const GrCaps * caps() const
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, SkCubicResampler, Direction)
bool mipmapSupport() const
int maxTextureSize() const
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &={}, const skgpu::MutableTextureState *newState=nullptr)
bool abandoned() override
GrDirectContextPriv priv()
static sk_sp< GrImageContext > MakeForPromiseImage(sk_sp< GrContextThreadSafeProxy > tsp)
GrImageContextPriv priv()
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
GrProxyProvider * proxyProvider()
std::unique_ptr< skgpu::ganesh::SurfaceFillContext > makeSFC(GrImageInfo, std::string_view label, SkBackingFit=SkBackingFit::kExact, int sampleCount=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
GrRecordingContextPriv priv()
constexpr skgpu::Mipmapped mipmapped() const
constexpr WrapMode wrapModeX() const
constexpr Filter filter() const
constexpr WrapMode wrapModeY() const
skgpu::Swizzle swizzle() const
GrProtected isProtected() const
size_t gpuMemorySize() const
virtual GrTextureProxy * asTextureProxy()
const SkYUVAInfo & yuvaInfo() const
GrSurfaceOrigin textureOrigin() const
const GrBackendFormat & planeFormat(int i) const
const SkYUVAInfo & yuvaInfo() const
GrBackendTexture texture(int i) const
GrSurfaceOrigin textureOrigin() const
GrSurfaceProxy * proxy(int i) const
const SkYUVAInfo & yuvaInfo() const
skgpu::Mipmapped mipmapped() const
GrSurfaceProxyView makeView(int i) const
sk_sp< GrSurfaceProxy > refProxy(int i) const
GrSurfaceOrigin textureOrigin() const
static std::unique_ptr< GrFragmentProcessor > Make(const GrYUVATextureProxies &yuvaProxies, GrSamplerState samplerState, const GrCaps &, const SkMatrix &localMatrix=SkMatrix::I(), const SkRect *subset=nullptr, const SkRect *domain=nullptr)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
SkColorType colorType() const
static bool Equals(const SkColorSpace *, const SkColorSpace *)
sk_sp< GrImageContext > fContext
GrImageContext * context() const final
static sk_sp< GrTextureProxy > MakePromiseImageLazyProxy(GrContextThreadSafeProxy *, SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, SkImages::PromiseImageTextureFulfillProc, sk_sp< skgpu::RefCntedCallback > releaseHelper)
std::unique_ptr< GrFragmentProcessor > asFragmentProcessor(GrRecordingContext *, SkSamplingOptions, const SkTileMode[2], const SkMatrix &, const SkRect *, const SkRect *) const override
bool onIsProtected() const override
SkImage_GaneshYUVA(sk_sp< GrImageContext >, uint32_t uniqueID, GrYUVATextureProxies proxies, sk_sp< SkColorSpace >)
sk_sp< SkImage > onReinterpretColorSpace(sk_sp< SkColorSpace >) const final
GrSemaphoresSubmitted flush(GrDirectContext *, const GrFlushInfo &) const override
size_t textureSize() const override
std::tuple< GrSurfaceProxyView, GrColorType > asView(GrRecordingContext *, skgpu::Mipmapped, GrImageTexGenPolicy) const override
sk_sp< SkImage > onMakeColorTypeAndColorSpace(SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const final
bool setupMipmapsForPlanes(GrRecordingContext *) const
bool onHasMipmaps() const override
const SkImageInfo & imageInfo() const
SkAlphaType alphaType() const
static const SkMatrix & I()
bool scalePixels(const SkPixmap &dst, const SkSamplingOptions &) const
static SkSamplingOptions AnisoFallback(bool imageIsMipped)
static constexpr int kMaxPlanes
SkYUVAInfo makeDimensions(SkISize) const
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
SkISize dimensions() const
DataType dataType() const
const SkYUVAInfo & yuvaInfo() const
const SkPixmap & plane(int i) const
static SkYUVAPixmaps Allocate(const SkYUVAPixmapInfo &yuvaPixmapInfo)
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API sk_sp< SkImage > TextureFromYUVAPixmaps(GrRecordingContext *context, const SkYUVAPixmaps &pixmaps, skgpu::Mipmapped buildMips, bool limitToMaxTextureSize, sk_sp< SkColorSpace > imageColorSpace)
void * PromiseImageTextureContext
SK_API sk_sp< SkImage > PromiseTextureFromYUVA(skgpu::graphite::Recorder *, const skgpu::graphite::YUVABackendTextureInfo &, sk_sp< SkColorSpace > imageColorSpace, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext imageContext, GraphitePromiseTextureFulfillContext planeContexts[], std::string_view label={})
SK_API sk_sp< SkImage > TextureFromYUVATextures(GrRecordingContext *context, const GrYUVABackendTextures &yuvaTextures, sk_sp< SkColorSpace > imageColorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
void(*)(PromiseImageTextureContext) PromiseImageTextureReleaseProc
void(*)(ReleaseContext) TextureReleaseProc
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< const SkImage > image
SkSamplingOptions sampling
@ kNoAccess
back-end surface will not be used by client
it will be possible to load the file into Perfetto s trace viewer 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
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
const SkCubicResampler cubic
const SkFilterMode filter
const SkMipmapMode mipmap