aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/image/SkImage_Base.h4
-rw-r--r--src/image/SkImage_Generator.cpp9
-rw-r--r--src/image/SkImage_Gpu.cpp16
-rw-r--r--src/image/SkImage_Gpu.h2
-rw-r--r--src/image/SkImage_Raster.cpp28
5 files changed, 11 insertions, 48 deletions
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index e0319ddc25..e31044ac5e 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -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.
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp
index fb80767999..c8bf732aa3 100644
--- a/src/image/SkImage_Generator.cpp
+++ b/src/image/SkImage_Generator.cpp
@@ -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);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index c9bc2ee9a4..762e11895a 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -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) {
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index ea621b0583..87a97ee732 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -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 {
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 388c8da196..6f3a54d664 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -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