]> git.tdb.fi Git - libs/gl.git/commitdiff
Fixes for compatibility with legacy unsized PixelFormats
authorMikko Rasa <tdb@tdb.fi>
Fri, 26 Feb 2021 23:46:34 +0000 (01:46 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 26 Feb 2021 23:46:34 +0000 (01:46 +0200)
source/core/pixelformat.cpp

index 87191c3423122aefde6b7e38110daae5d28cb4d0..8cc7c9c9d8f2e13fa0d9d05f4de57128a8233491 100644 (file)
@@ -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());
        }
 }