Revert "Remove legacy SkImage::MakeFromYUVATextures."
This reverts commit df29db4c41893ecdfb2735e8f5a935e4ce57be55.
Reason for revert: blocking the G3 roll
Original change's description:
> Remove legacy SkImage::MakeFromYUVATextures.
>
> Bug: skia:10632
> Change-Id: Iad8989e0ae5aa6921e8e2e27ba375221f2af0262
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336959
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Id77c1679a96ad9c1be93e6e29449cc4785a3983b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337183
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 59e2db7..2ca69ad 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -7,10 +7,6 @@
Milestone 89
------------
- * Removed deperated version of MakeFromYUVATextures. Use the version
- that takes GrYUVABackendTextures instead.
- https://review.skia.org/336959
-
* Add MTLBinaryArchive parameter to GrMtlBackendContext. This allows
Skia to cache PipelineStates in the given archive for faster
shader compiles on future runs. The client must handle loading and
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 737e4c2..41a25a6 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -452,6 +452,38 @@
TextureReleaseProc rgbaReleaseProc = nullptr,
ReleaseContext rgbaReleaseContext = nullptr);
+ /**
+ Deprecated. Use version that takes GrYUVABackendTextures.
+
+ Creates an SkImage by storing the specified YUVA planes into an image, to be rendered
+ via multitexturing.
+
+ When all the provided backend textures can be released 'textureReleaseProc' will be called
+ with 'releaseContext'. It will be called even if this method fails.
+
+ @param context GPU context
+ @param yuvColorSpace How the YUV values are converted to RGB
+ @param yuvaTextures array of (up to four) YUVA textures on GPU which contain the,
+ possibly interleaved, YUVA planes
+ @param yuvaIndices array indicating which texture in yuvaTextures, and channel
+ in that texture, maps to each component of YUVA.
+ @param imageSize size of the resulting image
+ @param textureOrigin origin of the input textures.
+ @param imageColorSpace range of colors of the resulting image; may be nullptr
+ @param textureReleaseProc called when the backend textures can be released
+ @param releaseContext state passed to textureReleaseProc
+ @return created SkImage, or nullptr
+ */
+ static sk_sp<SkImage> MakeFromYUVATextures(GrRecordingContext* context,
+ SkYUVColorSpace yuvColorSpace,
+ const GrBackendTexture yuvaTextures[],
+ const SkYUVAIndex yuvaIndices[4],
+ SkISize imageSize,
+ GrSurfaceOrigin textureOrigin,
+ sk_sp<SkColorSpace> imageColorSpace = nullptr,
+ TextureReleaseProc textureReleaseProc = nullptr,
+ ReleaseContext releaseContext = nullptr);
+
/** Creates SkImage from SkYUVAPixmaps.
The image will remain planar with each plane converted to a texture using the passed
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 1764dad..ea9ccf5 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -273,6 +273,33 @@
imageColorSpace);
}
+sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrRecordingContext* ctx,
+ SkYUVColorSpace colorSpace,
+ const GrBackendTexture yuvaTextures[],
+ const SkYUVAIndex yuvaIndices[4],
+ SkISize imageSize,
+ GrSurfaceOrigin textureOrigin,
+ sk_sp<SkColorSpace> imageColorSpace,
+ TextureReleaseProc textureReleaseProc,
+ ReleaseContext releaseContext) {
+ auto releaseHelper = GrRefCntedCallback::Make(textureReleaseProc, releaseContext);
+
+ int numTextures;
+ if (!SkYUVAIndex::AreValidIndices(yuvaIndices, &numTextures)) {
+ return nullptr;
+ }
+
+ GrSurfaceProxyView tempViews[4];
+ if (!SkImage_GpuBase::MakeTempTextureProxies(ctx, yuvaTextures, numTextures, yuvaIndices,
+ textureOrigin, tempViews,
+ std::move(releaseHelper))) {
+ return nullptr;
+ }
+
+ return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(ctx), imageSize, kNeedNewImageUniqueID, colorSpace,
+ tempViews, numTextures, yuvaIndices, imageColorSpace);
+}
+
sk_sp<SkImage> SkImage::MakeFromYUVAPixmaps(GrRecordingContext* context,
const SkYUVAPixmaps& pixmaps,
GrMipMapped buildMips,