Pitch fix for IO surfaces

On MacOS, a Surface constructor receiving the 'pitchPprovided'
parameter wasn't using it for the surface's external pitch,
which was causing an error when using the Image::getPitch()
function, which returns getExternalPitchB(). Image::getPitch()
is used within Image::loadImageData(), which is used by gl
functions like glTexImage2D() and glTexSubImage2D(). Both the
internal and external buffers now use the parameter to solve
this issue.

Bug b/19979104

Change-Id: I9762ed53b535ae9eb052f57ee1ceed8ee87cb29c
Reviewed-on: https://swiftshader-review.googlesource.com/18828
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
index 9be7467..4a33834 100644
--- a/src/Renderer/Surface.cpp
+++ b/src/Renderer/Surface.cpp
@@ -1310,8 +1310,8 @@
 		external.samples = (short)samples;
 		external.format = format;
 		external.bytes = bytes(external.format);
-		external.pitchB = pitchB(external.width, 0, external.format, renderTarget && !texture);
-		external.pitchP = pitchP(external.width, 0, external.format, renderTarget && !texture);
+		external.pitchB = !pitchPprovided ? pitchB(external.width, 0, external.format, renderTarget && !texture) : pitchPprovided * external.bytes;
+		external.pitchP = !pitchPprovided ? pitchP(external.width, 0, external.format, renderTarget && !texture) : pitchPprovided;
 		external.sliceB = sliceB(external.width, external.height, 0, external.format, renderTarget && !texture);
 		external.sliceP = sliceP(external.width, external.height, 0, external.format, renderTarget && !texture);
 		external.border = 0;