Merge branch 'more-bgra' into 'main'

gsk: Use has_bgra in more places

See merge request GNOME/gtk!6500
This commit is contained in:
Matthias Clasen 2023-10-20 13:43:51 +00:00
commit f4722289f7
2 changed files with 6 additions and 7 deletions

View File

@ -119,7 +119,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ()))
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
@ -127,9 +127,8 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
@ -277,7 +276,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
g_assert (texture_id > 0);
if G_UNLIKELY (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
if (G_UNLIKELY (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())))
{
pixel_data = free_data = g_malloc (width * height * 4);
gdk_memory_convert (pixel_data, width * 4,
@ -294,7 +293,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
pixel_data = cairo_image_surface_get_data (surface);
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);

View File

@ -111,7 +111,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
"Uploading texture");
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ()))
{
pixel_data = free_data = g_malloc (width * height * 4);
gdk_memory_convert (pixel_data, width * 4,
@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
pixel_data = surface_data;
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);