gsk: Be more careful when slicing

We can only reuse existing slices if they
have the right filtering.
This commit is contained in:
Matthias Clasen 2023-03-17 00:50:01 -04:00
parent fe2b6dd246
commit f3b0aa27ea
2 changed files with 18 additions and 11 deletions

View File

@ -760,7 +760,8 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
}
/* The download_texture() call may have switched the GL context. Make sure
* the right context is at work again. */
* the right context is at work again.
*/
gdk_gl_context_make_current (context);
width = gdk_texture_get_width (texture);
@ -1227,9 +1228,13 @@ gsk_gl_driver_add_texture_slices (GskGLDriver *self,
n_slices = cols * rows;
if ((t = gdk_texture_get_render_data (texture, self)))
t = gdk_texture_get_render_data (texture, self);
if (t)
{
if (t->n_slices == n_slices)
if (t->n_slices == n_slices &&
t->min_filter == min_filter &&
t->mag_filter == mag_filter)
{
*out_slices = t->slices;
*out_n_slices = t->n_slices;
@ -1281,7 +1286,7 @@ gsk_gl_driver_add_texture_slices (GskGLDriver *self,
t = gsk_gl_texture_new (0,
tex_width, tex_height,
GL_RGBA8,
GL_NEAREST, GL_NEAREST,
min_filter, mag_filter,
self->current_frame_id);
/* Use gsk_gl_texture_free() as destroy notify here since we are

View File

@ -241,14 +241,16 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
{
GskGLTexture *t;
if ((t = gdk_texture_get_render_data (texture, self)))
t = gdk_texture_get_render_data (texture, self);
if (t && t->slices &&
t->min_filter == min_filter &&
t->mag_filter == mag_filter &&
min_cols == 0 && min_rows == 0)
{
if (min_cols == 0 && min_rows == 0 && t->slices)
{
*out_slices = t->slices;
*out_n_slices = t->n_slices;
return;
}
*out_slices = t->slices;
*out_n_slices = t->n_slices;
return;
}
gsk_gl_driver_add_texture_slices (self, texture, min_filter, mag_filter, min_cols, min_rows, out_slices, out_n_slices);