removed code of cairo patterns for drawing gradient
moved ftoi operation out of render loop and some code cleanup