Fixed resize function when stretchToCanvas is false