Original Post
I just started to write a new GUI interface in C++ using Allegro - but Allegro lacks a tiled-blit but it just so happened that I a few years ago wrote a GUI using allegro in straight C so I decided to steal my tiledblit function from that project. The function had been used extensively in different controls so I assumed it would be trouble free to use it, but when I changed my stretchblit calls to tiledblit the screen looks strange. It somehow decides to fill the whole screen to the right and below the control. So when I look at the source I find this: blit(source, dest, source_x, source_y, dx, dy, dest_width, dest_height); ... blit(source, dest, source_x, source_y, dx, dy, extrah, dest_height); ... blit(source, dest, source_x, source_y, dx, dy, dest_width, extrav); this might not look so bad if you don't see the whole source but my code is using the wrong variables. I should have been using source_width and source_height so instead of blitting a 10x10 area each time it now blitted a 600x600 pixel area. Before my change this code worked nothing like a tiled blit - more like a screenfiller. And I used this function without any problems in my old GUI. I just can't understand how it worked in the old project, it is absolutely totally unbelievable. Anyone else experienced someting similar with rotten code?