Remove SkImage_Base::asTextureRef (in favor of asTextureProxyRef)
Minor consolidation/clean-up Change-Id: I9f8ba794cfb95b33dd60ada0e734ddd2f5f21710 Reviewed-on: https://skia-review.googlesource.com/9947 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
73879ebecb
commit
30a38ff737
@ -69,10 +69,6 @@ public:
|
||||
virtual bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace,
|
||||
CachingHint = kAllow_CachingHint) const = 0;
|
||||
|
||||
// Caller must call unref when they are done.
|
||||
virtual GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkColorSpace*,
|
||||
sk_sp<SkColorSpace>*, SkScalar scaleAdjust[2]) const = 0;
|
||||
|
||||
virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0;
|
||||
|
||||
// If a ctx is specified, then only gpu-specific formats are requested.
|
||||
|
@ -37,8 +37,6 @@ public:
|
||||
SkData* onRefEncoded(GrContext*) const override;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkColorSpace*,
|
||||
sk_sp<SkColorSpace>*, SkScalar scaleAdjust[2]) const override;
|
||||
bool onIsLazyGenerated() const override { return true; }
|
||||
sk_sp<SkImage> onMakeColorSpace(sk_sp<SkColorSpace>) const override;
|
||||
|
||||
@ -100,13 +98,6 @@ sk_sp<GrTextureProxy> SkImage_Generator::asTextureProxyRef(GrContext* context,
|
||||
}
|
||||
#endif
|
||||
|
||||
GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
return fCache.lockAsTexture(ctx, params, dstColorSpace, texColorSpace, this, scaleAdjust);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Generator::onMakeSubset(const SkIRect& subset) const {
|
||||
SkASSERT(fCache.info().bounds().contains(subset));
|
||||
SkASSERT(fCache.info().bounds() != subset);
|
||||
|
@ -105,17 +105,7 @@ sk_sp<GrTextureProxy> SkImage_Gpu::asTextureProxyRef(GrContext* context,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
sk_sp<GrTexture> tex(this->asTextureRef(context, params, dstColorSpace,
|
||||
texColorSpace, scaleAdjust));
|
||||
|
||||
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||
}
|
||||
|
||||
GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
if (ctx != fContext) {
|
||||
if (context != fContext) {
|
||||
SkASSERT(0);
|
||||
return nullptr;
|
||||
}
|
||||
@ -130,7 +120,9 @@ GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrSamplerParams& para
|
||||
|
||||
GrTextureAdjuster adjuster(fContext, texture, this->alphaType(), this->bounds(),
|
||||
this->uniqueID(), this->fColorSpace.get());
|
||||
return adjuster.refTextureSafeForParams(params, nullptr, scaleAdjust);
|
||||
sk_sp<GrTexture> tex(adjuster.refTextureSafeForParams(params, nullptr, scaleAdjust));
|
||||
|
||||
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||
}
|
||||
|
||||
static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
SkAlphaType onAlphaType() const override { return fAlphaType; }
|
||||
|
||||
bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkColorSpace*,
|
||||
sk_sp<SkColorSpace>*, SkScalar scaleAdjust[2]) const override;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
|
||||
GrTextureProxy* peekProxy() const override {
|
||||
|
@ -93,9 +93,6 @@ public:
|
||||
SkScalar scaleAdjust[2]) const override;
|
||||
#endif
|
||||
|
||||
GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkColorSpace*,
|
||||
sk_sp<SkColorSpace>*, SkScalar scaleAdjust[2]) const override;
|
||||
|
||||
bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
|
||||
@ -186,18 +183,7 @@ sk_sp<GrTextureProxy> SkImage_Raster::asTextureProxyRef(GrContext* context,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
sk_sp<GrTexture> tex(this->asTextureRef(context, params, dstColorSpace, texColorSpace,
|
||||
scaleAdjust));
|
||||
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||
}
|
||||
#endif
|
||||
|
||||
GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
SkScalar scaleAdjust[2]) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
if (!ctx) {
|
||||
if (!context) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -208,17 +194,17 @@ GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrSamplerParams& p
|
||||
uint32_t uniqueID;
|
||||
sk_sp<GrTexture> tex = this->refPinnedTexture(&uniqueID);
|
||||
if (tex) {
|
||||
GrTextureAdjuster adjuster(ctx, fPinnedTexture.get(),
|
||||
GrTextureAdjuster adjuster(context, fPinnedTexture.get(),
|
||||
fBitmap.alphaType(), fBitmap.bounds(),
|
||||
fPinnedUniqueID, fBitmap.colorSpace());
|
||||
return adjuster.refTextureSafeForParams(params, nullptr, scaleAdjust);
|
||||
tex.reset(adjuster.refTextureSafeForParams(params, nullptr, scaleAdjust));
|
||||
} else {
|
||||
tex.reset(GrRefCachedBitmapTexture(context, fBitmap, params, scaleAdjust));
|
||||
}
|
||||
|
||||
return GrRefCachedBitmapTexture(ctx, fBitmap, params, scaleAdjust);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user