wader / gtktetris

Simple GTK tetris game
https://github.com/wader/gtktetris
MIT License
5 stars 6 forks source link

Performance #15

Closed wdlkmpx closed 3 years ago

wdlkmpx commented 3 years ago

This is some technical info. Ideally the app should work fine in very slow machines.

Currently there are 2 block types (see Options dialog): 1) image blocks (which are stored in cairo surfaces) 2) "generated" blocks

The "image" block used to be faster with gdk_draw, using GdkPixmap, but now using only cairo it's slower. I notice visual glitches.

The reason for this is cairo_set_source_surface()

https://stackoverflow.com/questions/15773965/how-to-fast-redrawing-an-image-buffer

The "generated" block is fast, because it doesn't use cairo_set_source_surface(), which is slow with X.

So this is something to think about. There might be some workarounds or a different way to accelerate the drawing of the image blocks, which can be from .xpm, .svg, .png, .etc files.