mesa/swrast: Move memory allocation outside the blit loop
mesa/swrast: Move memory allocation outside the blit loop

Assume the maximum pixel size (16 bytes per pixel).  In addition to
moving redundant malloc and free calls outside the loop, this fixes a
potential resource leak when a surface is mapped and the malloc fails.
This also makes blit_nearest look a bit more like blit_linear.

v2: Use MAX_PIXEL_BYTES instead of 16.  Suggested by Ken.

Signed-off-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>
Reviewed-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>

wolf96/glsl-optimizer,benaadams/glsl-optimizer,wolf96/glsl-optimizer,dellis1972/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,djreep81/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,mapbox/glsl-optimizer,benaadams/glsl-optimizer,mapbox/glsl-optimizer,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,dellis1972/glsl-optimizer,jbarczak/glsl-optimizer,dellis1972/glsl-optimizer,bkaradzic/glsl-optimizer,tokyovigilante/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,zeux/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,djreep81/glsl-optimizer,mapbox/glsl-optimizer,jbarczak/glsl-optimizer,metora/MesaGLSLCompiler,jbarczak/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer,benaadams/glsl-optimizer,wolf96/glsl-optimizer,zeux/glsl-optimizer,zz85/glsl-optimizer,tokyovigilante/glsl-optimizer,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,dellis1972/glsl-optimizer,mcanthony/glsl-optimizer,zz85/glsl-optimizer,djreep81/glsl-optimizer,tokyovigilante/glsl-optimizer,zeux/glsl-optimizer,wolf96/glsl-optimizer,benaadams/glsl-optimizer,wolf96/glsl-optimizer,metora/MesaGLSLCompiler,bkaradzic/glsl-optimizer,dellis1972/glsl-optimizer,benaadams/glsl-optimizer,zeux/glsl-optimizer,zeux/glsl-optimizer,djreep81/glsl-optimizer,mcanthony/glsl-optimizer,djreep81/glsl-optimizer,metora/MesaGLSLCompiler