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

Unified Diff: src/effects/SkBlurMaskFilter.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg 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/SkGr.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 7c534d69e0f9c48e64d025fd45ad198cdc79c58e..3487ae40b49af51ebc8ccf3d01dcbea2e839b92b 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -753,31 +753,29 @@ bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma,
GrTextureParams params;
GrSurfaceDesc texDesc;
- unsigned int profile_size = SkScalarCeilToInt(6*sigma);
+ unsigned int profileSize = SkScalarCeilToInt(6*sigma);
- texDesc.fWidth = profile_size;
+ texDesc.fWidth = profileSize;
texDesc.fHeight = 1;
texDesc.fConfig = kAlpha_8_GrPixelConfig;
- static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomain();
- GrCacheID::Key key;
- memset(&key, 0, sizeof(key));
- key.fData32[0] = profile_size;
- key.fData32[1] = 1;
- GrCacheID blurProfileKey(gBlurProfileDomain, key);
+ static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain();
+ GrContentKey key;
+ GrContentKey::Builder builder(&key, kDomain, 1);
+ builder[0] = profileSize;
+ builder.finish();
uint8_t *profile = NULL;
SkAutoTDeleteArray<uint8_t> ada(NULL);
- *blurProfileTexture = context->findAndRefTexture(texDesc, blurProfileKey, &params);
+ *blurProfileTexture = context->findAndRefTexture(texDesc, key, &params);
if (NULL == *blurProfileTexture) {
SkBlurMask::ComputeBlurProfile(sigma, &profile);
ada.reset(profile);
- *blurProfileTexture = context->createTexture(&params, texDesc, blurProfileKey,
- profile, 0);
+ *blurProfileTexture = context->createTexture(&params, texDesc, key, profile, 0);
if (NULL == *blurProfileTexture) {
return false;
@@ -920,12 +918,12 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma,
return NULL;
}
- static const GrCacheID::Domain gRRectBlurDomain = GrCacheID::GenerateDomain();
- GrCacheID::Key key;
- memset(&key, 0, sizeof(key));
- key.fData32[0] = blurRadius;
- key.fData32[1] = cornerRadius;
- GrCacheID blurRRectNinePatchID(gRRectBlurDomain, key);
+ static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain();
+ GrContentKey key;
+ GrContentKey::Builder builder(&key, kDomain, 2);
+ builder[0] = blurRadius;
+ builder[1] = cornerRadius;
+ builder.finish();
GrTextureParams params;
params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
@@ -937,7 +935,7 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma,
texDesc.fHeight = texSide;
texDesc.fConfig = kAlpha_8_GrPixelConfig;
- GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, blurRRectNinePatchID, &params);
+ GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, key, &params);
if (NULL == blurNinePatchTexture) {
SkMask mask;
@@ -964,7 +962,7 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma,
SkMask blurred_mask;
SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, kNormal_SkBlurStyle, kHigh_SkBlurQuality, NULL, true );
- blurNinePatchTexture = context->createTexture(&params, texDesc, blurRRectNinePatchID, blurred_mask.fImage, 0);
+ blurNinePatchTexture = context->createTexture(&params, texDesc, key, blurred_mask.fImage, 0);
SkMask::FreeImage(blurred_mask.fImage);
}
« no previous file with comments | « include/gpu/SkGr.h ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698