- Not very surprisingly, replacing horizontal and vertical lines with rectangles doesn’t speed things up detectably. (There once were systems where this made a difference, but I think GTK is probably clever enough that this doesn’t matter.)
- More interestingly, plotting the title to a monochrome bitmap, and then setting that bitmap as a stipple and drawing a filled rectangle instead of drawing the title also does not speed things up detectably. I thought avoiding a Pango hit for some common themes which plot the title more than once might make a difference. (Human plots the title of the active window four times, for example, and is the slowest common theme.)
(I am working on things other than this sort of thing, it’s just that this is producing results which are interesting to talk about and other bugs and problems aren’t so much.)
Photo © kagey_b, cc-by-nc-nd.
I was playing with tiling the other day, and discovered that very small tiles make for very long rendering times. I assume that it’s rendering the tile once then copying that same small square it over and over and over until the clipping region is filled.
I think it ought to be faster if instead of copying from the source-image all the time, you copied the existing tiled area from the destination area… that is to say, if each instance of the tiled pattern is “#”, then instead of this:
1.
#
2.
##
3.
###
4.
####
…do this:
1.
#
2.
##
3.
####
4.
########
I’m not entirely sure I’m explaining this properly… does anyone get what I mean?
This sort of optimisation work is very important for thin clients in particular, so keep up the good work!
(For example, vertical gradients in a metacity theme are no problem to Sun Rays, but horizontal gradients are baaad…)
@Screwtape:
I do get what you mean about the powers of two thing. But what amazes me, looking into the code, is that we don’t use GDK’s built-in support for tiling and instead do it all ourselves.
grep tells me that Simple, Mist, DarkRoom, blondie, and [Aging]Gorilla use tiles; can you recommend a particularly tile-heavy theme I can use to test this with?
I’ve uploaded a work-in-progress version of my current theme, modified to tile the titlebar-background with a 2px by 2px source image.
On my MacBook, with the theme as it stands, metacity-theme-viewer says it takes about 25.91ms to render. If I change tile_width to 100 (the only instance of tile_width in the entire theme), metacity-theme-viewer reports only 1.11ms to render. Hopefully that’s dramatic enough to help you tune the implementation. :)