gsk: Use has_bgra in more places
The glyph and icon libaries were also checking for GLES to decide if data needs to be transformed from BGRA to RGBA. Use the new has_bgra getter instead. This will probably break on bigendian, because the GL_BGRA + GL_UNSIGNED_BYTE combination is not equivalent to the cairo format on bigendian, but this was already broken for the gl format information that we get from gdk_memory_format_gl_format.
This commit is contained in:
@@ -119,7 +119,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
|||||||
|
|
||||||
memset (pixel_data, 255, sizeof pixel_data);
|
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_format = GL_RGBA;
|
||||||
gl_type = GL_UNSIGNED_BYTE;
|
gl_type = GL_UNSIGNED_BYTE;
|
||||||
@@ -127,9 +127,8 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl_format = GL_BGRA;
|
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);
|
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||||
|
|
||||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||||
@@ -277,7 +276,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
|
|||||||
|
|
||||||
g_assert (texture_id > 0);
|
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);
|
pixel_data = free_data = g_malloc (width * height * 4);
|
||||||
gdk_memory_convert (pixel_data, width * 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);
|
pixel_data = cairo_image_surface_get_data (surface);
|
||||||
gl_format = GL_BGRA;
|
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);
|
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
|||||||
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
||||||
"Uploading texture");
|
"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);
|
pixel_data = free_data = g_malloc (width * height * 4);
|
||||||
gdk_memory_convert (pixel_data, width * 4,
|
gdk_memory_convert (pixel_data, width * 4,
|
||||||
@@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
|||||||
{
|
{
|
||||||
pixel_data = surface_data;
|
pixel_data = surface_data;
|
||||||
gl_format = GL_BGRA;
|
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);
|
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
|
||||||
|
|||||||
Reference in New Issue
Block a user