optimized canvas update