Cleanup kGray_8 readback.

Rm unused function SkColorTypeIsGray.

Expect kGray_8 readback to work in tests.

Bug: skia:8962

Change-Id: Iad9d2be3e0a2e594e62dc681b79c59e0a833116a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245162
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2019-11-04 16:59:29 -05:00 committed by Skia Commit-Bot
parent 73a722ce97
commit b3bd86405b
5 changed files with 24 additions and 33 deletions

View File

@ -58,13 +58,6 @@ static inline bool SkAlphaTypeIsValid(unsigned value) {
return value <= kLastEnum_SkAlphaType;
}
static inline bool SkColorTypeIsGray(SkColorType ct) {
auto flags = SkColorTypeComponentFlags(ct);
// Currently assuming that a color type has only gray or does not have gray.
SkASSERT(!(kGray_SkColorTypeComponentFlag & flags) || kGray_SkColorTypeComponentFlag == flags);
return kGray_SkColorTypeComponentFlag == flags;
}
static int SkColorTypeShiftPerPixel(SkColorType ct) {
switch (ct) {
case kUnknown_SkColorType: return 0;

View File

@ -260,7 +260,7 @@ static GrSwizzle get_load_and_src_swizzle(GrColorType ct, SkRasterPipeline::Stoc
}
static GrSwizzle get_dst_swizzle_and_store(GrColorType ct, SkRasterPipeline::StockStage* store,
bool* doLumToAlpha, bool* isNormalized, bool* isSRGB) {
bool* doLumToAlpha, bool* isNormalized, bool* isSRGB) {
GrSwizzle swizzle("rgba");
*isNormalized = true;
*isSRGB = false;

View File

@ -1530,9 +1530,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixels(
return;
}
auto dstCT = SkColorTypeToGrColorType(info.colorType());
// TODO: Support reading to gray.
if (dstCT == GrColorType::kUnknown ||
GrColorTypeComponentFlags(dstCT) & kGray_SkColorTypeComponentFlag) {
if (dstCT == GrColorType::kUnknown) {
callback(context, nullptr);
return;
}

View File

@ -690,8 +690,8 @@ static void gpu_read_pixels_test_driver(skiatest::Reporter* reporter,
} else if (!rules.fAllowUnpremulRead && readAT == kUnpremul_SkAlphaType) {
REPORTER_ASSERT(reporter, !success);
} else if (!success) {
// TODO: Support reading to kGray, support kRGB_101010x at all in GPU.
if (readCT != kGray_8_SkColorType && readCT != kRGB_101010x_SkColorType) {
// TODO: Support kRGB_101010x at all in GPU.
if (readCT != kRGB_101010x_SkColorType) {
ERRORF(reporter,
"Read failed. Src CT: %s, Src AT: %s Read CT: %s, Read AT: %s, "
"Rect [%d, %d, %d, %d], CS conversion: %d\n",

View File

@ -432,7 +432,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TransferPixelsToTest, reporter, ctxInfo) {
GrColorType::kRG_88,
GrColorType::kBGRA_8888,
GrColorType::kRGBA_1010102,
// GrColorType::kGray_8, Reading back to kGray is busted.
GrColorType::kGray_8,
GrColorType::kAlpha_F16,
GrColorType::kRGBA_F16,
GrColorType::kRGBA_F16_Clamped,
@ -454,25 +454,25 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TransferPixelsFromTest, reporter, ctxInfo) {
}
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
for (auto colorType : {
GrColorType::kAlpha_8,
GrColorType::kAlpha_16,
GrColorType::kBGR_565,
GrColorType::kABGR_4444,
GrColorType::kRGBA_8888,
GrColorType::kRGBA_8888_SRGB,
// GrColorType::kRGB_888x, Broken in GL until we have kRGB_888
GrColorType::kRG_88,
GrColorType::kBGRA_8888,
GrColorType::kRGBA_1010102,
// GrColorType::kGray_8, Reading back to kGray is busted.
GrColorType::kAlpha_F16,
GrColorType::kRGBA_F16,
GrColorType::kRGBA_F16_Clamped,
GrColorType::kRGBA_F32,
GrColorType::kRG_1616,
GrColorType::kRGBA_16161616,
GrColorType::kRG_F16,
}) {
GrColorType::kAlpha_8,
GrColorType::kAlpha_16,
GrColorType::kBGR_565,
GrColorType::kABGR_4444,
GrColorType::kRGBA_8888,
GrColorType::kRGBA_8888_SRGB,
// GrColorType::kRGB_888x, Broken in GL until we have kRGB_888
GrColorType::kRG_88,
GrColorType::kBGRA_8888,
GrColorType::kRGBA_1010102,
GrColorType::kGray_8,
GrColorType::kAlpha_F16,
GrColorType::kRGBA_F16,
GrColorType::kRGBA_F16_Clamped,
GrColorType::kRGBA_F32,
GrColorType::kRG_1616,
GrColorType::kRGBA_16161616,
GrColorType::kRG_F16,
}) {
basic_transfer_from_test(reporter, ctxInfo, colorType, renderable);
}
}