summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/readpix.c
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2015-06-11 16:48:26 -0700
committerAnuj Phogat <anuj.phogat@gmail.com>2015-07-24 10:48:58 -0700
commitc59c0f8a42652603da7f89e3270897cb685fe76b (patch)
tree3a02959f53682d65f20e73d118a8c39459b1dfed /src/mesa/main/readpix.c
parent9fff00d387cacf7820c344324820cab764541762 (diff)
downloadexternal_mesa3d-c59c0f8a42652603da7f89e3270897cb685fe76b.zip
external_mesa3d-c59c0f8a42652603da7f89e3270897cb685fe76b.tar.gz
external_mesa3d-c59c0f8a42652603da7f89e3270897cb685fe76b.tar.bz2
mesa: Add a helper function _mesa_need_luminance_to_rgb_conversion()
Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/main/readpix.c')
-rw-r--r--src/mesa/main/readpix.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 25a0987..ac46f7e 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -60,6 +60,24 @@ _mesa_need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format)
format == GL_LUMINANCE_ALPHA_INTEGER_EXT);
}
+/**
+ * Return true if the conversion L,I to RGB conversion is needed.
+ */
+GLboolean
+_mesa_need_luminance_to_rgb_conversion(GLenum srcBaseFormat,
+ GLenum dstBaseFormat)
+{
+ return (srcBaseFormat == GL_LUMINANCE ||
+ srcBaseFormat == GL_LUMINANCE_ALPHA ||
+ srcBaseFormat == GL_INTENSITY) &&
+ (dstBaseFormat == GL_GREEN ||
+ dstBaseFormat == GL_BLUE ||
+ dstBaseFormat == GL_RG ||
+ dstBaseFormat == GL_RGB ||
+ dstBaseFormat == GL_BGR ||
+ dstBaseFormat == GL_RGBA ||
+ dstBaseFormat == GL_BGRA);
+}
/**
* Return transfer op flags for this ReadPixels operation.