Mesa (master): mesa: Add a helper function _mesa_need_luminance_to_rgb_conversion()

Anuj Phogat aphogat at kemper.freedesktop.org
Fri Jul 24 19:12:33 UTC 2015


Module: Mesa
Branch: master
Commit: c59c0f8a42652603da7f89e3270897cb685fe76b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c59c0f8a42652603da7f89e3270897cb685fe76b

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Thu Jun 11 16:48:26 2015 -0700

mesa: Add a helper function _mesa_need_luminance_to_rgb_conversion()

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

---

 src/mesa/main/readpix.c |   18 ++++++++++++++++++
 src/mesa/main/readpix.h |    4 ++++
 2 files changed, 22 insertions(+)

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.
diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h
index f894036..41116e4 100644
--- a/src/mesa/main/readpix.h
+++ b/src/mesa/main/readpix.h
@@ -40,6 +40,10 @@ _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format,
 extern GLboolean
 _mesa_need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format);
 
+extern GLboolean
+_mesa_need_luminance_to_rgb_conversion(GLenum srcBaseFormat,
+                                       GLenum dstBaseFormat);
+
 extern GLbitfield
 _mesa_get_readpixels_transfer_ops(const struct gl_context *ctx,
                                   mesa_format texFormat,




More information about the mesa-commit mailing list