Remove unused variant of SkImage::MakeFromYUVAPixmaps
Bug: skia:10632 Change-Id: I337d79d856945071b2b68651a80013184d443267 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322480 Commit-Queue: Brian Salomon <bsalomon@google.com> Commit-Queue: Adlai Holler <adlai@google.com> Auto-Submit: Brian Salomon <bsalomon@google.com> Reviewed-by: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
e2c4999ec3
commit
f165f799ae
@ -9,6 +9,11 @@ Milestone 88
|
||||
|
||||
* <insert new release notes here>
|
||||
|
||||
* Removed legacy variant of SkImage::MakeFromYUVAPixmaps. Use the version that
|
||||
takes SkYUVAPixmaps instead. It has a more structured description of the
|
||||
planar configuration.
|
||||
https://review.skia.org/322480
|
||||
|
||||
* Some SkImage YUV image factories have been removed. Replacement patterns
|
||||
outlined below.
|
||||
SkImage::MakeFromYUVATexturesCopy
|
||||
|
@ -1728,13 +1728,8 @@ protected:
|
||||
void onOnceBeforeDraw() override {
|
||||
fOrig = GetResourceAsImage("images/mandrill_256.png");
|
||||
|
||||
SkImageInfo info = SkImageInfo::Make(fOrig->width(), fOrig->height(), kAlpha_8_SkColorType,
|
||||
kPremul_SkAlphaType);
|
||||
SkImageInfo info = SkImageInfo::MakeA8(fOrig->dimensions());
|
||||
fStorage[0].alloc(info);
|
||||
if (0) {
|
||||
// if you want to scale U,V down by 1/2
|
||||
info = info.makeWH(info.width()/2, info.height()/2);
|
||||
}
|
||||
fStorage[1].alloc(info);
|
||||
fStorage[2].alloc(info);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
@ -1754,10 +1749,13 @@ protected:
|
||||
for (auto cs : {kRec709_SkYUVColorSpace, kRec601_SkYUVColorSpace, kJPEG_SkYUVColorSpace,
|
||||
kBT2020_SkYUVColorSpace}) {
|
||||
split_into_yuv(fOrig.get(), cs, fPM);
|
||||
auto img = SkImage::MakeFromYUVAPixmaps(canvas->recordingContext(), cs, fPM, indices,
|
||||
fPM[0].info().dimensions(),
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
false, false, nullptr);
|
||||
SkYUVAInfo yuvaInfo(fOrig->dimensions(), SkYUVAInfo::PlanarConfig::kY_U_V_444, cs);
|
||||
auto yuvaPixmaps = SkYUVAPixmaps::FromExternalPixmaps(yuvaInfo, fPM);
|
||||
auto img = SkImage::MakeFromYUVAPixmaps(canvas->recordingContext(),
|
||||
yuvaPixmaps,
|
||||
GrMipMapped::kNo,
|
||||
/* limit to max tex size */ false,
|
||||
/* color space */ nullptr);
|
||||
if (img) {
|
||||
canvas->drawImage(img, 0, 0, nullptr);
|
||||
draw_diff(canvas, 0, fOrig->height(), fOrig.get(), img.get());
|
||||
|
@ -437,35 +437,6 @@ public:
|
||||
TextureReleaseProc textureReleaseProc = nullptr,
|
||||
ReleaseContext releaseContext = nullptr);
|
||||
|
||||
/** Creates SkImage from pixmap array representing YUVA data.
|
||||
SkImage is uploaded to GPU back-end using context.
|
||||
|
||||
Each GrBackendTexture created from yuvaPixmaps array is uploaded to match SkSurface
|
||||
using SkColorSpace of SkPixmap. SkColorSpace of SkImage is determined by imageColorSpace.
|
||||
|
||||
SkImage is returned referring to GPU back-end if context is not nullptr and
|
||||
format of data is recognized and supported. Otherwise, nullptr is returned.
|
||||
Recognized GPU formats vary by platform and GPU back-end.
|
||||
|
||||
@param context GPU context
|
||||
@param yuvColorSpace How the YUV values are converted to RGB
|
||||
@param yuvaPixmaps array of (up to four) SkPixmap which contain the,
|
||||
possibly interleaved, YUVA planes
|
||||
@param yuvaIndices array indicating which pixmap in yuvaPixmaps, and channel
|
||||
in that pixmap, maps to each component of YUVA.
|
||||
@param imageSize size of the resulting image
|
||||
@param imageOrigin origin of the resulting image.
|
||||
@param buildMips create internal YUVA textures as mip map if true
|
||||
@param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
|
||||
@param imageColorSpace range of colors of the resulting image; may be nullptr
|
||||
@return created SkImage, or nullptr
|
||||
*/
|
||||
static sk_sp<SkImage> MakeFromYUVAPixmaps(
|
||||
GrRecordingContext* context, SkYUVColorSpace yuvColorSpace,
|
||||
const SkPixmap yuvaPixmaps[], const SkYUVAIndex yuvaIndices[4], SkISize imageSize,
|
||||
GrSurfaceOrigin imageOrigin, bool buildMips, bool limitToMaxTextureSize = false,
|
||||
sk_sp<SkColorSpace> imageColorSpace = nullptr);
|
||||
|
||||
/** Creates SkImage from SkYUVAPixmaps.
|
||||
|
||||
The image will remain planar with each plane converted to a texture using the passed
|
||||
|
@ -269,61 +269,6 @@ sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrContext* ctx,
|
||||
imageColorSpace);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage::MakeFromYUVAPixmaps(GrRecordingContext* context,
|
||||
SkYUVColorSpace yuvColorSpace,
|
||||
const SkPixmap yuvaPixmaps[],
|
||||
const SkYUVAIndex yuvaIndices[4], SkISize imageSize,
|
||||
GrSurfaceOrigin imageOrigin, bool buildMips,
|
||||
bool limitToMaxTextureSize,
|
||||
sk_sp<SkColorSpace> imageColorSpace) {
|
||||
if (!context) {
|
||||
return nullptr; // until we impl this for raster backend
|
||||
}
|
||||
|
||||
int numPixmaps;
|
||||
if (!SkYUVAIndex::AreValidIndices(yuvaIndices, &numPixmaps)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!context->priv().caps()->mipmapSupport()) {
|
||||
buildMips = false;
|
||||
}
|
||||
|
||||
// Make proxies
|
||||
GrSurfaceProxyView tempViews[4];
|
||||
int maxTextureSize = context->priv().caps()->maxTextureSize();
|
||||
for (int i = 0; i < numPixmaps; ++i) {
|
||||
const SkPixmap* pixmap = &yuvaPixmaps[i];
|
||||
SkAutoPixmapStorage resized;
|
||||
int maxDim = std::max(yuvaPixmaps[i].width(), yuvaPixmaps[i].height());
|
||||
if (limitToMaxTextureSize && maxDim > maxTextureSize) {
|
||||
float scale = static_cast<float>(maxTextureSize) / maxDim;
|
||||
int newWidth = std::min(static_cast<int>(yuvaPixmaps[i].width() * scale), maxTextureSize);
|
||||
int newHeight =
|
||||
std::min(static_cast<int>(yuvaPixmaps[i].height() * scale), maxTextureSize);
|
||||
SkImageInfo info = yuvaPixmaps[i].info().makeWH(newWidth, newHeight);
|
||||
if (!resized.tryAlloc(info) ||
|
||||
!yuvaPixmaps[i].scalePixels(resized, kLow_SkFilterQuality)) {
|
||||
return nullptr;
|
||||
}
|
||||
pixmap = &resized;
|
||||
}
|
||||
// Turn the pixmap into a GrTextureProxy
|
||||
SkBitmap bmp;
|
||||
bmp.installPixels(*pixmap);
|
||||
GrBitmapTextureMaker bitmapMaker(context, bmp, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
|
||||
GrMipmapped mipMapped = buildMips ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
tempViews[i] = bitmapMaker.view(mipMapped);
|
||||
if (!tempViews[i]) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), imageSize, kNeedNewImageUniqueID,
|
||||
yuvColorSpace, tempViews, numPixmaps, yuvaIndices,
|
||||
imageOrigin, std::move(imageColorSpace));
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage::MakeFromYUVAPixmaps(GrRecordingContext* context,
|
||||
const SkYUVAPixmaps& pixmaps,
|
||||
GrMipMapped buildMips,
|
||||
|
Loading…
Reference in New Issue
Block a user