Index: src/effects/SkBlurMaskFilter.cpp |
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp |
index 41f0d8dc7fc6c7933cd95988fc3de2ffcc4d2bd1..574a9af2b6e6a4a87efc29cbdf0149224470d4eb 100644 |
--- a/src/effects/SkBlurMaskFilter.cpp |
+++ b/src/effects/SkBlurMaskFilter.cpp |
@@ -617,7 +617,8 @@ public: |
/** |
* Create a simple filter effect with custom bicubic coefficients. |
*/ |
- static GrFragmentProcessor* Create(GrContext *context, const SkRect& rect, float sigma) { |
+ static GrFragmentProcessor* Create(GrTextureProvider *textureProvider, const SkRect& rect, |
+ float sigma) { |
GrTexture *blurProfileTexture = NULL; |
int doubleProfileSize = SkScalarCeilToInt(12*sigma); |
@@ -628,7 +629,8 @@ public: |
return NULL; |
} |
- bool createdBlurProfileTexture = CreateBlurProfileTexture(context, sigma, &blurProfileTexture); |
+ bool createdBlurProfileTexture = CreateBlurProfileTexture( |
+ textureProvider, sigma, &blurProfileTexture); |
SkAutoTUnref<GrTexture> hunref(blurProfileTexture); |
if (!createdBlurProfileTexture) { |
return NULL; |
@@ -645,7 +647,7 @@ private: |
void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
- static bool CreateBlurProfileTexture(GrContext *context, float sigma, |
+ static bool CreateBlurProfileTexture(GrTextureProvider*, float sigma, |
GrTexture **blurProfileTexture); |
SkRect fRect; |
@@ -748,7 +750,7 @@ void GrGLRectBlurEffect::setData(const GrGLProgramDataManager& pdman, |
pdman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma())); |
} |
-bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, |
+bool GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* textureProvider, float sigma, |
GrTexture **blurProfileTexture) { |
GrSurfaceDesc texDesc; |
@@ -767,19 +769,19 @@ bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, |
uint8_t *profile = NULL; |
SkAutoTDeleteArray<uint8_t> ada(NULL); |
- *blurProfileTexture = context->findAndRefCachedTexture(key); |
+ *blurProfileTexture = textureProvider->findAndRefTextureByUniqueKey(key); |
if (NULL == *blurProfileTexture) { |
SkBlurMask::ComputeBlurProfile(sigma, &profile); |
ada.reset(profile); |
- *blurProfileTexture = context->createTexture(texDesc, true, profile, 0); |
+ *blurProfileTexture = textureProvider->createTexture(texDesc, true, profile, 0); |
if (NULL == *blurProfileTexture) { |
return false; |
} |
- context->addResourceToCache(key, *blurProfileTexture); |
+ textureProvider->assignUniqueKeyToTexture(key, *blurProfileTexture); |
} |
return true; |
@@ -825,7 +827,8 @@ GrFragmentProcessor* GrRectBlurEffect::TestCreate(SkRandom* random, |
float sigma = random->nextRangeF(3,8); |
float width = random->nextRangeF(200,300); |
float height = random->nextRangeF(200,300); |
- return GrRectBlurEffect::Create(context, SkRect::MakeWH(width, height), sigma); |
+ return GrRectBlurEffect::Create(context->textureProvider(), SkRect::MakeWH(width, height), |
+ sigma); |
} |
@@ -855,7 +858,8 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, |
int pad=SkScalarCeilToInt(6*xformedSigma)/2; |
rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); |
- SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(context, rect, xformedSigma)); |
+ SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create( |
+ context->textureProvider(), rect, xformedSigma)); |
if (!fp) { |
return false; |
} |
@@ -927,7 +931,8 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma, |
builder[1] = cornerRadius; |
builder.finish(); |
- SkAutoTUnref<GrTexture> blurNinePatchTexture(context->findAndRefCachedTexture(key)); |
+ SkAutoTUnref<GrTexture> blurNinePatchTexture( |
+ context->textureProvider()->findAndRefTextureByUniqueKey(key)); |
if (!blurNinePatchTexture) { |
SkMask mask; |
@@ -964,12 +969,13 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma, |
texDesc.fHeight = texSide; |
texDesc.fConfig = kAlpha_8_GrPixelConfig; |
- blurNinePatchTexture.reset(context->createTexture(texDesc, true, blurredMask.fImage, 0)); |
+ blurNinePatchTexture.reset( |
+ context->textureProvider()->createTexture(texDesc, true, blurredMask.fImage, 0)); |
SkMask::FreeImage(blurredMask.fImage); |
if (!blurNinePatchTexture) { |
return NULL; |
} |
- context->addResourceToCache(key, blurNinePatchTexture); |
+ context->textureProvider()->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
} |
return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture)); |
} |