mcst-linux-kernel/patches-2024.06.26/gl4es-1.1.4/0028-Added-fast-path-for-GL...

47 lines
1.5 KiB
Diff

From 5effdad7c62302f20545ad6cb2be09c972dd9b9e Mon Sep 17 00:00:00 2001
From: ptitSeb <sebastien.chev@gmail.com>
Date: Sat, 29 Aug 2020 20:45:22 +0200
Subject: [PATCH 028/233] Added fast path for GL_LUMINANCE -> GL_RGBA
conversion
---
src/gl/pixel.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/gl/pixel.c b/src/gl/pixel.c
index 1384306f..5ca72ffe 100755
--- a/src/gl/pixel.c
+++ b/src/gl/pixel.c
@@ -849,6 +849,28 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
}
return true;
}
+ // L -> RGBA
+ if ((src_format == GL_LUMINANCE) && (dst_format == GL_RGBA) && (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;
+ #ifdef __BIG_ENDIAN__
+ byte_dst[1] = byte_dst[2] = byte_dst[3] = *(GLubyte*)src_pos;
+ byte_dst[0] = 255;
+ #else
+ byte_dst[0] = byte_dst[1] = byte_dst[2] = *(GLubyte*)src_pos;
+ byte_dst[3] = 255;
+ #endif
+ 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