40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
From 34e71cc904414e6c320d32c1b4f4ab574b1fc6ad Mon Sep 17 00:00:00 2001
|
|
From: ptitSeb <sebastien.chev@gmail.com>
|
|
Date: Sun, 30 Aug 2020 20:36:10 +0200
|
|
Subject: [PATCH 029/233] Added fast path for GL_LUMINANCE -> GL_RGB conversion
|
|
|
|
---
|
|
src/gl/pixel.c | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/src/gl/pixel.c b/src/gl/pixel.c
|
|
index 5ca72ffe..5202ef10 100755
|
|
--- a/src/gl/pixel.c
|
|
+++ b/src/gl/pixel.c
|
|
@@ -871,6 +871,22 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
|
|
}
|
|
return true;
|
|
}
|
|
+ // L -> RGB
|
|
+ if ((src_format == GL_LUMINANCE) && (dst_format == GL_RGB) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE))) {
|
|
+ GLuint tmp;
|
|
+ for (int i = 0; i < height; i++) {
|
|
+ for (int j = 0; j < width; j++) {
|
|
+ //tmp = *(const GLuint*)src_pos;
|
|
+ unsigned char* byte_dst = (unsigned char*)dst_pos;
|
|
+ byte_dst[0] = byte_dst[1] = byte_dst[2] = *(GLubyte*)src_pos;
|
|
+ src_pos += src_stride;
|
|
+ dst_pos += dst_stride;
|
|
+ }
|
|
+ dst_pos += dst_width;
|
|
+ src_pos += src_widthadj;
|
|
+ }
|
|
+ return true;
|
|
+ }
|
|
// RGBA -> LA
|
|
if ((src_format == GL_RGBA) && (dst_format == GL_LUMINANCE_ALPHA) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE))) {
|
|
GLuint tmp;
|
|
--
|
|
2.11.0
|
|
|