aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRectBlurEffect.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-14 15:20:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-14 20:46:24 +0000
commitcb25659eb152fe89efb7a44147853dda5e62b38d (patch)
tree0c1b9891fcd73a7aa19f8d656baa97a56f41e64b /src/gpu/effects/GrRectBlurEffect.h
parent9b009bb069aa81425438d5403a1a29f2d047f77f (diff)
DDL-ify GrRectBlurEffect
This allows the upload of the blur profile to be delayed until the draw is actually executed. Change-Id: I10a7e8fb0edc90ef509c418552740a867f1f3df2 Reviewed-on: https://skia-review.googlesource.com/107354 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
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;
}