diff options
Diffstat (limited to 'src/effects/SkBlurMaskFilter.cpp')
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index d85160e651..28b5870560 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -942,23 +942,24 @@ void GrGLRectBlurEffect::onSetData(const GrGLSLProgramDataManager& pdman, sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture( GrResourceProvider* resourceProvider, float sigma) { - GrSurfaceDesc texDesc; - unsigned int profileSize = SkScalarCeilToInt(6*sigma); - texDesc.fWidth = profileSize; - texDesc.fHeight = 1; - texDesc.fConfig = kAlpha_8_GrPixelConfig; - texDesc.fIsMipMapped = false; - static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); GrUniqueKey key; GrUniqueKey::Builder builder(&key, kDomain, 1); builder[0] = profileSize; builder.finish(); - sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(key)); + sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey( + key, kTopLeft_GrSurfaceOrigin)); if (!blurProfile) { + GrSurfaceDesc texDesc; + texDesc.fOrigin = kTopLeft_GrSurfaceOrigin; + texDesc.fWidth = profileSize; + texDesc.fHeight = 1; + texDesc.fConfig = kAlpha_8_GrPixelConfig; + texDesc.fIsMipMapped = false; + std::unique_ptr<uint8_t[]> profile(SkBlurMask::ComputeBlurProfile(sigma)); blurProfile = GrSurfaceProxy::MakeDeferred(resourceProvider, @@ -967,6 +968,7 @@ sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture( return nullptr; } + SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin); resourceProvider->assignUniqueKeyToProxy(key, blurProfile.get()); } @@ -1117,7 +1119,8 @@ static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context, } builder.finish(); - sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey(key)); + sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey( + key, kBottomLeft_GrSurfaceOrigin)); if (!mask) { // TODO: this could be approx but the texture coords will need to be updated sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback( @@ -1154,6 +1157,7 @@ static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context, if (!mask) { return nullptr; } + SkASSERT(mask->origin() == kBottomLeft_GrSurfaceOrigin); context->resourceProvider()->assignUniqueKeyToProxy(key, mask.get()); } |