Store the decoration images in two texture atlases

Review Request #110790 - Created June 2, 2013 and submitted

Fredrik Höglund
This greatly reduces the CPU overhead when rendering decorations.

Ideally we would use a single texture, but there are two problems with that:
• We have to rotate the vertical borders, which adds overhead when updating a decoration.
• The WindowQuad code currently assumes that the texcoords and the positions are in the same dimension.

Note that there is currently no space between the images in the textures. This may result in artifacts
along the inner edges of some decorations when a window is transformed, so this needs testing.

commit 94808b467088a9ebed0908dcc9ca70c814aa85b7
Author: Fredrik Höglund <>
Date:   Mon Mar 18 19:43:05 2013 +0100

    kwin: Clear the decoration textures after resizing
    This fixes artifacts from over-sampling along the edges of the
    decorations when effects such a wobbly windows are active.
    The textures are only cleared when framebuffer objects are supported.
    All drivers support FBO's now, so in practice this shouldn't be
    a problem.

commit 4151b5d7cd636f70d7f1f717407b10594e19cff7
Author: Fredrik Höglund <>
Date:   Sun Mar 17 00:53:11 2013 +0100

    kwin: Align decoration texture sizes to 128 pixels
    This reduces the number of texture reallocations while
    resizing windows.

commit f0fecb98b60cba75906eafeda5d1fafb85a5724d
Author: Fredrik Höglund <>
Date:   Sun Mar 17 00:40:15 2013 +0100

    kwin: Split WindowQuadDecoration into two types
    Split WindowQuadDecoration into WindowQuadDecorationLeftRight
    and WindowQuadDecorationTopBottom.
    This simplifies the code in SceneOpenGL::Window::paintDecoration().

commit cf9eb4e7538b85201c7affc83b60b5f50a0f1474
Author: Fredrik Höglund <>
Date:   Fri Mar 15 18:01:44 2013 +0100

    kwin: Use two textures for the decoration images
    Store the left and right borders in the first texture, and the top
    and bottom borders in the second texture.
    This makes it possible to render the whole decoration with only two
    calls to glDrawArrays(). It also reduces the number of texture
    allocations while resizing a window.

commit dffa5b66c3c17e64f502b6046a0698e83d3fe32a
Author: Fredrik Höglund <>
Date:   Sat Mar 16 14:45:14 2013 +0100

    kwin: Refactor some code in the PaintRedirector
    Add virtual resizePixmaps() and updatePixmaps() methods that resizes and
    updates all the pixmaps. Make resize() and paint() regular virtuals
    with stub implementations.
    The new methods will be used by OpenGLPaintRedirector in the next commit.

Martin Flöser
Martin Flöser
Fredrik Höglund
Review request changed

Status: Closed (submitted)