aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkPerlinNoiseShader.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-30 06:02:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-30 06:02:23 -0700
commit3d398c876440deaab39bbf2a9b881c337e6dc8d4 (patch)
treeb38c23d2b6742c9d515dd2b19a1cf8fca49a16f0 /src/effects/SkPerlinNoiseShader.cpp
parentc0eb9b9818462471f5fc1c47fa549c6052d8bbae (diff)
GrResourceCache2 manages scratch texture.
BUG=skia: R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/608883003
Diffstat (limited to 'src/effects/SkPerlinNoiseShader.cpp')
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp19
1 files changed, 4 insertions, 15 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;
}