Revert "Exercise newly exposed SkYUVIndex-based SkImage factories"
This reverts commit e1c1d4d09c
.
Reason for revert: Crashing on bots that abandon the GPU context
Original change's description:
> Exercise newly exposed SkYUVIndex-based SkImage factories
>
> Bug: skia:7903
> Change-Id: I04630ebec37b087423e8305cc1716544fa00a403
> Reviewed-on: https://skia-review.googlesource.com/c/160020
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=jvanverth@google.com,robertphillips@google.com
Change-Id: I5cd5eca3aa55feb73737643dbe05a374a6fd7842
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7903
Reviewed-on: https://skia-review.googlesource.com/c/160026
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
d109503b69
commit
bd16a1bcb3
@ -13,12 +13,6 @@
|
||||
#include "SkPath.h"
|
||||
#include "SkYUVAIndex.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrBackendSurface.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrGpu.h"
|
||||
#endif
|
||||
|
||||
static const int kTileWidthHeight = 128;
|
||||
static const int kLabelWidth = 64;
|
||||
static const int kLabelHeight = 32;
|
||||
@ -713,9 +707,7 @@ protected:
|
||||
SkPath path = create_splat(origin, innerRadius, outerRadius, 1.0f, 7, &circles);
|
||||
fOriginalBMs[1] = make_bitmap(path, circles, true);
|
||||
}
|
||||
}
|
||||
|
||||
void createImages(GrContext* context) {
|
||||
for (bool opaque : { false, true }) {
|
||||
for (int cs = kJPEG_SkYUVColorSpace; cs <= kLastEnum_SkYUVColorSpace; ++cs) {
|
||||
PlaneData planes;
|
||||
@ -726,63 +718,17 @@ protected:
|
||||
SkYUVAIndex yuvaIndices[4];
|
||||
create_YUV(planes, (YUVFormat) format, resultBMs, yuvaIndices, opaque);
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
if (context) {
|
||||
GrGpu* gpu = context->contextPriv().getGpu();
|
||||
if (!gpu) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool used[4] = { false, false, false, false };
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (yuvaIndices[i].fIndex >= 0) {
|
||||
SkASSERT(yuvaIndices[i].fIndex < 4);
|
||||
used[yuvaIndices[i].fIndex] = true;
|
||||
}
|
||||
}
|
||||
|
||||
GrBackendTexture yuvaTextures[4];
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (!used[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yuvaTextures[i] = gpu->createTestingOnlyBackendTexture(
|
||||
resultBMs[i].getPixels(),
|
||||
resultBMs[i].width(),
|
||||
resultBMs[i].height(),
|
||||
resultBMs[i].colorType(),
|
||||
false,
|
||||
GrMipMapped::kNo,
|
||||
resultBMs[i].rowBytes());
|
||||
}
|
||||
|
||||
fImages[opaque][cs][format] = SkImage::MakeFromYUVATexturesCopy(
|
||||
context,
|
||||
(SkYUVColorSpace) cs,
|
||||
yuvaTextures,
|
||||
yuvaIndices,
|
||||
{ fOriginalBMs[opaque].width(), fOriginalBMs[opaque].height() },
|
||||
kTopLeft_GrSurfaceOrigin);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
fImages[opaque][cs][format] = make_yuv_gen_image(
|
||||
fOriginalBMs[opaque].info(),
|
||||
(YUVFormat) format,
|
||||
(SkYUVColorSpace) cs,
|
||||
yuvaIndices,
|
||||
resultBMs);
|
||||
}
|
||||
fImages[opaque][cs][format] = make_yuv_gen_image(fOriginalBMs[opaque].info(),
|
||||
(YUVFormat) format,
|
||||
(SkYUVColorSpace) cs,
|
||||
yuvaIndices,
|
||||
resultBMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
this->createImages(canvas->getGrContext());
|
||||
|
||||
int x = kLabelWidth;
|
||||
for (int cs = kJPEG_SkYUVColorSpace; cs <= kLastEnum_SkYUVColorSpace; ++cs) {
|
||||
for (int opaque : { 0, 1 }) {
|
||||
|
@ -198,6 +198,7 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB(
|
||||
// Right now this still only deals with YUV and NV12 formats. Assuming that YUV has different
|
||||
// textures for U and V planes, while NV12 uses same texture for U and V planes.
|
||||
bool nv12 = (yuvaIndices[1].fIndex == yuvaIndices[2].fIndex);
|
||||
auto ct = nv12 ? kRGBA_8888_SkColorType : kAlpha_8_SkColorType;
|
||||
|
||||
// We need to make a copy of the input backend textures because we need to preserve the result
|
||||
// of validate_backend_texture.
|
||||
@ -215,21 +216,11 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB(
|
||||
// at most 4 images sources being passed in, could not have a index more than 3.
|
||||
return nullptr;
|
||||
}
|
||||
SkColorType ct = kUnknown_SkColorType;
|
||||
if (SkYUVAIndex::kY_Index == i || SkYUVAIndex::kA_Index == i) {
|
||||
// The Y and A planes are always kAlpha8 (for now)
|
||||
ct = kAlpha_8_SkColorType;
|
||||
} else {
|
||||
// The UV planes can either be interleaved or planar
|
||||
ct = nv12 ? kRGBA_8888_SkColorType : kAlpha_8_SkColorType;
|
||||
}
|
||||
|
||||
if (!yuvaTexturesCopy[yuvaIndex.fIndex].isValid()) {
|
||||
yuvaTexturesCopy[yuvaIndex.fIndex] = yuvaTextures[yuvaIndex.fIndex];
|
||||
// TODO: Instead of using assumption about whether it is NV12 format to guess colorType,
|
||||
// actually use channel information here.
|
||||
if (!ValidateBackendTexture(ctx, yuvaTexturesCopy[yuvaIndex.fIndex],
|
||||
&yuvaTexturesCopy[yuvaIndex.fIndex].fConfig,
|
||||
if (!ValidateBackendTexture(ctx, yuvaTexturesCopy[i], &yuvaTexturesCopy[i].fConfig,
|
||||
ct, kPremul_SkAlphaType, nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -246,7 +237,7 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB(
|
||||
|
||||
// Safely ignore since this means we are missing the A plane.
|
||||
if (textureIndex == -1) {
|
||||
SkASSERT(SkYUVAIndex::kA_Index == i);
|
||||
SkASSERT(3 == i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user