From: Mikko Rasa Date: Fri, 26 Feb 2021 23:46:34 +0000 (+0200) Subject: Fixes for compatibility with legacy unsized PixelFormats X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a47639620c40397939ae4d79c08d5d8f460bad5c;p=libs%2Fgl.git Fixes for compatibility with legacy unsized PixelFormats --- 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()); } }