aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRectBlurEffect.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/GrRectBlurEffect.h')
-rw-r--r--src/gpu/effects/GrRectBlurEffect.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h
index 91177072a1..b6b8a029f1 100644
--- a/src/gpu/effects/GrRectBlurEffect.h
+++ b/src/gpu/effects/GrRectBlurEffect.h
@@ -32,16 +32,24 @@ public:
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;
}