aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.fp19
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h16
2 files changed, 21 insertions, 14 deletions
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp
index 762093ef15..6cc5820fd0 100644
--- a/src/gpu/effects/GrConfigConversionEffect.fp
+++ b/src/gpu/effects/GrConfigConversionEffect.fp
@@ -53,15 +53,20 @@
// draw
readRTC->discard();
- GrSurfaceDesc desc;
- desc.fWidth = kSize;
- desc.fHeight = kSize;
- desc.fConfig = kConfig;
-
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kYes, data, 0);
+ SkPixmap pixmap(ii, srcData, 4 * kSize);
+
+ // This function is only ever called if we are in a GrContext that has a GrGpu since we are
+ // calling read pixels here. Thus the pixel data will be uploaded immediately and we don't
+ // need to keep the pixel data alive in the proxy. Therefore the ReleaseProc is nullptr.
+ sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
+
+ sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(std::move(image),
+ kNone_GrSurfaceFlags,
+ 1,
+ SkBudgeted::kYes,
+ SkBackingFit::kExact);
if (!dataProxy) {
return false;
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index ca3cd85200..0decae9689 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -57,15 +57,17 @@ public:
// draw
readRTC->discard();
- GrSurfaceDesc desc;
- desc.fWidth = kSize;
- desc.fHeight = kSize;
- desc.fConfig = kConfig;
-
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- sk_sp<GrTextureProxy> dataProxy =
- proxyProvider->createTextureProxy(desc, SkBudgeted::kYes, data, 0);
+ SkPixmap pixmap(ii, srcData, 4 * kSize);
+
+ // This function is only ever called if we are in a GrContext that has a GrGpu since we are
+ // calling read pixels here. Thus the pixel data will be uploaded immediately and we don't
+ // need to keep the pixel data alive in the proxy. Therefore the ReleaseProc is nullptr.
+ sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
+
+ sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(
+ std::move(image), kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, SkBackingFit::kExact);
if (!dataProxy) {
return false;
}