Revert "Revert "Mark wrapped textures imported into SkImages as "read only".""
This reverts commit ff4ccaa9fcfbcf29c476eda973febf4b2d6dc974.
Bug: skia:8509
Change-Id: If4a059d6e6e412ec1d6be2c70663d59c362e91d2
Reviewed-on: https://skia-review.googlesource.com/c/175249
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index b6cc28d..8b86721 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -574,8 +574,8 @@
const bool isProtectedContent = fIsProtectedContent;
sk_sp<GrTextureProxy> texProxy = proxyProvider->createLazyProxy(
- [context, hardwareBuffer, width, height, pixelConfig, isProtectedContent, backendFormat]
- (GrResourceProvider* resourceProvider) {
+ [context, hardwareBuffer, width, height, pixelConfig, isProtectedContent,
+ backendFormat](GrResourceProvider* resourceProvider) {
if (!resourceProvider) {
AHardwareBuffer_release(hardwareBuffer);
return sk_sp<GrTexture>();
@@ -596,7 +596,8 @@
SkASSERT(deleteImageProc && deleteImageCtx);
backendTex.fConfig = pixelConfig;
- sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture(backendTex);
+ sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture(
+ backendTex, kBorrow_GrWrapOwnership, kRead_GrIOType);
if (!tex) {
deleteImageProc(deleteImageCtx);
return sk_sp<GrTexture>();
@@ -610,8 +611,8 @@
return tex;
},
- backendFormat, desc, fSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
- SkBudgeted::kNo);
+ backendFormat, desc, fSurfaceOrigin, GrMipMapped::kNo,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo);
if (!texProxy) {
AHardwareBuffer_release(hardwareBuffer);