Optimize layer painting when not locked