Always supply a color space (sRGB for now) with F16

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2177193004

Review-Url: https://codereview.chromium.org/2177193004
This commit is contained in:
brianosman 2016-07-26 08:11:50 -07:00 committed by Commit bot
parent f660b7cfcf
commit efded51cd8
7 changed files with 11 additions and 8 deletions

View File

@ -466,7 +466,7 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
CPU_CONFIG(srgb, kRaster_Backend,
kN32_SkColorType, kPremul_SkAlphaType, srgbColorSpace)
CPU_CONFIG(f16, kRaster_Backend,
kRGBA_F16_SkColorType, kPremul_SkAlphaType, nullptr)
kRGBA_F16_SkColorType, kPremul_SkAlphaType, srgbColorSpace)
}
#undef CPU_CONFIG

View File

@ -862,7 +862,7 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
SINK("565", RasterSink, kRGB_565_SkColorType);
SINK("8888", RasterSink, kN32_SkColorType);
SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace);
SINK("f16", RasterSink, kRGBA_F16_SkColorType);
SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbColorSpace);
SINK("pdf", PDFSink);
SINK("skp", SKPSink);
SINK("svg", SVGSink);

View File

@ -53,7 +53,7 @@ const struct {
} gConfig[] = {
{ kN32_SkColorType, false, "L32" },
{ kN32_SkColorType, true, "S32" },
{ kRGBA_F16_SkColorType, false, "F16" },
{ kRGBA_F16_SkColorType, true, "F16" },
};
static const char* find_config_name(const SkImageInfo& info) {

View File

@ -243,8 +243,11 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
const GrCaps* caps = ctx->caps();
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
if (caps->srgbSupport() && !GrPixelConfigIsSRGB(desc.fConfig) &&
pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSRGB()) {
if (caps->srgbSupport() &&
pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSRGB() &&
!(GrPixelConfigIsSRGB(desc.fConfig) ||
kRGBA_half_GrPixelConfig == desc.fConfig ||
kRGBA_float_GrPixelConfig == desc.fConfig)) {
// We were supplied an sRGB-like color space, but we don't have a suitable pixel config.
// Convert to 8888 sRGB so we can handle the data correctly. The raster backend doesn't
// handle sRGB Index8 -> sRGB 8888 correctly (yet), so lie about both the source and

View File

@ -121,7 +121,7 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu());
REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == nullptr);
REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kN32_SkColorType);
REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());

View File

@ -284,7 +284,7 @@ static bool parse_option_gpu_color(const SkString& value,
}
if (value.equals("f16")) {
*outColorType = kRGBA_F16_SkColorType;
*outColorSpace = nullptr;
*outColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
return true;
}
if (value.equals("srgb")) {

View File

@ -167,7 +167,7 @@ struct ColorAndProfile {
ColorAndProfile ColorModes[] = {
{ kN32_SkColorType, false, false },
{ kN32_SkColorType, true, true },
{ kRGBA_F16_SkColorType, false, true },
{ kRGBA_F16_SkColorType, true, true },
};
}