mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
texture-mipmap: Handle textures with width or height of 1
Calculating the mipmap width as half of the texture width leads to a
mipmap width of zero for textures with width of 1 which leads to an
early exit instead of a mipmap texture.
Fixes: 16fa2100d
("shaped-texture: Stop using MetaTextureTower and use GL mipmapping instead")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3468>
This commit is contained in:
parent
6daa21c930
commit
54c5ea9c13
@ -151,8 +151,8 @@ ensure_mipmap_texture (MetaTextureMipmap *mipmap)
|
||||
* then just use the original texture instead of mipmap texture, which is
|
||||
* faster anyway.
|
||||
*/
|
||||
width = meta_multi_texture_get_width (mipmap->base_texture) / 2;
|
||||
height = meta_multi_texture_get_height (mipmap->base_texture) / 2;
|
||||
width = meta_multi_texture_get_width (mipmap->base_texture);
|
||||
height = meta_multi_texture_get_height (mipmap->base_texture);
|
||||
|
||||
if (!width || !height)
|
||||
{
|
||||
@ -160,6 +160,9 @@ ensure_mipmap_texture (MetaTextureMipmap *mipmap)
|
||||
return;
|
||||
}
|
||||
|
||||
width = MAX (width / 2, 1);
|
||||
height = MAX (height / 2, 1);
|
||||
|
||||
if (!mipmap->mipmap_texture ||
|
||||
meta_multi_texture_get_width (mipmap->mipmap_texture) != width ||
|
||||
meta_multi_texture_get_height (mipmap->mipmap_texture) != height)
|
||||
|
Loading…
Reference in New Issue
Block a user