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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user