Internally, OpenGL scene plugin stores each decoration in a texture
atlas to avoid unnecessary texture bind calls and use less memory.
This works great until there is no need for the linear filter. If the texture
atlas is scaled and the linear filter is used, texture bleeding could happen:
Decoration and content of the window "bleed".
Texture bleeding happens because linear filter samples texels that are
outside of a subtexture.
There are several ways to fix the texture bleeding:
- the first one is so known "half pixel correction". With half pixel correction value of half a texel is added or subtracted so when linear filter comes in it samples texels in desired region;
- another way to fix the texture bleeding are array texture. Unfortunately, decoration pieces could have different size so array textures wouldn't help;
- and the last one is to pad each subtexture.
It's very easy to implement half pixel correction. But because mapped
subtexture is smaller by 1px, the linear filter would always kick in and
"blur" fonts.
So, the only choice we have is to pad each subtexture. This diff, as its
name suggests, makes decoration renderer to pad each decoration piece by
1px:
Decoration texture atlas for active Dolphin window.
Yet, there are still some problems on X11. Because window pixmaps also
include window decorations, clamp to edge would not help. I.e. window
pixmaps bleed on X11.
X11: Zoom effect.
Wayland: Zoom effect.
CCBUG: 360549