changeset 2786:6bacfecbf27e

indent
author Sam Lantinga <slouken@libsdl.org>
date Tue, 25 Nov 2008 02:21:53 +0000
parents fa1095d42a5b
children 93764fe8601a
files src/SDL_compat.c src/haptic/win32/SDL_syshaptic.c src/video/SDL_renderer_sw.c src/video/SDL_surface.c src/video/SDL_video.c src/video/SDL_yuv_sw.c src/video/win32/SDL_d3drender.c src/video/win32/SDL_gdirender.c test/testsprite.c test/testsprite2.c
diffstat 10 files changed, 120 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/src/SDL_compat.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/SDL_compat.c	Tue Nov 25 02:21:53 2008 +0000
@@ -1350,7 +1350,7 @@
     Uint16 pitches[3];
     Uint8 *planes[3];
 
-	SDL_SW_YUVTexture *sw;
+    SDL_SW_YUVTexture *sw;
 
     SDL_TextureID textureID;
 };
@@ -1435,19 +1435,20 @@
     overlay->hwdata->textureID =
         SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h);
     if (overlay->hwdata->textureID) {
-		overlay->hwdata->sw = NULL;
-	} else {
-		overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
-		if (!overlay->hwdata->sw) {
-			SDL_FreeYUVOverlay(overlay);
-			return NULL;
-		}
+        overlay->hwdata->sw = NULL;
+    } else {
+        overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
+        if (!overlay->hwdata->sw) {
+            SDL_FreeYUVOverlay(overlay);
+            return NULL;
+        }
 
-		/* Create a supported RGB format texture for display */
-		overlay->hwdata->textureID =
-			SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, w, h);
-	}
-	if (!overlay->hwdata->textureID) {
+        /* Create a supported RGB format texture for display */
+        overlay->hwdata->textureID =
+            SDL_CreateTexture(SDL_PIXELFORMAT_RGB888,
+                              SDL_TEXTUREACCESS_STREAMING, w, h);
+    }
+    if (!overlay->hwdata->textureID) {
         SDL_FreeYUVOverlay(overlay);
         return NULL;
     }
@@ -1465,16 +1466,18 @@
         SDL_SetError("Passed a NULL overlay");
         return -1;
     }
-	if (overlay->hwdata->sw) {
-		if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch) < 0) {
-			return -1;
-		}
-	} else {
-		if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
-			< 0) {
-			return -1;
-		}
-	}
+    if (overlay->hwdata->sw) {
+        if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
+            < 0) {
+            return -1;
+        }
+    } else {
+        if (SDL_LockTexture
+            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
+            < 0) {
+            return -1;
+        }
+    }
     overlay->pixels[0] = (Uint8 *) pixels;
     overlay->pitches[0] = pitch;
     switch (overlay->format) {
@@ -1501,22 +1504,25 @@
     if (!overlay) {
         return;
     }
-	if (overlay->hwdata->sw) {
-		void *pixels;
-		int pitch;
-		if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
-			SDL_Rect srcrect;
+    if (overlay->hwdata->sw) {
+        void *pixels;
+        int pitch;
+        if (SDL_LockTexture
+            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
+            SDL_Rect srcrect;
 
-			srcrect.x = 0;
-			srcrect.y = 0;
-			srcrect.w = overlay->w;
-			srcrect.h = overlay->h;
-			SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, SDL_PIXELFORMAT_RGB888, overlay->w, overlay->h, pixels, pitch);
-			SDL_UnlockTexture(overlay->hwdata->textureID);
-		}
-	} else {
-		SDL_UnlockTexture(overlay->hwdata->textureID);
-	}
+            srcrect.x = 0;
+            srcrect.y = 0;
+            srcrect.w = overlay->w;
+            srcrect.h = overlay->h;
+            SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
+                                SDL_PIXELFORMAT_RGB888, overlay->w,
+                                overlay->h, pixels, pitch);
+            SDL_UnlockTexture(overlay->hwdata->textureID);
+        }
+    } else {
+        SDL_UnlockTexture(overlay->hwdata->textureID);
+    }
 }
 
 int
--- a/src/haptic/win32/SDL_syshaptic.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Tue Nov 25 02:21:53 2008 +0000
@@ -105,11 +105,11 @@
 static void
 DI_SetError(const char *str, HRESULT err)
 {
-	/*
-    SDL_SetError("Haptic: %s - %s: %s", str,
-                 DXGetErrorString8A(err), DXGetErrorDescription8A(err));
-	 */
-	SDL_SetError("Haptic error %s", str);
+    /*
+       SDL_SetError("Haptic: %s - %s: %s", str,
+       DXGetErrorString8A(err), DXGetErrorDescription8A(err));
+     */
+    SDL_SetError("Haptic error %s", str);
 }
 
 
@@ -154,7 +154,7 @@
     }
 
     ret = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER,
-                           &IID_IDirectInput, (LPVOID)&dinput);
+                           &IID_IDirectInput, (LPVOID) & dinput);
     if (FAILED(ret)) {
         DI_SetError("CoCreateInstance", ret);
         return -1;
--- a/src/video/SDL_renderer_sw.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/SDL_renderer_sw.c	Tue Nov 25 02:21:53 2008 +0000
@@ -361,7 +361,8 @@
 SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
     if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
-        texture->driverdata = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
+        texture->driverdata =
+            SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
     } else {
         int bpp;
         Uint32 Rmask, Gmask, Bmask, Amask;
--- a/src/video/SDL_surface.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/SDL_surface.c	Tue Nov 25 02:21:53 2008 +0000
@@ -271,68 +271,68 @@
 
 /* This is a fairly slow function to switch from colorkey to alpha */
 void
-SDL_ConvertColorkeyToAlpha(SDL_Surface *surface)
+SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
 {
-	int x, y;
+    int x, y;
 
-	if (!surface) {
-		return;
-	}
+    if (!surface) {
+        return;
+    }
 
-	if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
-	    !surface->format->Amask) {
-		return;
-	}
+    if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
+        !surface->format->Amask) {
+        return;
+    }
 
-	SDL_LockSurface(surface);
+    SDL_LockSurface(surface);
 
-	switch (surface->format->BytesPerPixel) {
-	case 2:
-		{
-			Uint16 *row, *spot;
-			Uint16 ckey = (Uint16)surface->map->info.colorkey;
-			Uint16 mask = (Uint16)(~surface->format->Amask);
+    switch (surface->format->BytesPerPixel) {
+    case 2:
+        {
+            Uint16 *row, *spot;
+            Uint16 ckey = (Uint16) surface->map->info.colorkey;
+            Uint16 mask = (Uint16) (~surface->format->Amask);
 
-			row = (Uint16 *)surface->pixels;
-			for (y = surface->h; y--; ) {
-				spot = row;
-				for (x = surface->w; x--; ) {
-					if (*spot == ckey) {
-						*spot &= mask;
-					}
-					++spot;
-				}
-				row += surface->pitch / 2;
-			}
-		}
-		break;
-	case 3:
-		/* FIXME */
-		break;
-	case 4:
-		{
-			Uint32 *row, *spot;
-			Uint32 ckey = surface->map->info.colorkey;
-			Uint32 mask = ~surface->format->Amask;
+            row = (Uint16 *) surface->pixels;
+            for (y = surface->h; y--;) {
+                spot = row;
+                for (x = surface->w; x--;) {
+                    if (*spot == ckey) {
+                        *spot &= mask;
+                    }
+                    ++spot;
+                }
+                row += surface->pitch / 2;
+            }
+        }
+        break;
+    case 3:
+        /* FIXME */
+        break;
+    case 4:
+        {
+            Uint32 *row, *spot;
+            Uint32 ckey = surface->map->info.colorkey;
+            Uint32 mask = ~surface->format->Amask;
 
-			row = (Uint32 *)surface->pixels;
-			for (y = surface->h; y--; ) {
-				spot = row;
-				for (x = surface->w; x--; ) {
-					if (*spot == ckey) {
-						*spot &= mask;
-					}
-					++spot;
-				}
-				row += surface->pitch / 4;
-			}
-		}
-		break;
-	}
+            row = (Uint32 *) surface->pixels;
+            for (y = surface->h; y--;) {
+                spot = row;
+                for (x = surface->w; x--;) {
+                    if (*spot == ckey) {
+                        *spot &= mask;
+                    }
+                    ++spot;
+                }
+                row += surface->pitch / 4;
+            }
+        }
+        break;
+    }
 
-	SDL_UnlockSurface(surface);
+    SDL_UnlockSurface(surface);
 
-	SDL_SetColorKey(surface, 0, 0);
+    SDL_SetColorKey(surface, 0, 0);
 }
 
 int
--- a/src/video/SDL_video.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/SDL_video.c	Tue Nov 25 02:21:53 2008 +0000
@@ -47,7 +47,7 @@
 #endif /* SDL_VIDEO_OPENGL */
 
 /* From SDL_surface.c */
-extern void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface);
+extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface);
 
 /* Available video drivers */
 static VideoBootStrap *bootstrap[] = {
@@ -1588,7 +1588,7 @@
             }
             dst = SDL_ConvertSurface(surface, dst_fmt, 0);
             if (dst) {
-				SDL_ConvertColorkeyToAlpha(dst);
+                SDL_ConvertColorkeyToAlpha(dst);
                 SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
                 SDL_FreeSurface(dst);
             }
--- a/src/video/SDL_yuv_sw.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/SDL_yuv_sw.c	Tue Nov 25 02:21:53 2008 +0000
@@ -91,9 +91,9 @@
 
 struct SDL_SW_YUVTexture
 {
-	Uint32 format;
+    Uint32 format;
     Uint32 target_format;
-	int w, h;
+    int w, h;
     Uint8 *pixels;
     int *colortab;
     Uint32 *rgb_2_pix;
@@ -1075,8 +1075,8 @@
 
     swdata->format = format;
     swdata->target_format = SDL_PIXELFORMAT_UNKNOWN;
-	swdata->w = w;
-	swdata->h = h;
+    swdata->w = w;
+    swdata->h = h;
     swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2);
     swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int));
     swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32));
@@ -1110,10 +1110,8 @@
         swdata->pitches[1] = swdata->pitches[0] / 2;
         swdata->pitches[2] = swdata->pitches[0] / 2;
         swdata->planes[0] = swdata->pixels;
-        swdata->planes[1] =
-            swdata->planes[0] + swdata->pitches[0] * h;
-        swdata->planes[2] =
-            swdata->planes[1] + swdata->pitches[1] * h / 2;
+        swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h;
+        swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2;
         break;
     case SDL_PIXELFORMAT_YUY2:
     case SDL_PIXELFORMAT_UYVY:
--- a/src/video/win32/SDL_d3drender.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/win32/SDL_d3drender.c	Tue Nov 25 02:21:53 2008 +0000
@@ -27,7 +27,7 @@
 
 /* Direct3D renderer implementation */
 
-#if 1 /* This takes more memory but you won't lose your texture data */
+#if 1                           /* This takes more memory but you won't lose your texture data */
 #define D3DPOOL_SDL	D3DPOOL_MANAGED
 #define SDL_MEMORY_POOL_MANAGED
 #else
@@ -633,7 +633,8 @@
     d3drect.top = rect->y;
     d3drect.bottom = rect->y + rect->h;
 
-    result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
+    result =
+        IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
     if (FAILED(result)) {
         D3D_SetError("LockRect()", result);
         return -1;
--- a/src/video/win32/SDL_gdirender.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/src/video/win32/SDL_gdirender.c	Tue Nov 25 02:21:53 2008 +0000
@@ -294,7 +294,8 @@
     texture->driverdata = data;
 
     if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
-        data->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
+        data->yuv =
+            SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
         if (!data->yuv) {
             return -1;
         }
--- a/test/testsprite.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/test/testsprite.c	Tue Nov 25 02:21:53 2008 +0000
@@ -311,7 +311,7 @@
     /* Print out some timing information */
     now = SDL_GetTicks();
     if (now > then) {
-		double fps = ((double) frames * 1000) / (now - then);
+        double fps = ((double) frames * 1000) / (now - then);
         printf("%2.2f frames per second\n", fps);
     }
     SDL_Quit();
--- a/test/testsprite2.c	Tue Nov 25 02:12:19 2008 +0000
+++ b/test/testsprite2.c	Tue Nov 25 02:21:53 2008 +0000
@@ -291,7 +291,7 @@
     /* Print out some timing information */
     now = SDL_GetTicks();
     if (now > then) {
-		double fps = ((double) frames * 1000) / (now - then);
+        double fps = ((double) frames * 1000) / (now - then);
         printf("%2.2f frames per second\n", fps);
     }
     quit(0);