Merge common parts of bitmap_surface and output_surface into rgba_surface
Only draw/clear dirty area of output_surface
Only flush cache of rgba_surface data when needed

Flushing cache after each draw isn't necessary and only costs performance.
Now cache gets flushed right before data is needed by hardware engines.
Ignore zero-sized surfaces in rgba_render_surface

This also avoids triggering a g2d driver bug.
Only clear rgba_surface if it won't get overwritten anyway
Link to -lm and -lX11

fixes #22