X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpixelformat.cpp;h=679c6467503e3d4d059668890b1eb2922eb54426;hb=93fa68debcd6e416a1b20f43077f7a79525aaecb;hp=cd3bb2aa78e30709293dd8dfb13f4d42cd4c481d;hpb=f1b12c992db974c679d85ae6ec22cd318199d0d5;p=libs%2Fgl.git diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index cd3bb2aa..679c6467 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -54,16 +54,22 @@ PixelFormat pixelformat_from_graphics(Graphics::PixelFormat pf) } } -PixelFormat storage_pixelformat_from_graphics(Graphics::PixelFormat pf) +PixelFormat storage_pixelformat_from_graphics(Graphics::PixelFormat pf, bool srgb) { + PixelFormat result; switch(pf) { case Graphics::RGBX: case Graphics::BGR: - case Graphics::BGRX: return RGB; - case Graphics::BGRA: return RGBA; - default: return pixelformat_from_graphics(pf); + case Graphics::BGRX: result = RGB; break; + case Graphics::BGRA: result = RGBA; break; + default: result = pixelformat_from_graphics(pf); } + + if(srgb) + return get_srgb_pixelformat(result); + else + return result; } PixelFormat get_base_pixelformat(PixelFormat pf)