Fix calcRatio in cg_draw