aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkPerlinNoiseShader.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2014-10-07 15:07:38 -0400
committerGravatar Brian Salomon <bsalomon@google.com>2014-10-07 15:07:38 -0400
commit9323b8b8e16df4adcd63ee8496a6382e8df535c9 (patch)
tree12ff0bd9f07193593b7db1d52ef2fe0478c00aeb /src/effects/SkPerlinNoiseShader.cpp
parent65be97d1a1eb5923b078bd1e7ec1e7da6e6427e2 (diff)
Revert "GrResourceCache2 manages scratch texture."
Diffstat (limited to 'src/effects/SkPerlinNoiseShader.cpp')
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 861e829237..43197dedf2 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -997,10 +997,10 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
SkPerlinNoiseShader::PaintingData* paintingData =
SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix));
- SkAutoTUnref<GrTexture> permutationsTexture(
- GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), NULL));
- SkAutoTUnref<GrTexture> noiseTexture(
- GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), NULL));
+ GrTexture* permutationsTexture = GrLockAndRefCachedBitmapTexture(
+ context, paintingData->getPermutationsBitmap(), NULL);
+ GrTexture* noiseTexture = GrLockAndRefCachedBitmapTexture(
+ context, paintingData->getNoiseBitmap(), NULL);
SkMatrix m = context->getMatrix();
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
@@ -1016,6 +1016,17 @@ 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;
}