mcst-linux-kernel/patches-2024.06.26/gl4es-1.1.4/0054-Better-hendling-of-con...

51 lines
2.2 KiB
Diff

From c98b22362748d0b8dd26bca0ab81ab53e4a0233f Mon Sep 17 00:00:00 2001
From: ptitSeb <sebastien.chev@gmail.com>
Date: Sun, 18 Oct 2020 10:37:09 +0200
Subject: [PATCH 054/233] Better hendling of convert_pixel when source and dest
are identical
---
src/gl/pixel.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/gl/pixel.c b/src/gl/pixel.c
index 5202ef10..69792f3c 100755
--- a/src/gl/pixel.c
+++ b/src/gl/pixel.c
@@ -767,17 +767,10 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
GLuint src_widthadj = src_width -(width * pixel_sizeof(src_format, src_type));
//printf("pixel conversion: %ix%i - %s, %s (%d) ==> %s, %s (%d), transform=%i, align=%d, src_width=%d(%d), dst_width=%d(%d)\n", width, height, PrintEnum(src_format), PrintEnum(src_type),pixel_sizeof(src_format, src_type), PrintEnum(dst_format), PrintEnum(dst_type), pixel_sizeof(dst_format, dst_type), raster_need_transform(), align, src_width, src_widthadj, dst_width2, dst_width);
- src_color = get_color_map(src_format);
- dst_color = get_color_map(dst_format);
- if (!dst_size || !pixel_sizeof(src_format, src_type)
- || !src_color->type || !dst_color->type) {
- LOGE("pixel conversion, anticipated abort\n");
- return false;
- }
if(src_type==GL_HALF_FLOAT) src_type=GL_HALF_FLOAT_OES;
if(dst_type==GL_HALF_FLOAT) dst_type=GL_HALF_FLOAT_OES;
- if ((src_type == dst_type) && (src_color->type == dst_color->type)) {
+ if ((src_type == dst_type) && (dst_format == src_format)) {
if (*dst == src)
return true;
if (*dst == NULL) // alloc dst only if dst==NULL
@@ -789,6 +782,13 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
memcpy(*dst, src, dst_size);
return true;
}
+ src_color = get_color_map(src_format);
+ dst_color = get_color_map(dst_format);
+ if (!dst_size || !pixel_sizeof(src_format, src_type)
+ || !src_color->type || !dst_color->type) {
+ LOGE("pixel conversion, anticipated abort\n");
+ return false;
+ }
GLsizei src_stride = pixel_sizeof(src_format, src_type);
GLsizei dst_stride = pixel_sizeof(dst_format, dst_type);
if (*dst == src || *dst == NULL)
--
2.11.0