Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1538)

Unified Diff: src/effects/SkBlurMaskFilter.cpp

Issue 131163007: release the scanline textures in GrRectBlurEffect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use autounref, and clean up more tidy after CreateScanlineTextures in the event that creating the v… Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBlurMaskFilter.cpp
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 5cb98153f0231b539f142c050e820e9d0d1fb0b6..9b3354484b9a02ce5151f65f1557744a7dd84002 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -527,17 +527,18 @@ public:
*/
static GrEffectRef* Create(GrContext *context, const SkRect& rect,
float sigma) {
- GrTexture *horizontalScanline, *verticalScanline;
+ GrTexture *horizontalScanline = NULL, *verticalScanline = NULL;
bool createdScanlines = CreateScanlineTextures(context, sigma,
SkScalarCeilToInt(rect.width()),
SkScalarCeilToInt(rect.height()),
&horizontalScanline, &verticalScanline);
robertphillips 2014/01/31 13:33:10 Won't this potentially cause a problem if the hori
humper 2014/01/31 13:51:17 yeah, I'll land a better fix for this once this pa
- if (!createdScanlines) {
+ SkAutoTUnref<GrTexture> hunref(horizontalScanline), vunref(verticalScanline);
+ if (!createdScanlines) {
return NULL;
}
AutoEffectUnref effect(SkNEW_ARGS(GrRectBlurEffect, (rect, sigma,
horizontalScanline, verticalScanline)));
- return CreateEffectRef(effect);
+ return CreateEffectRef(effect);
}
unsigned int getWidth() const { return fWidth; }
@@ -686,6 +687,7 @@ bool GrRectBlurEffect::CreateScanlineTextures(GrContext *context, float sigma,
verticalPixels, 0);
if (NULL == *verticalScanline) {
+ (*horizontalScanline)->unref();
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698