From a47639620c40397939ae4d79c08d5d8f460bad5c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 27 Feb 2021 01:46:34 +0200 Subject: [PATCH] Fixes for compatibility with legacy unsized PixelFormats --- source/core/pixelformat.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/core/pixelformat.cpp b/source/core/pixelformat.cpp index 87191c34..8cc7c9c9 100644 --- a/source/core/pixelformat.cpp +++ b/source/core/pixelformat.cpp @@ -31,7 +31,7 @@ void operator>>(const LexicalConverter &conv, PixelComponents &comp) else if(conv.get()=="LUMINANCE_ALPHA") comp = LUMINANCE_ALPHA; else - throw lexical_error(format("conversion of '%s' to PixelFormat", conv.get())); + throw lexical_error(format("conversion of '%s' to PixelComponents", conv.get())); } void operator>>(const LexicalConverter &conv, PixelFormat &fmt) @@ -82,9 +82,16 @@ void operator>>(const LexicalConverter &conv, PixelFormat &fmt) fmt = DEPTH_COMPONENT32F; else { - PixelComponents comp; - conv >> comp; - fmt = make_pixelformat(comp, (comp==DEPTH_COMPONENT ? FLOAT : UNSIGNED_BYTE)); + if(conv.get()=="SRGB") + fmt = SRGB8; + else if(conv.get()=="SRGB_ALPHA") + fmt = SRGB8_ALPHA8; + else + { + PixelComponents comp; + conv >> comp; + fmt = make_pixelformat(comp, (comp==DEPTH_COMPONENT ? FLOAT : UNSIGNED_BYTE)); + } IO::print(IO::cerr, "Warning: deprecated conversion of '%s' to PixelFormat\n", conv.get()); } } -- 2.43.0