Don't call drawImage if draw a zero-sized image
Added some old changes from Jonatas