aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp19
-rw-r--r--src/effects/SkTableColorFilter.cpp14
-rw-r--r--src/effects/gradients/SkGradientShader.cpp7
3 files changed, 7 insertions, 33 deletions
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 88e6caddb9..2668728366 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -996,10 +996,10 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
SkPerlinNoiseShader::PaintingData* paintingData =
SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix));
- GrTexture* permutationsTexture = GrLockAndRefCachedBitmapTexture(
- context, paintingData->getPermutationsBitmap(), NULL);
- GrTexture* noiseTexture = GrLockAndRefCachedBitmapTexture(
- context, paintingData->getNoiseBitmap(), NULL);
+ SkAutoTUnref<GrTexture> permutationsTexture(
+ GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), NULL));
+ SkAutoTUnref<GrTexture> noiseTexture(
+ GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), NULL));
SkMatrix m = context->getMatrix();
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
@@ -1015,17 +1015,6 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
SkDELETE(paintingData);
*fp = NULL;
}
-
- // Unlock immediately, this is not great, but we don't have a way of
- // knowing when else to unlock it currently. TODO: Remove this when
- // unref becomes the unlock replacement for all types of textures.
- if (permutationsTexture) {
- GrUnlockAndUnrefCachedBitmapTexture(permutationsTexture);
- }
- if (noiseTexture) {
- GrUnlockAndUnrefCachedBitmapTexture(noiseTexture);
- }
-
return true;
}
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 4853f73e5c..bed99fc9de 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -418,7 +418,6 @@ void ColorTableEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
}
}
-
///////////////////////////////////////////////////////////////////////////////
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect);
@@ -434,19 +433,10 @@ GrFragmentProcessor* ColorTableEffect::TestCreate(SkRandom* random,
GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* context) const {
SkBitmap bitmap;
- GrFragmentProcessor* fp = NULL;
this->asComponentTable(&bitmap);
// passing NULL because this effect does no tiling or filtering.
- GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, bitmap, NULL);
- if (texture) {
- fp = ColorTableEffect::Create(texture, fFlags);
-
- // Unlock immediately, this is not great, but we don't have a way of
- // knowing when else to unlock it currently. TODO: Remove this when
- // unref becomes the unlock replacement for all types of textures.
- GrUnlockAndUnrefCachedBitmapTexture(texture);
- }
- return fp;
+ SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, bitmap, NULL));
+ return texture ? ColorTableEffect::Create(texture, fFlags) : NULL;
}
#endif // SK_SUPPORT_GPU
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index d25873b438..39f0e75df1 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1164,15 +1164,10 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture());
fTextureAccess.reset(fAtlas->getTexture(), params);
} else {
- GrTexture* texture = GrLockAndRefCachedBitmapTexture(ctx, bitmap, &params);
+ SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap, &params));
fCoordTransform.reset(kCoordSet, matrix, texture);
fTextureAccess.reset(texture, params);
fYCoord = SK_ScalarHalf;
-
- // Unlock immediately, this is not great, but we don't have a way of
- // knowing when else to unlock it currently, so it may get purged from
- // the cache, but it'll still be ref'd until it's no longer being used.
- GrUnlockAndUnrefCachedBitmapTexture(texture);
}
this->addTextureAccess(&fTextureAccess);
}