Fix leak in SkImage_Gpu::onMakeSubset().

BUG=skia:5327
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2003573002

Review-Url: https://codereview.chromium.org/2003573002
This commit is contained in:
senorblanco 2016-05-20 07:27:38 -07:00 committed by Commit bot
parent 3be9923105
commit 8775112717

View File

@ -140,13 +140,13 @@ sk_sp<SkImage> SkImage_Gpu::onMakeSubset(const SkIRect& subset) const {
desc.fWidth = subset.width();
desc.fHeight = subset.height();
GrTexture* subTx = ctx->textureProvider()->createTexture(desc, fBudgeted);
sk_sp<GrTexture> subTx(ctx->textureProvider()->createTexture(desc, fBudgeted));
if (!subTx) {
return nullptr;
}
ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0));
ctx->copySurface(subTx.get(), fTexture, subset, SkIPoint::Make(0, 0));
return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
fAlphaType, subTx, fBudgeted);
fAlphaType, subTx.get(), fBudgeted);
}
///////////////////////////////////////////////////////////////////////////////////////////////////