Implement support for RGBA blitting.

Change-Id: I1ad9fed9aea34cd20f8d78f4d4469c61aeb00ea6
Reviewed-on: https://swiftshader-review.googlesource.com/2753
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Blitter.cpp b/src/Renderer/Blitter.cpp
index 6b893fc..53bd7cc 100644
--- a/src/Renderer/Blitter.cpp
+++ b/src/Renderer/Blitter.cpp
@@ -39,15 +39,15 @@
 		bool flipX = destRect.x0 > destRect.x1;
 		bool flipY = destRect.y0 > destRect.y1;
 
-		if(flipX)

-		{

-			swap(dRect.x0, dRect.x1);

-			swap(sRect.x0, sRect.x1);

-		}

-		if(flipY)

-		{

-			swap(dRect.y0, dRect.y1);

-			swap(sRect.y0, sRect.y1);

+		if(flipX)
+		{
+			swap(dRect.x0, dRect.x1);
+			swap(sRect.x0, sRect.x1);
+		}
+		if(flipY)
+		{
+			swap(dRect.y0, dRect.y1);
+			swap(sRect.y0, sRect.y1);
 		}
 
 		source->lockInternal(sRect.x0, sRect.y0, sRect.slice, sw::LOCK_READONLY, sw::PUBLIC);
@@ -104,10 +104,17 @@
 		case FORMAT_A8R8G8B8:
 			c = Float4(*Pointer<Byte4>(element)).zyxw;
 			break;
+		case FORMAT_A8B8G8R8:
+			c = Float4(*Pointer<Byte4>(element));
+			break;
 		case FORMAT_X8R8G8B8:
 			c = Float4(*Pointer<Byte4>(element)).zyxw;
 			c.w = 1.0f;
 			break;
+		case FORMAT_X8B8G8R8:
+			c = Float4(*Pointer<Byte4>(element));
+			c.w = 1.0f;
+			break;
 		case FORMAT_A16B16G16R16:
 			c = Float4(*Pointer<UShort4>(element));
 			break;
@@ -137,15 +144,15 @@
 	{
 		Rect dRect = destRect;
 		Rect sRect = sourceRect;
-		if(destRect.x0 > destRect.x1)

-		{

-			swap(dRect.x0, dRect.x1);

-			swap(sRect.x0, sRect.x1);

-		}

-		if(destRect.y0 > destRect.y1)

-		{

-			swap(dRect.y0, dRect.y1);

-			swap(sRect.y0, sRect.y1);

+		if(destRect.x0 > destRect.x1)
+		{
+			swap(dRect.x0, dRect.x1);
+			swap(sRect.x0, sRect.x1);
+		}
+		if(destRect.y0 > destRect.y1)
+		{
+			swap(dRect.y0, dRect.y1);
+			swap(sRect.y0, sRect.y1);
 		}
 
 		BlitState state;
@@ -240,7 +247,9 @@
 						case FORMAT_L8:
 						case FORMAT_A8:
 						case FORMAT_A8R8G8B8:
+						case FORMAT_A8B8G8R8:
 						case FORMAT_X8R8G8B8:
+						case FORMAT_X8B8G8R8:
 							unscale = vector(255, 255, 255, 255);
 							break;
 						case FORMAT_A16B16G16R16:
@@ -263,7 +272,9 @@
 						case FORMAT_L8:
 						case FORMAT_A8:
 						case FORMAT_A8R8G8B8:
+						case FORMAT_A8B8G8R8:
 						case FORMAT_X8R8G8B8:
+						case FORMAT_X8B8G8R8:
 							scale = vector(255, 255, 255, 255);
 							break;
 						case FORMAT_A16B16G16R16:
@@ -311,6 +322,13 @@
 								*Pointer<UInt>(d) = UInt(As<Long>(c1));
 							}
 							break;
+						case FORMAT_A8B8G8R8:
+							{
+								UShort4 c0 = As<UShort4>(RoundShort4(color));
+								Byte8 c1 = Pack(c0, c0);
+								*Pointer<UInt>(d) = UInt(As<Long>(c1));
+							}
+							break;
 						case FORMAT_X8R8G8B8:
 							{
 								UShort4 c0 = As<UShort4>(RoundShort4(color.zyxw));
@@ -318,6 +336,13 @@
 								*Pointer<UInt>(d) = UInt(As<Long>(c1)) | 0xFF000000;
 							}
 							break;
+						case FORMAT_X8B8G8R8:
+							{
+								UShort4 c0 = As<UShort4>(RoundShort4(color));
+								Byte8 c1 = Pack(c0, c0);
+								*Pointer<UInt>(d) = UInt(As<Long>(c1)) | 0xFF000000;
+							}
+							break;
 						case FORMAT_A16B16G16R16:
 							*Pointer<UShort4>(d) = UShort4(RoundInt(color));
 							break;