Revert "Remove legacy SkImage::MakeFromYUVATextures."

This reverts commit df29db4c41.

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>
This commit is contained in:
Robert Phillips 2020-11-20 21:51:24 +00:00 committed by Skia Commit-Bot
parent 2c21a11923
commit 10089c6a42
3 changed files with 59 additions and 4 deletions

View File

@ -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

View File

@ -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<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

View File

@ -273,6 +273,33 @@ sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrRecordingContext* context,
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,