aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRectBlurEffect.fp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/GrRectBlurEffect.fp')
-rw-r--r--src/gpu/effects/GrRectBlurEffect.fp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index 762942aaa4..7057a8e173 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -52,16 +52,24 @@ uniform half profileSize;
sk_sp<GrTextureProxy> blurProfile(proxyProvider->findOrCreateProxyByUniqueKey(
key, kTopLeft_GrSurfaceOrigin));
if (!blurProfile) {
- GrSurfaceDesc texDesc;
- texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
- texDesc.fWidth = profileSize;
- texDesc.fHeight = 1;
- texDesc.fConfig = kAlpha_8_GrPixelConfig;
+ SkImageInfo ii = SkImageInfo::MakeA8(profileSize, 1);
- std::unique_ptr<uint8_t[]> profile(SkBlurMask::ComputeBlurProfile(sigma));
+ SkBitmap bitmap;
+ if (!bitmap.tryAllocPixels(ii)) {
+ return nullptr;
+ }
+
+ SkBlurMask::ComputeBlurProfile(bitmap.getAddr8(0, 0), profileSize, sigma);
+ bitmap.setImmutable();
+
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
+ if (!image) {
+ return nullptr;
+ }
- blurProfile = proxyProvider->createTextureProxy(texDesc, SkBudgeted::kYes,
- profile.get(), 0);
+ blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags,
+ kTopLeft_GrSurfaceOrigin, 1,
+ SkBudgeted::kYes, SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
}