Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkImage_GaneshYUVA Class Referencefinal

#include <SkImage_GaneshYUVA.h>

Inheritance diagram for SkImage_GaneshYUVA:
SkImage_GaneshBase SkImage_Base SkImage SkRefCnt SkRefCntBase

Public Member Functions

 SkImage_GaneshYUVA (sk_sp< GrImageContext >, uint32_t uniqueID, GrYUVATextureProxies proxies, sk_sp< SkColorSpace >)
 
size_t textureSize () const override
 
SkImage_Base::Type type () const override
 
bool onHasMipmaps () const override
 
bool onIsProtected () const override
 
sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const final
 
sk_sp< SkImageonReinterpretColorSpace (sk_sp< SkColorSpace >) const final
 
GrSemaphoresSubmitted flush (GrDirectContext *, const GrFlushInfo &) const override
 
std::tuple< GrSurfaceProxyView, GrColorTypeasView (GrRecordingContext *, skgpu::Mipmapped, GrImageTexGenPolicy) const override
 
std::unique_ptr< GrFragmentProcessorasFragmentProcessor (GrRecordingContext *, SkSamplingOptions, const SkTileMode[2], const SkMatrix &, const SkRect *, const SkRect *) const override
 
bool setupMipmapsForPlanes (GrRecordingContext *) const
 
GrSurfaceOrigin origin () const override
 
virtual sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const =0
 
- Public Member Functions inherited from SkImage_GaneshBase
bool isValid (GrRecordingContext *) const final
 
sk_sp< SkImagemakeColorTypeAndColorSpace (GrDirectContext *dContext, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const final
 
sk_sp< SkImagemakeSubset (GrDirectContext *direct, const SkIRect &subset) const final
 
GrImageContextcontext () const final
 
GrDirectContextdirectContext () const final
 
bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint) const final
 
sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &subset) const final
 
bool onReadPixels (GrDirectContext *dContext, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, int srcX, int srcY, CachingHint) const override
 
virtual GrSemaphoresSubmitted flush (GrDirectContext *, const GrFlushInfo &) const =0
 
virtual std::tuple< GrSurfaceProxyView, GrColorTypeasView (GrRecordingContext *, skgpu::Mipmapped, GrImageTexGenPolicy) const =0
 
virtual std::unique_ptr< GrFragmentProcessorasFragmentProcessor (GrRecordingContext *, SkSamplingOptions, const SkTileMode[2], const SkMatrix &, const SkRect *, const SkRect *) const =0
 
virtual GrSurfaceOrigin origin () const =0
 
- Public Member Functions inherited from SkImage_Base
 ~SkImage_Base () override
 
sk_sp< SkImagemakeColorSpace (GrDirectContext *, sk_sp< SkColorSpace >) const override
 
sk_sp< SkImagemakeColorSpace (skgpu::graphite::Recorder *, sk_sp< SkColorSpace >, RequiredProperties) const override
 
sk_sp< SkImagemakeColorTypeAndColorSpace (GrDirectContext *dContext, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const override
 
sk_sp< SkImagemakeColorTypeAndColorSpace (skgpu::graphite::Recorder *, SkColorType, sk_sp< SkColorSpace >, RequiredProperties) const override
 
sk_sp< SkImagemakeSubset (GrDirectContext *direct, const SkIRect &subset) const override
 
sk_sp< SkImagemakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const override
 
size_t textureSize () const override
 
virtual bool onPeekPixels (SkPixmap *) const
 
virtual const SkBitmaponPeekBitmap () const
 
virtual bool onReadPixels (GrDirectContext *, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint) const =0
 
virtual bool onHasMipmaps () const =0
 
virtual bool onIsProtected () const =0
 
virtual SkMipmaponPeekMips () const
 
sk_sp< SkMipmaprefMips () const
 
virtual void onAsyncRescaleAndReadPixels (const SkImageInfo &, SkIRect srcRect, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const
 
virtual void onAsyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace, bool readAlpha, sk_sp< SkColorSpace > dstColorSpace, SkIRect srcRect, SkISize dstSize, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const
 
virtual GrImageContextcontext () const
 
virtual GrDirectContextdirectContext () const
 
virtual void generatingSurfaceIsDeleted ()
 
virtual bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint=kAllow_CachingHint) const =0
 
virtual sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const =0
 
virtual sk_sp< SkDataonRefEncoded () const
 
virtual bool onAsLegacyBitmap (GrDirectContext *, SkBitmap *) const
 
virtual Type type () const =0
 
bool isLazyGenerated () const override
 
bool isRasterBacked () const
 
bool isGaneshBacked () const
 
bool isGraphiteBacked () const
 
bool isYUVA () const
 
bool isTextureBacked () const override
 
virtual void notifyAddedToRasterCache () const
 
virtual sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const =0
 
virtual sk_sp< SkImageonReinterpretColorSpace (sk_sp< SkColorSpace >) const =0
 
virtual sk_sp< SkImageonMakeWithMipmaps (sk_sp< SkMipmap >) const
 
virtual sk_sp< SkImageonMakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const =0
 
- Public Member Functions inherited from SkImage
const SkImageInfoimageInfo () const
 
int width () const
 
int height () const
 
SkISize dimensions () const
 
SkIRect bounds () const
 
uint32_t uniqueID () const
 
SkAlphaType alphaType () const
 
SkColorType colorType () const
 
SkColorSpacecolorSpace () const
 
sk_sp< SkColorSpacerefColorSpace () const
 
bool isAlphaOnly () const
 
bool isOpaque () const
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeShader (const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeShader (const SkSamplingOptions &sampling, const SkMatrix *lm=nullptr) const
 
sk_sp< SkShadermakeRawShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
 
sk_sp< SkShadermakeRawShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeRawShader (const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeRawShader (const SkSamplingOptions &sampling, const SkMatrix *lm=nullptr) const
 
bool peekPixels (SkPixmap *pixmap) const
 
virtual bool isTextureBacked () const =0
 
virtual size_t textureSize () const =0
 
virtual bool isValid (GrRecordingContext *context) const =0
 
bool readPixels (GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (GrDirectContext *context, const SkPixmap &dst, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (const SkPixmap &dst, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
void asyncRescaleAndReadPixels (const SkImageInfo &info, const SkIRect &srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
void asyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
void asyncRescaleAndReadPixelsYUVA420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
bool scalePixels (const SkPixmap &dst, const SkSamplingOptions &, CachingHint cachingHint=kAllow_CachingHint) const
 
sk_sp< SkDatarefEncodedData () const
 
virtual sk_sp< SkImagemakeSubset (GrDirectContext *direct, const SkIRect &subset) const =0
 
virtual sk_sp< SkImagemakeSubset (skgpu::graphite::Recorder *, const SkIRect &subset, RequiredProperties) const =0
 
bool hasMipmaps () const
 
bool isProtected () const
 
sk_sp< SkImagewithDefaultMipmaps () const
 
sk_sp< SkImagemakeNonTextureImage (GrDirectContext *=nullptr) const
 
sk_sp< SkImagemakeRasterImage (GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
 
sk_sp< SkImagemakeRasterImage (CachingHint cachingHint=kDisallow_CachingHint) const
 
bool asLegacyBitmap (SkBitmap *bitmap, LegacyBitmapMode legacyBitmapMode=kRO_LegacyBitmapMode) const
 
virtual bool isLazyGenerated () const =0
 
virtual sk_sp< SkImagemakeColorSpace (GrDirectContext *direct, sk_sp< SkColorSpace > target) const =0
 
virtual sk_sp< SkImagemakeColorSpace (skgpu::graphite::Recorder *, sk_sp< SkColorSpace > targetColorSpace, RequiredProperties) const =0
 
virtual sk_sp< SkImagemakeColorTypeAndColorSpace (GrDirectContext *direct, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const =0
 
virtual sk_sp< SkImagemakeColorTypeAndColorSpace (skgpu::graphite::Recorder *, SkColorType targetColorType, sk_sp< SkColorSpace > targetColorSpace, RequiredProperties) const =0
 
sk_sp< SkImagereinterpretColorSpace (sk_sp< SkColorSpace > newColorSpace) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Public Types inherited from SkImage_Base
enum class  Type {
  kRaster , kRasterPinnable , kLazy , kLazyPicture ,
  kGanesh , kGaneshYUVA , kGraphite , kGraphiteYUVA
}
 
- Public Types inherited from SkImage
enum  CachingHint { kAllow_CachingHint , kDisallow_CachingHint }
 
enum class  RescaleGamma : bool { kSrc , kLinear }
 
enum class  RescaleMode { kNearest , kLinear , kRepeatedLinear , kRepeatedCubic }
 
enum  LegacyBitmapMode { kRO_LegacyBitmapMode }
 
using ReadPixelsContext = void *
 
using ReadPixelsCallback = void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >)
 
- Static Public Member Functions inherited from SkImage_GaneshBase
static bool ValidateBackendTexture (const GrCaps *, const GrBackendTexture &tex, GrColorType grCT, SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs)
 
static bool ValidateCompressedBackendTexture (const GrCaps *, const GrBackendTexture &tex, SkAlphaType)
 
static sk_sp< GrTextureProxyMakePromiseImageLazyProxy (GrContextThreadSafeProxy *, SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, SkImages::PromiseImageTextureFulfillProc, sk_sp< skgpu::RefCntedCallback > releaseHelper)
 
- Protected Member Functions inherited from SkImage_GaneshBase
 SkImage_GaneshBase (sk_sp< GrImageContext >, SkImageInfo, uint32_t uniqueID)
 
sk_sp< SkImageonMakeSubset (skgpu::graphite::Recorder *, const SkIRect &subset, RequiredProperties) const final
 
sk_sp< SkImagemakeColorTypeAndColorSpace (skgpu::graphite::Recorder *, SkColorType, sk_sp< SkColorSpace >, RequiredProperties) const final
 
virtual sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const=0
 
- Protected Member Functions inherited from SkImage_Base
 SkImage_Base (const SkImageInfo &info, uint32_t uniqueID)
 
- Protected Attributes inherited from SkImage_GaneshBase
sk_sp< GrImageContextfContext
 

Detailed Description

Definition at line 47 of file SkImage_GaneshYUVA.h.

Constructor & Destructor Documentation

◆ SkImage_GaneshYUVA()

SkImage_GaneshYUVA::SkImage_GaneshYUVA ( sk_sp< GrImageContext context,
uint32_t  uniqueID,
GrYUVATextureProxies  proxies,
sk_sp< SkColorSpace imageColorSpace 
)

Definition at line 65 of file SkImage_GaneshYUVA.cpp.

69 : INHERITED(std::move(context),
72 // If an alpha channel is present we always use kPremul. This
73 // is because, although the planar data is always un-premul,
74 // the final interleaved RGBA sample produced in the shader
75 // is premul (and similar if flattened via asView).
78 std::move(imageColorSpace)),
80 , fYUVAProxies(std::move(proxies)) {
81 // The caller should have checked this, just verifying.
82 SkASSERT(fYUVAProxies.isValid());
83}
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT(cond)
Definition: SkAssert.h:116
static constexpr auto kAssumedColorType
const SkYUVAInfo & yuvaInfo() const
GrImageContext * context() const final
uint32_t uniqueID() const
Definition: SkImage.h:311
bool hasAlpha() const
Definition: SkYUVAInfo.h:185
SkISize dimensions() const
Definition: SkYUVAInfo.h:171
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

Member Function Documentation

◆ asFragmentProcessor()

std::unique_ptr< GrFragmentProcessor > SkImage_GaneshYUVA::asFragmentProcessor ( GrRecordingContext context,
SkSamplingOptions  sampling,
const SkTileMode  tileModes[2],
const SkMatrix m,
const SkRect subset,
const SkRect domain 
) const
overridevirtual

Implements SkImage_GaneshBase.

Definition at line 234 of file SkImage_GaneshYUVA.cpp.

240 {
241 if (!fContext->priv().matches(context)) {
242 return {};
243 }
244 // At least for now we do not attempt aniso filtering on YUVA images.
245 if (sampling.isAniso()) {
246 sampling =
248 }
249
250 auto wmx = SkTileModeToWrapMode(tileModes[0]);
251 auto wmy = SkTileModeToWrapMode(tileModes[1]);
252 GrSamplerState sampler(wmx, wmy, sampling.filter, sampling.mipmap);
253 if (sampler.mipmapped() == skgpu::Mipmapped::kYes && !this->setupMipmapsForPlanes(context)) {
254 sampler = GrSamplerState(sampler.wrapModeX(),
255 sampler.wrapModeY(),
256 sampler.filter(),
258 }
259
260 const auto& yuvM = sampling.useCubic ? SkMatrix::I() : m;
262 fYUVAProxies, sampler, *context->priv().caps(), yuvM, subset, domain);
263 if (sampling.useCubic) {
264 fp = GrBicubicEffect::Make(std::move(fp),
265 this->alphaType(),
266 m,
269 }
270 if (fFromColorSpace) {
272 fFromColorSpace.get(),
273 this->alphaType(),
274 this->colorSpace(),
275 this->alphaType());
276 }
277 return fp;
278}
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
Definition: SkGr.h:77
bool matches(GrContext_Base *candidate) const
const GrCaps * caps() const
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, SkCubicResampler, Direction)
static std::unique_ptr< GrFragmentProcessor > Make(std::unique_ptr< GrFragmentProcessor > child, SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
GrImageContextPriv priv()
skgpu::Mipmapped mipmapped() 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)
sk_sp< GrImageContext > fContext
SkAlphaType alphaType() const
Definition: SkImage.cpp:154
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
static SkSamplingOptions AnisoFallback(bool imageIsMipped)
T * get() const
Definition: SkRefCnt.h:303
SkSamplingOptions sampling
Definition: SkRecords.h:337
const uint32_t fp
const SkCubicResampler cubic
const SkFilterMode filter
const SkMipmapMode mipmap

◆ asView()

std::tuple< GrSurfaceProxyView, GrColorType > SkImage_GaneshYUVA::asView ( GrRecordingContext rContext,
skgpu::Mipmapped  mipmapped,
GrImageTexGenPolicy   
) const
overridevirtual

Implements SkImage_GaneshBase.

Definition at line 202 of file SkImage_GaneshYUVA.cpp.

204 {
205 if (!fContext->priv().matches(rContext)) {
206 return {};
207 }
208 auto sfc = rContext->priv().makeSFC(this->imageInfo(),
209 "Image_GpuYUVA_ReinterpretColorSpace",
211 /*sample count*/ 1,
212 mipmapped,
214 fYUVAProxies.textureOrigin(),
216 if (!sfc) {
217 return {};
218 }
219
220 const GrCaps& caps = *rContext->priv().caps();
222 if (fFromColorSpace) {
224 fFromColorSpace.get(),
225 this->alphaType(),
226 this->colorSpace(),
227 this->alphaType());
228 }
229 sfc->fillWithFP(std::move(fp));
230
231 return {sfc->readSurfaceView(), sfc->colorInfo().colorType()};
232}
Definition: GrCaps.h:57
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()
GrSurfaceOrigin textureOrigin() const
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279

◆ flush()

GrSemaphoresSubmitted SkImage_GaneshYUVA::flush ( GrDirectContext dContext,
const GrFlushInfo info 
) const
overridevirtual

Implements SkImage_GaneshBase.

Definition at line 132 of file SkImage_GaneshYUVA.cpp.

133 {
134 if (!fContext->priv().matches(dContext) || dContext->abandoned()) {
135 if (info.fSubmittedProc) {
136 info.fSubmittedProc(info.fSubmittedContext, false);
137 }
138 if (info.fFinishedProc) {
139 info.fFinishedProc(info.fFinishedContext);
140 }
142 }
143
145 size_t numProxies = fYUVAProxies.numPlanes();
146 for (size_t i = 0; i < numProxies; ++i) {
147 proxies[i] = fYUVAProxies.proxy(i);
148 }
149 return dContext->priv().flushSurfaces(
150 {proxies, numProxies}, SkSurfaces::BackendSurfaceAccess::kNoAccess, info);
151}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &={}, const skgpu::MutableTextureState *newState=nullptr)
bool abandoned() override
GrDirectContextPriv priv()
GrSurfaceProxy * proxy(int i) const
static constexpr int kMaxPlanes
Definition: SkYUVAInfo.h:98
@ kNoAccess
back-end surface will not be used by client

◆ onHasMipmaps()

bool SkImage_GaneshYUVA::onHasMipmaps ( ) const
overridevirtual

Implements SkImage_Base.

Definition at line 153 of file SkImage_GaneshYUVA.cpp.

153 {
154 return fYUVAProxies.mipmapped() == skgpu::Mipmapped::kYes;
155}

◆ onIsProtected()

bool SkImage_GaneshYUVA::onIsProtected ( ) const
overridevirtual

Implements SkImage_Base.

Definition at line 157 of file SkImage_GaneshYUVA.cpp.

157 {
158 skgpu::Protected isProtected = fYUVAProxies.proxy(0)->isProtected();
159
160#if defined(SK_DEBUG)
161 for (int i = 1; i < fYUVAProxies.numPlanes(); ++i) {
162 SkASSERT(isProtected == fYUVAProxies.proxy(i)->isProtected());
163 }
164#endif
165
167}
GrProtected isProtected() const
bool isProtected() const
Definition: SkImage.cpp:294
Protected
Definition: GpuTypes.h:61

◆ onMakeColorTypeAndColorSpace() [1/2]

virtual sk_sp< SkImage > SkImage_Base::onMakeColorTypeAndColorSpace ( SkColorType  ,
sk_sp< SkColorSpace ,
GrDirectContext  
) const
virtual

Reimplemented from SkImage_GaneshBase.

◆ onMakeColorTypeAndColorSpace() [2/2]

sk_sp< SkImage > SkImage_GaneshYUVA::onMakeColorTypeAndColorSpace ( SkColorType  ,
sk_sp< SkColorSpace targetCS,
GrDirectContext direct 
) const
finalvirtual

Implements SkImage_Base.

Definition at line 178 of file SkImage_GaneshYUVA.cpp.

180 {
181 // We explicitly ignore color type changes, for now.
182
183 // we may need a mutex here but for now we expect usage to be in a single thread
184 if (fOnMakeColorSpaceTarget &&
185 SkColorSpace::Equals(targetCS.get(), fOnMakeColorSpaceTarget.get())) {
186 return fOnMakeColorSpaceResult;
187 }
189 new SkImage_GaneshYUVA(sk_ref_sp(direct), this, targetCS, ColorSpaceMode::kConvert));
190 if (result) {
191 fOnMakeColorSpaceTarget = targetCS;
192 fOnMakeColorSpaceResult = result;
193 }
194 return result;
195}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
static bool Equals(const SkColorSpace *, const SkColorSpace *)
SkImage_GaneshYUVA(sk_sp< GrImageContext >, uint32_t uniqueID, GrYUVATextureProxies proxies, sk_sp< SkColorSpace >)
GAsyncResult * result

◆ onReinterpretColorSpace()

sk_sp< SkImage > SkImage_GaneshYUVA::onReinterpretColorSpace ( sk_sp< SkColorSpace newCS) const
finalvirtual

Implements SkImage_Base.

Definition at line 197 of file SkImage_GaneshYUVA.cpp.

197 {
198 return sk_sp<SkImage>(
199 new SkImage_GaneshYUVA(fContext, this, std::move(newCS), ColorSpaceMode::kReinterpret));
200}

◆ origin()

GrSurfaceOrigin SkImage_GaneshYUVA::origin ( ) const
inlineoverridevirtual

Implements SkImage_GaneshBase.

Definition at line 85 of file SkImage_GaneshYUVA.h.

85{ return fYUVAProxies.textureOrigin(); }

◆ setupMipmapsForPlanes()

bool SkImage_GaneshYUVA::setupMipmapsForPlanes ( GrRecordingContext context) const

Definition at line 101 of file SkImage_GaneshYUVA.cpp.

101 {
102 if (!context || !fContext->priv().matches(context)) {
103 return false;
104 }
105 if (!context->priv().caps()->mipmapSupport()) {
106 // We succeed in this case by doing nothing.
107 return true;
108 }
109 int n = fYUVAProxies.yuvaInfo().numPlanes();
110 sk_sp<GrSurfaceProxy> newProxies[4];
111 for (int i = 0; i < n; ++i) {
112 auto* t = fYUVAProxies.proxy(i)->asTextureProxy();
113 if (t->mipmapped() == skgpu::Mipmapped::kNo && (t->width() > 1 || t->height() > 1)) {
114 auto newView = GrCopyBaseMipMapToView(context, fYUVAProxies.makeView(i));
115 if (!newView) {
116 return false;
117 }
118 SkASSERT(newView.swizzle() == fYUVAProxies.makeView(i).swizzle());
119 newProxies[i] = newView.detachProxy();
120 } else {
121 newProxies[i] = fYUVAProxies.refProxy(i);
122 }
123 }
124 fYUVAProxies =
125 GrYUVATextureProxies(fYUVAProxies.yuvaInfo(), newProxies, fYUVAProxies.textureOrigin());
126 SkASSERT(fYUVAProxies.isValid());
127 return true;
128}
GrSurfaceProxyView GrCopyBaseMipMapToView(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Budgeted budgeted)
Definition: SkGr.cpp:136
bool mipmapSupport() const
Definition: GrCaps.h:72
skgpu::Swizzle swizzle() const
virtual GrTextureProxy * asTextureProxy()
GrSurfaceProxyView makeView(int i) const
sk_sp< GrSurfaceProxy > refProxy(int i) const
int numPlanes() const
Definition: SkYUVAInfo.h:204

◆ textureSize()

size_t SkImage_GaneshYUVA::textureSize ( ) const
overridevirtual

Returns an approximation of the amount of texture memory used by the image. Returns zero if the image is not texture backed or if the texture has an external format.

Implements SkImage.

Definition at line 170 of file SkImage_GaneshYUVA.cpp.

170 {
171 size_t size = 0;
172 for (int i = 0; i < fYUVAProxies.numPlanes(); ++i) {
173 size += fYUVAProxies.proxy(i)->gpuMemorySize();
174 }
175 return size;
176}
size_t gpuMemorySize() const
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
Definition: switches.h:259

◆ type()

SkImage_Base::Type SkImage_GaneshYUVA::type ( ) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 58 of file SkImage_GaneshYUVA.h.


The documentation for this class was generated from the following files: