X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpixelformat.cpp;h=7647717a44ad3d047e7bfbc0d386a575f5564701;hb=4d7f66ea28c788e12f700216b9c53af9e71b8390;hp=b8180b2fb75e559477c0388eddc53509f35263ba;hpb=8ed7051d1a80c7e8b198d96575338eee6a5e2485;p=libs%2Fgl.git diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index b8180b2f..7647717a 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -148,6 +148,30 @@ unsigned get_component_count(PixelFormat pf) } } +unsigned get_component_size(PixelFormat pf) +{ + switch(pf) + { + case RGB16F: + case RGBA16F: + case LUMINANCE16F: + case LUMINANCE_ALPHA16F: + return 2; + case RGB32F: + case RGBA32F: + case LUMINANCE32F: + case LUMINANCE_ALPHA32F: + return 4; + default: + return 1; + } +} + +unsigned get_pixel_size(PixelFormat pf) +{ + return get_component_count(pf)*get_component_size(pf); +} + void require_pixelformat(PixelFormat pf) { switch(pf)