Add another dollop of sk_sp to SkSpecialImage and SkSpecialSurface
This is split out of https://codereview.chromium.org/1914883002/ (Refactor drawContext/RenderTarget creation)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1913743002
Review URL: https://codereview.chromium.org/1913743002
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index ab17588..fdd78f8 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -313,8 +313,7 @@
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- dst.get());
-
+ std::move(dst));
}
#endif
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index bbc7635..f18e6a7 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -32,7 +32,9 @@
virtual GrTexture* onPeekTexture() const { return nullptr; }
- virtual GrTexture* onAsTextureRef(GrContext* context) const = 0;
+#if SK_SUPPORT_GPU
+ virtual sk_sp<GrTexture> onAsTextureRef(GrContext* context) const = 0;
+#endif
// Delete this entry point ASAP (see skbug.com/4965)
virtual bool getBitmapDeprecated(SkBitmap* result) const = 0;
@@ -80,8 +82,9 @@
return SkSpecialImage::MakeFromRaster(SkIRect::MakeEmpty(), bmp, &this->props());
}
- SkAutoTUnref<GrTexture> resultTex(
- GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter()));
+ sk_sp<GrTexture> resultTex(GrRefCachedBitmapTexture(context,
+ bmp,
+ GrTextureParams::ClampNoFilter()));
if (!resultTex) {
return nullptr;
}
@@ -123,10 +126,11 @@
return nullptr;
}
-
-GrTexture* SkSpecialImage::asTextureRef(GrContext* context) const {
+#if SK_SUPPORT_GPU
+sk_sp<GrTexture> SkSpecialImage::asTextureRef(GrContext* context) const {
return as_SIB(this)->onAsTextureRef(context);
}
+#endif
sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) const {
return as_SIB(this)->onMakeSurface(info);
@@ -151,13 +155,15 @@
sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(const SkBitmap& src,
const SkSurfaceProps* props) {
+#if SK_SUPPORT_GPU
// Need to test offset case! (see skbug.com/4967)
if (src.getTexture()) {
return SkSpecialImage::MakeFromGpu(src.bounds(),
src.getGenerationID(),
- src.getTexture(),
+ sk_ref_sp(src.getTexture()),
props);
}
+#endif
return SkSpecialImage::MakeFromRaster(src.bounds(), src, props);
}
@@ -217,13 +223,12 @@
GrTexture* onPeekTexture() const override { return as_IB(fImage)->peekTexture(); }
- GrTexture* onAsTextureRef(GrContext* context) const override {
#if SK_SUPPORT_GPU
- return as_IB(fImage)->asTextureRef(context, GrTextureParams::ClampNoFilter());
-#else
- return nullptr;
-#endif
+ sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
+ return sk_sp<GrTexture>(as_IB(fImage)->asTextureRef(context,
+ GrTextureParams::ClampNoFilter()));
}
+#endif
bool getBitmapDeprecated(SkBitmap* result) const override {
#if SK_SUPPORT_GPU
@@ -356,15 +361,17 @@
return true;
}
- GrTexture* onAsTextureRef(GrContext* context) const override {
#if SK_SUPPORT_GPU
+ sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
if (context) {
- return GrRefCachedBitmapTexture(context, fBitmap, GrTextureParams::ClampNoFilter());
+ return sk_ref_sp(GrRefCachedBitmapTexture(context,
+ fBitmap,
+ GrTextureParams::ClampNoFilter()));
}
-#endif
return nullptr;
}
+#endif
bool getBitmapDeprecated(SkBitmap* result) const override {
*result = fBitmap;
@@ -437,10 +444,10 @@
class SkSpecialImage_Gpu : public SkSpecialImage_Base {
public:
SkSpecialImage_Gpu(const SkIRect& subset,
- uint32_t uniqueID, GrTexture* tex, SkAlphaType at,
+ uint32_t uniqueID, sk_sp<GrTexture> tex, SkAlphaType at,
const SkSurfaceProps* props)
: INHERITED(subset, uniqueID, props)
- , fTexture(SkRef(tex))
+ , fTexture(std::move(tex))
, fAlphaType(at)
, fAddedRasterVersionToCache(false) {
}
@@ -463,16 +470,16 @@
SkBitmap bm;
- GrWrapTextureInBitmap(fTexture,
+ GrWrapTextureInBitmap(fTexture.get(),
fTexture->width(), fTexture->height(), this->isOpaque(), &bm);
canvas->drawBitmapRect(bm, this->subset(),
dst, paint, SkCanvas::kStrict_SrcRectConstraint);
}
- GrTexture* onPeekTexture() const override { return fTexture; }
+ GrTexture* onPeekTexture() const override { return fTexture.get(); }
- GrTexture* onAsTextureRef(GrContext*) const override { return SkRef(fTexture.get()); }
+ sk_sp<GrTexture> onAsTextureRef(GrContext*) const override { return fTexture; }
bool onGetROPixels(SkBitmap* dst) const override {
if (SkBitmapCache::Find(this->uniqueID(), dst)) {
@@ -502,7 +509,7 @@
}
bool getBitmapDeprecated(SkBitmap* result) const override {
- const SkImageInfo info = GrMakeInfoFromTexture(fTexture,
+ const SkImageInfo info = GrMakeInfoFromTexture(fTexture.get(),
this->width(), this->height(),
this->isOpaque());
if (!result->setInfo(info)) {
@@ -511,7 +518,7 @@
const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->height());
- SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture));
+ SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture.get()));
result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop);
return true;
}
@@ -542,7 +549,7 @@
// The existing GrTexture is already tight so reuse it in the SkImage
return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height(),
kNeedNewImageUniqueID,
- fAlphaType, fTexture, SkBudgeted::kYes);
+ fAlphaType, fTexture.get(), SkBudgeted::kYes);
}
GrContext* ctx = fTexture->getContext();
@@ -550,14 +557,13 @@
desc.fWidth = subset.width();
desc.fHeight = subset.height();
- SkAutoTUnref<GrTexture> subTx(ctx->textureProvider()->createTexture(desc,
- SkBudgeted::kYes));
+ sk_sp<GrTexture> subTx(ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes));
if (!subTx) {
return nullptr;
}
- ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0));
+ ctx->copySurface(subTx.get(), fTexture.get(), subset, SkIPoint::Make(0, 0));
return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
- fAlphaType, subTx, SkBudgeted::kYes);
+ fAlphaType, subTx.get(), SkBudgeted::kYes);
}
sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
@@ -565,7 +571,7 @@
}
private:
- SkAutoTUnref<GrTexture> fTexture;
+ sk_sp<GrTexture> fTexture;
const SkAlphaType fAlphaType;
mutable SkAtomic<bool> fAddedRasterVersionToCache;
@@ -574,21 +580,11 @@
sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset,
uint32_t uniqueID,
- GrTexture* tex,
+ sk_sp<GrTexture> tex,
const SkSurfaceProps* props,
SkAlphaType at) {
SkASSERT(rect_fits(subset, tex->width(), tex->height()));
- return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, tex, at, props);
-}
-
-#else
-
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset,
- uint32_t uniqueID,
- GrTexture* tex,
- const SkSurfaceProps* props,
- SkAlphaType at) {
- return nullptr;
+ return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, props);
}
#endif
diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h
index d6497a0..6771f25 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -73,11 +73,13 @@
static sk_sp<SkSpecialImage> MakeFromRaster(const SkIRect& subset,
const SkBitmap&,
const SkSurfaceProps* = nullptr);
+#if SK_SUPPORT_GPU
static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset,
uint32_t uniqueID,
- GrTexture*,
+ sk_sp<GrTexture>,
const SkSurfaceProps* = nullptr,
SkAlphaType at = kPremul_SkAlphaType);
+#endif
static sk_sp<SkSpecialImage> MakeFromPixmap(const SkIRect& subset,
const SkPixmap&,
RasterReleaseProc,
@@ -123,11 +125,13 @@
*/
GrContext* getContext() const;
+#if SK_SUPPORT_GPU
/**
* Regardless of the underlying backing store, return the contents as a GrTexture.
* The active portion of the texture can be retrieved via 'subset'.
*/
- GrTexture* asTextureRef(GrContext*) const;
+ sk_sp<GrTexture> asTextureRef(GrContext*) const;
+#endif
// TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063)
/**
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 2e2d8cc..2973aa1 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -112,11 +112,11 @@
class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
public:
- SkSpecialSurface_Gpu(GrTexture* texture,
+ SkSpecialSurface_Gpu(sk_sp<GrTexture> texture,
const SkIRect& subset,
const SkSurfaceProps* props)
: INHERITED(subset, props)
- , fTexture(SkRef(texture)) {
+ , fTexture(std::move(texture)) {
SkASSERT(fTexture->asRenderTarget());
@@ -133,25 +133,27 @@
~SkSpecialSurface_Gpu() override { }
sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
+ // Note: we are intentionally zeroing out 'fTexture' here
return SkSpecialImage::MakeFromGpu(this->subset(),
- kNeedNewImageUniqueID_SpecialImage, fTexture,
+ kNeedNewImageUniqueID_SpecialImage,
+ std::move(fTexture),
&this->props());
}
private:
- SkAutoTUnref<GrTexture> fTexture;
+ sk_sp<GrTexture> fTexture;
typedef SkSpecialSurface_Base INHERITED;
};
sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(const SkIRect& subset,
- GrTexture* texture,
+ sk_sp<GrTexture> texture,
const SkSurfaceProps* props) {
if (!texture->asRenderTarget()) {
return nullptr;
}
- return sk_make_sp<SkSpecialSurface_Gpu>(texture, subset, props);
+ return sk_make_sp<SkSpecialSurface_Gpu>(std::move(texture), subset, props);
}
sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
@@ -161,28 +163,14 @@
return nullptr;
}
- SkAutoTUnref<GrTexture> temp(context->textureProvider()->createApproxTexture(desc));
+ sk_sp<GrTexture> temp(context->textureProvider()->createApproxTexture(desc));
if (!temp) {
return nullptr;
}
const SkIRect subset = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
- return sk_make_sp<SkSpecialSurface_Gpu>(temp, subset, props);
-}
-
-#else
-
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(const SkIRect& subset,
- GrTexture*,
- const SkSurfaceProps*) {
- return nullptr;
-}
-
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
- const GrSurfaceDesc& desc,
- const SkSurfaceProps* props) {
- return nullptr;
+ return sk_make_sp<SkSpecialSurface_Gpu>(std::move(temp), subset, props);
}
#endif
diff --git a/src/core/SkSpecialSurface.h b/src/core/SkSpecialSurface.h
index 6ed8a77..2135347 100644
--- a/src/core/SkSpecialSurface.h
+++ b/src/core/SkSpecialSurface.h
@@ -50,10 +50,11 @@
*/
sk_sp<SkSpecialImage> makeImageSnapshot();
+#if SK_SUPPORT_GPU
/**
* Use an existing (renderTarget-capable) GrTexture as the backing store.
*/
- static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, GrTexture*,
+ static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, sk_sp<GrTexture>,
const SkSurfaceProps* = nullptr);
/**
@@ -62,6 +63,7 @@
*/
static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, const GrSurfaceDesc&,
const SkSurfaceProps* = nullptr);
+#endif
/**
* Use and existing SkBitmap as the backing store.
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index d233c04..bbe351d 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -106,7 +106,7 @@
#if SK_SUPPORT_GPU
if (source->isTextureBacked()) {
GrContext* context = source->getContext();
- SkAutoTUnref<GrTexture> inputTexture(input->asTextureRef(context));
+ sk_sp<GrTexture> inputTexture(input->asTextureRef(context));
SkASSERT(inputTexture);
if (0 == sigma.x() && 0 == sigma.y()) {
@@ -121,21 +121,21 @@
inputBounds.offset(-inputOffset);
dstBounds.offset(-inputOffset);
SkRect inputBoundsF(SkRect::Make(inputBounds));
- SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(context,
- inputTexture,
- false,
- source->props().isGammaCorrect(),
- SkRect::Make(dstBounds),
- &inputBoundsF,
- sigma.x(),
- sigma.y()));
+ sk_sp<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(context,
+ inputTexture.get(),
+ false,
+ source->props().isGammaCorrect(),
+ SkRect::Make(dstBounds),
+ &inputBoundsF,
+ sigma.x(),
+ sigma.y()));
if (!tex) {
return nullptr;
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- tex, &source->props());
+ std::move(tex), &source->props());
}
#endif
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index c52b958..a8f0b81 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -323,7 +323,7 @@
desc.fHeight = bounds.height();
desc.fConfig = kSkia8888_GrPixelConfig;
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
+ sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
if (!dst) {
return nullptr;
}
@@ -357,7 +357,7 @@
offset->fY = bounds.top();
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- dst);
+ std::move(dst));
}
#endif
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 7f0e3ea..4252831 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -462,7 +462,7 @@
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- dst.get());
+ std::move(dst));
}
#endif
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index d5a048c..810d0e1 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -474,7 +474,7 @@
const SkIRect& rect,
GrMorphologyEffect::MorphologyType morphType,
SkISize radius) {
- SkAutoTUnref<GrTexture> srcTexture(input->asTextureRef(context));
+ sk_sp<GrTexture> srcTexture(input->asTextureRef(context));
SkASSERT(srcTexture);
// setup new clip
@@ -502,7 +502,7 @@
return nullptr;
}
- apply_morphology_pass(dstDrawContext, clip, srcTexture,
+ apply_morphology_pass(dstDrawContext, clip, srcTexture.get(),
srcRect, dstRect, radius.fWidth, morphType,
Gr1DKernelEffect::kX_Direction);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
@@ -526,7 +526,7 @@
return nullptr;
}
- apply_morphology_pass(dstDrawContext, clip, srcTexture,
+ apply_morphology_pass(dstDrawContext, clip, srcTexture.get(),
srcRect, dstRect, radius.fHeight, morphType,
Gr1DKernelEffect::kY_Direction);
@@ -535,7 +535,7 @@
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
kNeedNewImageUniqueID_SpecialImage,
- srcTexture, &input->props());
+ std::move(srcTexture), &input->props());
}
#endif
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 25a750e..f4e896e 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -169,11 +169,11 @@
sk_sp<GrTexture> backgroundTex, foregroundTex;
if (background) {
- backgroundTex.reset(background->asTextureRef(context));
+ backgroundTex = background->asTextureRef(context);
}
if (foreground) {
- foregroundTex.reset(foreground->asTextureRef(context));
+ foregroundTex = foreground->asTextureRef(context);
}
GrSurfaceDesc desc;
@@ -181,7 +181,7 @@
desc.fWidth = bounds.width();
desc.fHeight = bounds.height();
desc.fConfig = kSkia8888_GrPixelConfig;
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
+ sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
if (!dst) {
return nullptr;
}
@@ -259,7 +259,7 @@
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- dst.get());
+ std::move(dst));
}
#endif
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index c768b7f..a2d42e0 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -303,7 +303,7 @@
const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->texture()->height());
sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset,
kNeedNewImageUniqueID_SpecialImage,
- layer->texture(),
+ sk_ref_sp(layer->texture()),
props));
SkIPoint offset = SkIPoint::Make(0, 0);
@@ -316,8 +316,8 @@
}
SkASSERT(result->isTextureBacked());
- SkAutoTUnref<GrTexture> texture(result->asTextureRef(context));
- layer->setTexture(texture, result->subset(), false);
+ sk_sp<GrTexture> texture(result->asTextureRef(context));
+ layer->setTexture(texture.get(), result->subset(), false);
layer->setOffset(offset);
}
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 40c805a..58d279c 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -213,7 +213,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) {
- SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext));
+ sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext));
if (!srcTexture) {
return;
}
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 952e5e5..54e9a60 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -368,6 +368,7 @@
}
static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
+#if SK_SUPPORT_GPU
if (context) {
GrSurfaceDesc desc;
desc.fConfig = kSkia8888_GrPixelConfig;
@@ -375,7 +376,9 @@
desc.fWidth = widthHeight;
desc.fHeight = widthHeight;
return SkSpecialSurface::MakeRenderTarget(context, desc);
- } else {
+ } else
+#endif
+ {
const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
kOpaque_SkAlphaType);
return SkSpecialSurface::MakeRaster(info);
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 18d023f..f517447 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -243,10 +243,10 @@
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc,
- SkBudgeted::kNo,
- bm.getPixels(),
- 0));
+ sk_sp<GrTexture> texture(context->textureProvider()->createTexture(desc,
+ SkBudgeted::kNo,
+ bm.getPixels(),
+ 0));
if (!texture) {
return;
}
@@ -255,7 +255,7 @@
SkIRect::MakeWH(kFullSize,
kFullSize),
kNeedNewImageUniqueID_SpecialImage,
- texture));
+ std::move(texture)));
{
sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
@@ -281,9 +281,9 @@
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc,
- SkBudgeted::kNo,
- bm.getPixels(), 0));
+ sk_sp<GrTexture> texture(context->textureProvider()->createTexture(desc,
+ SkBudgeted::kNo,
+ bm.getPixels(), 0));
if (!texture) {
return;
}
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp
index 7169b5e..8c560fe 100644
--- a/tests/SpecialSurfaceTest.cpp
+++ b/tests/SpecialSurfaceTest.cpp
@@ -98,12 +98,12 @@
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- SkAutoTUnref<GrTexture> temp(ctxInfo.fGrContext->textureProvider()->createApproxTexture(desc));
+ sk_sp<GrTexture> temp(ctxInfo.fGrContext->textureProvider()->createApproxTexture(desc));
SkASSERT_RELEASE(temp);
const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(subset, temp));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(subset, std::move(temp)));
test_surface(surf, reporter, kPad);