gdk: Simplify gdk_memory_format_gl_format

Make the callers of this function check for
straight alpha themselves, and only do the
version compatibility check here. This makes
the function usable in contexts where straight
alpha is acceptable.
This commit is contained in:
Matthias Clasen 2023-05-30 00:08:55 -04:00
parent a4bae6a62d
commit 0f61c52593
3 changed files with 5 additions and 4 deletions

View File

@ -149,6 +149,9 @@ gdk_gl_texture_find_format (gboolean use_es,
GLenum q_internal_format, q_format, q_type;
GLint q_swizzle[4];
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
continue;
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
continue;

View File

@ -600,9 +600,6 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
if (memory_formats[format].alpha == GDK_MEMORY_ALPHA_STRAIGHT)
return FALSE;
if (gles)
{
if (memory_formats[format].min_gl_version.gles_major > gl_major ||

View File

@ -1465,7 +1465,8 @@ memory_format_gl_format (GdkMemoryFormat data_format,
gl_internalformat,
gl_format,
gl_type,
gl_swizzle))
gl_swizzle) &&
gdk_memory_format_alpha (data_format) != GDK_MEMORY_ALPHA_STRAIGHT)
return data_format;
if (gdk_memory_format_prefers_high_depth (data_format))