optimize canvas draw