Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1589)

Unified Diff: src/effects/SkBlurMaskFilter.cpp

Issue 868233005: Revert of Move npot resizing out of GrContext and simplify GrContext texture functions. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, &params);
if (NULL == *blurProfileTexture) {
SkBlurMask::ComputeBlurProfile(sigma, &profile);
ada.reset(profile);
- *blurProfileTexture = context->createTexture(texDesc, profile, 0);
+ *blurProfileTexture = context->createTexture(&params, 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, &params);
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(&params, texDesc, key, blurred_mask.fImage, 0);
SkMask::FreeImage(blurred_mask.fImage);
}
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698