X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fpixelformat.cpp;h=6be6d7c97b36e00882022eae4b28ad314e3fc593;hb=24b24e2203c776aacd9744bb947f5cf47b03d328;hp=cfbf8112e2278477dec5ae8d0d79928f59371a0d;hpb=33b6ca811172d402fc891eeed9cd2a5edc28d61d;p=libs%2Fgl.git diff --git a/source/core/pixelformat.cpp b/source/core/pixelformat.cpp index cfbf8112..6be6d7c9 100644 --- a/source/core/pixelformat.cpp +++ b/source/core/pixelformat.cpp @@ -1,4 +1,10 @@ +#include +#include #include +#include +#include +#include +#include #include #include #include "pixelformat.h" @@ -81,19 +87,7 @@ void operator>>(const LexicalConverter &conv, PixelFormat &fmt) else if(conv.get()=="DEPTH_COMPONENT32F") fmt = DEPTH_COMPONENT32F; else - { - 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()); - } + throw lexical_error(format("conversion of '%s' to PixelFormat", conv.get())); } PixelComponents components_from_graphics(Graphics::PixelFormat pf) @@ -112,10 +106,10 @@ PixelComponents components_from_graphics(Graphics::PixelFormat pf) } } -PixelFormat pixelformat_from_image(const Graphics::Image &image) +PixelFormat pixelformat_from_image(const Graphics::Image &image, bool srgb) { PixelComponents comp = components_from_graphics(image.get_format()); - return make_pixelformat(comp, UNSIGNED_BYTE); + return make_pixelformat(comp, UNSIGNED_BYTE, srgb); } PixelFormat make_pixelformat(PixelComponents comp, DataType type, bool srgb) @@ -175,7 +169,7 @@ void require_pixelformat(PixelFormat pf) } } -GLenum get_gl_components(PixelComponents comp) +unsigned get_gl_components(PixelComponents comp) { switch(comp) { @@ -189,7 +183,7 @@ GLenum get_gl_components(PixelComponents comp) } } -GLenum get_gl_pixelformat(PixelFormat pf) +unsigned get_gl_pixelformat(PixelFormat pf) { switch(pf) {