Index: src/effects/SkBlurMaskFilter.cpp |
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp |
index d284717f936a34bc92514949f58c302cdc38cf59..3487ae40b49af51ebc8ccf3d01dcbea2e839b92b 100644 |
--- a/src/effects/SkBlurMaskFilter.cpp |
+++ b/src/effects/SkBlurMaskFilter.cpp |
@@ -750,6 +750,7 @@ |
bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, |
GrTexture **blurProfileTexture) { |
+ GrTextureParams params; |
GrSurfaceDesc texDesc; |
unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
@@ -767,19 +768,18 @@ |
uint8_t *profile = NULL; |
SkAutoTDeleteArray<uint8_t> ada(NULL); |
- *blurProfileTexture = context->findAndRefCachedTexture(key); |
+ *blurProfileTexture = context->findAndRefTexture(texDesc, key, ¶ms); |
if (NULL == *blurProfileTexture) { |
SkBlurMask::ComputeBlurProfile(sigma, &profile); |
ada.reset(profile); |
- *blurProfileTexture = context->createTexture(texDesc, profile, 0); |
+ *blurProfileTexture = context->createTexture(¶ms, texDesc, key, profile, 0); |
if (NULL == *blurProfileTexture) { |
return false; |
} |
- SkAssertResult(context->addResourceToCache(key, *blurProfileTexture)); |
} |
return true; |
@@ -925,12 +925,20 @@ |
builder[1] = cornerRadius; |
builder.finish(); |
- GrTexture *blurNinePatchTexture = context->findAndRefCachedTexture(key); |
+ GrTextureParams params; |
+ params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
+ |
+ unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1; |
+ unsigned int texSide = smallRectSide + 2*blurRadius; |
+ GrSurfaceDesc texDesc; |
+ texDesc.fWidth = texSide; |
+ texDesc.fHeight = texSide; |
+ texDesc.fConfig = kAlpha_8_GrPixelConfig; |
+ |
+ GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, key, ¶ms); |
if (NULL == blurNinePatchTexture) { |
SkMask mask; |
- |
- unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1; |
mask.fBounds = SkIRect::MakeWH(smallRectSide, smallRectSide); |
mask.fFormat = SkMask::kA8_Format; |
@@ -949,22 +957,12 @@ |
SkPath path; |
path.addRRect( smallRRect ); |
- SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask, |
- SkMask::kJustRenderImage_CreateMode, SkPaint::kFill_Style); |
+ SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask, SkMask::kJustRenderImage_CreateMode, SkPaint::kFill_Style); |
SkMask blurred_mask; |
- SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, kNormal_SkBlurStyle, kHigh_SkBlurQuality, |
- NULL, true ); |
- |
- unsigned int texSide = smallRectSide + 2*blurRadius; |
- GrSurfaceDesc texDesc; |
- texDesc.fWidth = texSide; |
- texDesc.fHeight = texSide; |
- texDesc.fConfig = kAlpha_8_GrPixelConfig; |
- |
- blurNinePatchTexture = context->createTexture(texDesc, blurred_mask.fImage, 0); |
- SkAssertResult(context->addResourceToCache(key, blurNinePatchTexture)); |
- |
+ SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, kNormal_SkBlurStyle, kHigh_SkBlurQuality, NULL, true ); |
+ |
+ blurNinePatchTexture = context->createTexture(¶ms, texDesc, key, blurred_mask.fImage, 0); |
SkMask::FreeImage(blurred_mask.fImage); |
} |