51 : fStableProxy(
std::move(stableProxy)) {
58 int volatileProxyTargetCount)
59 : fStableProxy(
std::move(stableProxy))
60 , fVolatileProxy(
std::move(volatileProxy))
61 , fVolatileToStableCopyTask(
std::move(copyTask))
62 , fVolatileProxyTargetCount(volatileProxyTargetCount) {
68inline SkImage_Ganesh::ProxyChooser::~ProxyChooser() {
71 if (fVolatileToStableCopyTask) {
72 fVolatileToStableCopyTask->makeSkippable();
80 SkASSERT(fVolatileProxyTargetCount <= fVolatileProxy->getTaskTargetCount());
85 fVolatileProxyTargetCount == fVolatileProxy->getTaskTargetCount()) {
86 return fVolatileProxy;
88 fVolatileProxy.reset();
89 fVolatileToStableCopyTask.reset();
97 fVolatileProxy.reset();
98 fVolatileToStableCopyTask.reset();
104 if (fVolatileProxy) {
105 fStableProxy = std::move(fVolatileProxy);
106 fVolatileToStableCopyTask->makeSkippable();
107 fVolatileToStableCopyTask.reset();
112inline bool SkImage_Ganesh::ProxyChooser::surfaceMustCopyOnWrite(
118inline size_t SkImage_Ganesh::ProxyChooser::gpuMemorySize()
const {
120 size_t size = fStableProxy->gpuMemorySize();
121 if (fVolatileProxy) {
130 if (fVolatileProxy) {
131 SkASSERT(fVolatileProxy->asTextureProxy()->mipmapped() == mipmapped);
138 skgpu::Protected isProtected = fStableProxy->asTextureProxy()->isProtected();
139 if (fVolatileProxy) {
140 SkASSERT(fVolatileProxy->asTextureProxy()->isProtected() == isProtected);
146inline const GrBackendFormat& SkImage_Ganesh::ProxyChooser::backendFormat() {
148 if (fVolatileProxy) {
149 SkASSERT(fVolatileProxy->backendFormat() == fStableProxy->backendFormat());
151 return fStableProxy->backendFormat();
164 , fChooser(view.detachProxy())
165 , fSwizzle(view.swizzle())
166 , fOrigin(view.origin()) {
180 int volatileSrcTargetCount,
186 , fChooser(
std::move(stableCopy),
187 volatileSrc.detachProxy(),
189 volatileSrcTargetCount)
190 , fSwizzle(volatileSrc.swizzle())
191 , fOrigin(volatileSrc.origin()) {
215 "ImageGpu_MakeWithVolatileSrc",
226 std::move(volatileSrc),
230 std::move(colorInfo)));
233 return sk_make_sp<SkImage_Ganesh>(
240 return fChooser.surfaceMustCopyOnWrite(surfaceProxy);
252 if (
info.fSubmittedProc) {
253 info.fSubmittedProc(
info.fSubmittedContext,
false);
255 if (
info.fFinishedProc) {
256 info.fFinishedProc(
info.fFinishedContext);
267 bool flushPendingGrContextIO,
274 if (direct->abandoned()) {
283 auto resourceProvider = direct->priv().resourceProvider();
294 if (flushPendingGrContextIO) {
295 direct->priv().flushSurface(proxy.
get());
301 *outTexture =
texture->getBackendTexture();
335 sfc->fillWithFP(std::move(colorFP));
337 return sk_make_sp<SkImage_Ganesh>(
345 return sk_make_sp<SkImage_Ganesh>(
364 auto ctx = dContext->
priv().
makeSC(this->makeView(dContext), this->
imageInfo().colorInfo());
369 ctx->asyncRescaleAndReadPixels(
388 auto ctx = dContext->
priv().
makeSC(this->makeView(dContext), this->
imageInfo().colorInfo());
393 ctx->asyncRescaleAndReadPixelsYUV420(dContext,
396 std::move(dstColorSpace),
416 this->makeView(recordingContext),
419 "SkImageGpu_AsView"),
428 return {std::move(view), ct};
437 const SkRect* domain)
const {
455 return {fChooser.chooseProxy(rContext), fOrigin, fSwizzle};
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct)
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
#define INHERITED(method,...)
sk_sp< T > sk_ref_sp(T *obj)
bool matches(GrContext_Base *candidate) const
const GrCaps * caps() const
bool areColorTypeAndFormatCompatible(GrColorType grCT, const GrBackendFormat &format) const
bool isFormatCompressed(const GrBackendFormat &format) const
virtual GrDirectContext * asDirectContext()
GrSemaphoresSubmitted flushSurface(GrSurfaceProxy *proxy, SkSurfaces::BackendSurfaceAccess access=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &info={}, const skgpu::MutableTextureState *newState=nullptr)
bool abandoned() override
GrDirectContextPriv priv()
GrImageContextPriv priv()
std::unique_ptr< skgpu::ganesh::SurfaceFillContext > makeSFCWithFallback(GrImageInfo, SkBackingFit, int sampleCount, skgpu::Mipmapped, skgpu::Protected, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
std::unique_ptr< skgpu::ganesh::SurfaceContext > makeSC(GrSurfaceProxyView readView, const GrColorInfo &)
skgpu::Swizzle swizzle() const
GrSurfaceOrigin origin() const
GrSurfaceProxy * proxy() const
sk_sp< GrSurfaceProxy > refProxy() const
UniqueID underlyingUniqueID() const
int getTaskTargetCount() const
GrProtected isProtected() const
virtual bool instantiate(GrResourceProvider *)=0
GrTexture * peekTexture() const
static sk_sp< GrSurfaceProxy > Copy(GrRecordingContext *, sk_sp< GrSurfaceProxy > src, GrSurfaceOrigin, skgpu::Mipmapped, SkIRect srcRect, SkBackingFit, skgpu::Budgeted, std::string_view label, RectsMustMatch=RectsMustMatch::kNo, sk_sp< GrRenderTask > *outTask=nullptr)
virtual GrTextureProxy * asTextureProxy()
bool isInstantiated() const
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
skgpu::Mipmapped mipmapped() const
sk_sp< SkImage > makeColorSpace(GrDirectContext *, sk_sp< SkColorSpace >) const override
sk_sp< GrImageContext > fContext
GrImageContext * context() const final
void generatingSurfaceIsDeleted() override
std::unique_ptr< GrFragmentProcessor > asFragmentProcessor(GrRecordingContext *, SkSamplingOptions, const SkTileMode[2], const SkMatrix &, const SkRect *, const SkRect *) const override
SkImage_Ganesh(sk_sp< GrImageContext > context, uint32_t uniqueID, GrSurfaceProxyView view, SkColorInfo info)
sk_sp< SkImage > onMakeColorTypeAndColorSpace(SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const final
bool onIsProtected() const override
sk_sp< SkImage > onReinterpretColorSpace(sk_sp< SkColorSpace >) const final
void onAsyncRescaleAndReadPixelsYUV420(SkYUVColorSpace, bool readAlpha, sk_sp< SkColorSpace >, SkIRect srcRect, SkISize dstSize, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const override
bool getExistingBackendTexture(GrBackendTexture *outTexture, bool flushPendingGrContextIO, GrSurfaceOrigin *origin) const
GrSurfaceOrigin origin() const override
bool onHasMipmaps() const override
GrSemaphoresSubmitted flush(GrDirectContext *, const GrFlushInfo &) const override
bool surfaceMustCopyOnWrite(GrSurfaceProxy *surfaceProxy) const
void onAsyncRescaleAndReadPixels(const SkImageInfo &, SkIRect srcRect, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const override
size_t textureSize() const override
~SkImage_Ganesh() override
std::tuple< GrSurfaceProxyView, GrColorType > asView(GrRecordingContext *, skgpu::Mipmapped, GrImageTexGenPolicy) const override
static sk_sp< SkImage > MakeWithVolatileSrc(sk_sp< GrRecordingContext > rContext, GrSurfaceProxyView volatileSrc, SkColorInfo colorInfo)
const SkImageInfo & imageInfo() const
SkISize dimensions() const
uint32_t uniqueID() const
SkAlphaType alphaType() const
SkColorType colorType() const
void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >) ReadPixelsCallback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t uint32_t * format
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
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 policy
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
const myers::Point & get< 0 >(const myers::Segment &s)
GrSurfaceProxyView FindOrMakeCachedMipmappedView(GrRecordingContext *rContext, GrSurfaceProxyView view, uint32_t imageUniqueID)
GrSurfaceProxyView CopyView(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy, std::string_view label)
std::tuple< GrSurfaceProxyView, GrColorType > AsView(GrRecordingContext *rContext, const SkImage *img, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy)
std::unique_ptr< GrFragmentProcessor > MakeFragmentProcessorFromView(GrRecordingContext *rContext, GrSurfaceProxyView view, SkAlphaType at, SkSamplingOptions sampling, const SkTileMode tileModes[2], const SkMatrix &m, const SkRect *subset, const SkRect *domain)
const SkMipmapMode mipmap