diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 59e2db7f71..2ca69add1b 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -7,10 +7,6 @@ This file includes a list of high level updates for each milestone release. 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 737e4c2dc6..41a25a62d6 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -452,6 +452,38 @@ public: 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 MakeFromYUVATextures(GrRecordingContext* context, + SkYUVColorSpace yuvColorSpace, + const GrBackendTexture yuvaTextures[], + const SkYUVAIndex yuvaIndices[4], + SkISize imageSize, + GrSurfaceOrigin textureOrigin, + sk_sp 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 1764dadd5a..ea9ccf58d5 100644 --- a/src/image/SkImage_GpuYUVA.cpp +++ b/src/image/SkImage_GpuYUVA.cpp @@ -273,6 +273,33 @@ sk_sp SkImage::MakeFromYUVATextures(GrRecordingContext* context, imageColorSpace); } +sk_sp SkImage::MakeFromYUVATextures(GrRecordingContext* ctx, + SkYUVColorSpace colorSpace, + const GrBackendTexture yuvaTextures[], + const SkYUVAIndex yuvaIndices[4], + SkISize imageSize, + GrSurfaceOrigin textureOrigin, + sk_sp 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(sk_ref_sp(ctx), imageSize, kNeedNewImageUniqueID, colorSpace, + tempViews, numTextures, yuvaIndices, imageColorSpace); +} + sk_sp SkImage::MakeFromYUVAPixmaps(GrRecordingContext* context, const SkYUVAPixmaps& pixmaps, GrMipMapped buildMips,