indent
authorSam Lantinga <slouken@libsdl.org>
Tue, 25 Nov 2008 02:21:53 +0000
changeset 27866bacfecbf27e
parent 2785 fa1095d42a5b
child 2787 93764fe8601a
indent
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
     1.1 --- a/src/SDL_compat.c	Tue Nov 25 02:12:19 2008 +0000
     1.2 +++ b/src/SDL_compat.c	Tue Nov 25 02:21:53 2008 +0000
     1.3 @@ -1350,7 +1350,7 @@
     1.4      Uint16 pitches[3];
     1.5      Uint8 *planes[3];
     1.6  
     1.7 -	SDL_SW_YUVTexture *sw;
     1.8 +    SDL_SW_YUVTexture *sw;
     1.9  
    1.10      SDL_TextureID textureID;
    1.11  };
    1.12 @@ -1435,19 +1435,20 @@
    1.13      overlay->hwdata->textureID =
    1.14          SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h);
    1.15      if (overlay->hwdata->textureID) {
    1.16 -		overlay->hwdata->sw = NULL;
    1.17 -	} else {
    1.18 -		overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
    1.19 -		if (!overlay->hwdata->sw) {
    1.20 -			SDL_FreeYUVOverlay(overlay);
    1.21 -			return NULL;
    1.22 -		}
    1.23 +        overlay->hwdata->sw = NULL;
    1.24 +    } else {
    1.25 +        overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
    1.26 +        if (!overlay->hwdata->sw) {
    1.27 +            SDL_FreeYUVOverlay(overlay);
    1.28 +            return NULL;
    1.29 +        }
    1.30  
    1.31 -		/* Create a supported RGB format texture for display */
    1.32 -		overlay->hwdata->textureID =
    1.33 -			SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, w, h);
    1.34 -	}
    1.35 -	if (!overlay->hwdata->textureID) {
    1.36 +        /* Create a supported RGB format texture for display */
    1.37 +        overlay->hwdata->textureID =
    1.38 +            SDL_CreateTexture(SDL_PIXELFORMAT_RGB888,
    1.39 +                              SDL_TEXTUREACCESS_STREAMING, w, h);
    1.40 +    }
    1.41 +    if (!overlay->hwdata->textureID) {
    1.42          SDL_FreeYUVOverlay(overlay);
    1.43          return NULL;
    1.44      }
    1.45 @@ -1465,16 +1466,18 @@
    1.46          SDL_SetError("Passed a NULL overlay");
    1.47          return -1;
    1.48      }
    1.49 -	if (overlay->hwdata->sw) {
    1.50 -		if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch) < 0) {
    1.51 -			return -1;
    1.52 -		}
    1.53 -	} else {
    1.54 -		if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
    1.55 -			< 0) {
    1.56 -			return -1;
    1.57 -		}
    1.58 -	}
    1.59 +    if (overlay->hwdata->sw) {
    1.60 +        if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
    1.61 +            < 0) {
    1.62 +            return -1;
    1.63 +        }
    1.64 +    } else {
    1.65 +        if (SDL_LockTexture
    1.66 +            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
    1.67 +            < 0) {
    1.68 +            return -1;
    1.69 +        }
    1.70 +    }
    1.71      overlay->pixels[0] = (Uint8 *) pixels;
    1.72      overlay->pitches[0] = pitch;
    1.73      switch (overlay->format) {
    1.74 @@ -1501,22 +1504,25 @@
    1.75      if (!overlay) {
    1.76          return;
    1.77      }
    1.78 -	if (overlay->hwdata->sw) {
    1.79 -		void *pixels;
    1.80 -		int pitch;
    1.81 -		if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
    1.82 -			SDL_Rect srcrect;
    1.83 +    if (overlay->hwdata->sw) {
    1.84 +        void *pixels;
    1.85 +        int pitch;
    1.86 +        if (SDL_LockTexture
    1.87 +            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
    1.88 +            SDL_Rect srcrect;
    1.89  
    1.90 -			srcrect.x = 0;
    1.91 -			srcrect.y = 0;
    1.92 -			srcrect.w = overlay->w;
    1.93 -			srcrect.h = overlay->h;
    1.94 -			SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, SDL_PIXELFORMAT_RGB888, overlay->w, overlay->h, pixels, pitch);
    1.95 -			SDL_UnlockTexture(overlay->hwdata->textureID);
    1.96 -		}
    1.97 -	} else {
    1.98 -		SDL_UnlockTexture(overlay->hwdata->textureID);
    1.99 -	}
   1.100 +            srcrect.x = 0;
   1.101 +            srcrect.y = 0;
   1.102 +            srcrect.w = overlay->w;
   1.103 +            srcrect.h = overlay->h;
   1.104 +            SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
   1.105 +                                SDL_PIXELFORMAT_RGB888, overlay->w,
   1.106 +                                overlay->h, pixels, pitch);
   1.107 +            SDL_UnlockTexture(overlay->hwdata->textureID);
   1.108 +        }
   1.109 +    } else {
   1.110 +        SDL_UnlockTexture(overlay->hwdata->textureID);
   1.111 +    }
   1.112  }
   1.113  
   1.114  int
     2.1 --- a/src/haptic/win32/SDL_syshaptic.c	Tue Nov 25 02:12:19 2008 +0000
     2.2 +++ b/src/haptic/win32/SDL_syshaptic.c	Tue Nov 25 02:21:53 2008 +0000
     2.3 @@ -105,11 +105,11 @@
     2.4  static void
     2.5  DI_SetError(const char *str, HRESULT err)
     2.6  {
     2.7 -	/*
     2.8 -    SDL_SetError("Haptic: %s - %s: %s", str,
     2.9 -                 DXGetErrorString8A(err), DXGetErrorDescription8A(err));
    2.10 -	 */
    2.11 -	SDL_SetError("Haptic error %s", str);
    2.12 +    /*
    2.13 +       SDL_SetError("Haptic: %s - %s: %s", str,
    2.14 +       DXGetErrorString8A(err), DXGetErrorDescription8A(err));
    2.15 +     */
    2.16 +    SDL_SetError("Haptic error %s", str);
    2.17  }
    2.18  
    2.19  
    2.20 @@ -154,7 +154,7 @@
    2.21      }
    2.22  
    2.23      ret = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER,
    2.24 -                           &IID_IDirectInput, (LPVOID)&dinput);
    2.25 +                           &IID_IDirectInput, (LPVOID) & dinput);
    2.26      if (FAILED(ret)) {
    2.27          DI_SetError("CoCreateInstance", ret);
    2.28          return -1;
     3.1 --- a/src/video/SDL_renderer_sw.c	Tue Nov 25 02:12:19 2008 +0000
     3.2 +++ b/src/video/SDL_renderer_sw.c	Tue Nov 25 02:21:53 2008 +0000
     3.3 @@ -361,7 +361,8 @@
     3.4  SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
     3.5  {
     3.6      if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
     3.7 -        texture->driverdata = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
     3.8 +        texture->driverdata =
     3.9 +            SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
    3.10      } else {
    3.11          int bpp;
    3.12          Uint32 Rmask, Gmask, Bmask, Amask;
     4.1 --- a/src/video/SDL_surface.c	Tue Nov 25 02:12:19 2008 +0000
     4.2 +++ b/src/video/SDL_surface.c	Tue Nov 25 02:21:53 2008 +0000
     4.3 @@ -271,68 +271,68 @@
     4.4  
     4.5  /* This is a fairly slow function to switch from colorkey to alpha */
     4.6  void
     4.7 -SDL_ConvertColorkeyToAlpha(SDL_Surface *surface)
     4.8 +SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
     4.9  {
    4.10 -	int x, y;
    4.11 +    int x, y;
    4.12  
    4.13 -	if (!surface) {
    4.14 -		return;
    4.15 -	}
    4.16 +    if (!surface) {
    4.17 +        return;
    4.18 +    }
    4.19  
    4.20 -	if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
    4.21 -	    !surface->format->Amask) {
    4.22 -		return;
    4.23 -	}
    4.24 +    if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
    4.25 +        !surface->format->Amask) {
    4.26 +        return;
    4.27 +    }
    4.28  
    4.29 -	SDL_LockSurface(surface);
    4.30 +    SDL_LockSurface(surface);
    4.31  
    4.32 -	switch (surface->format->BytesPerPixel) {
    4.33 -	case 2:
    4.34 -		{
    4.35 -			Uint16 *row, *spot;
    4.36 -			Uint16 ckey = (Uint16)surface->map->info.colorkey;
    4.37 -			Uint16 mask = (Uint16)(~surface->format->Amask);
    4.38 +    switch (surface->format->BytesPerPixel) {
    4.39 +    case 2:
    4.40 +        {
    4.41 +            Uint16 *row, *spot;
    4.42 +            Uint16 ckey = (Uint16) surface->map->info.colorkey;
    4.43 +            Uint16 mask = (Uint16) (~surface->format->Amask);
    4.44  
    4.45 -			row = (Uint16 *)surface->pixels;
    4.46 -			for (y = surface->h; y--; ) {
    4.47 -				spot = row;
    4.48 -				for (x = surface->w; x--; ) {
    4.49 -					if (*spot == ckey) {
    4.50 -						*spot &= mask;
    4.51 -					}
    4.52 -					++spot;
    4.53 -				}
    4.54 -				row += surface->pitch / 2;
    4.55 -			}
    4.56 -		}
    4.57 -		break;
    4.58 -	case 3:
    4.59 -		/* FIXME */
    4.60 -		break;
    4.61 -	case 4:
    4.62 -		{
    4.63 -			Uint32 *row, *spot;
    4.64 -			Uint32 ckey = surface->map->info.colorkey;
    4.65 -			Uint32 mask = ~surface->format->Amask;
    4.66 +            row = (Uint16 *) surface->pixels;
    4.67 +            for (y = surface->h; y--;) {
    4.68 +                spot = row;
    4.69 +                for (x = surface->w; x--;) {
    4.70 +                    if (*spot == ckey) {
    4.71 +                        *spot &= mask;
    4.72 +                    }
    4.73 +                    ++spot;
    4.74 +                }
    4.75 +                row += surface->pitch / 2;
    4.76 +            }
    4.77 +        }
    4.78 +        break;
    4.79 +    case 3:
    4.80 +        /* FIXME */
    4.81 +        break;
    4.82 +    case 4:
    4.83 +        {
    4.84 +            Uint32 *row, *spot;
    4.85 +            Uint32 ckey = surface->map->info.colorkey;
    4.86 +            Uint32 mask = ~surface->format->Amask;
    4.87  
    4.88 -			row = (Uint32 *)surface->pixels;
    4.89 -			for (y = surface->h; y--; ) {
    4.90 -				spot = row;
    4.91 -				for (x = surface->w; x--; ) {
    4.92 -					if (*spot == ckey) {
    4.93 -						*spot &= mask;
    4.94 -					}
    4.95 -					++spot;
    4.96 -				}
    4.97 -				row += surface->pitch / 4;
    4.98 -			}
    4.99 -		}
   4.100 -		break;
   4.101 -	}
   4.102 +            row = (Uint32 *) surface->pixels;
   4.103 +            for (y = surface->h; y--;) {
   4.104 +                spot = row;
   4.105 +                for (x = surface->w; x--;) {
   4.106 +                    if (*spot == ckey) {
   4.107 +                        *spot &= mask;
   4.108 +                    }
   4.109 +                    ++spot;
   4.110 +                }
   4.111 +                row += surface->pitch / 4;
   4.112 +            }
   4.113 +        }
   4.114 +        break;
   4.115 +    }
   4.116  
   4.117 -	SDL_UnlockSurface(surface);
   4.118 +    SDL_UnlockSurface(surface);
   4.119  
   4.120 -	SDL_SetColorKey(surface, 0, 0);
   4.121 +    SDL_SetColorKey(surface, 0, 0);
   4.122  }
   4.123  
   4.124  int
     5.1 --- a/src/video/SDL_video.c	Tue Nov 25 02:12:19 2008 +0000
     5.2 +++ b/src/video/SDL_video.c	Tue Nov 25 02:21:53 2008 +0000
     5.3 @@ -47,7 +47,7 @@
     5.4  #endif /* SDL_VIDEO_OPENGL */
     5.5  
     5.6  /* From SDL_surface.c */
     5.7 -extern void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface);
     5.8 +extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface);
     5.9  
    5.10  /* Available video drivers */
    5.11  static VideoBootStrap *bootstrap[] = {
    5.12 @@ -1588,7 +1588,7 @@
    5.13              }
    5.14              dst = SDL_ConvertSurface(surface, dst_fmt, 0);
    5.15              if (dst) {
    5.16 -				SDL_ConvertColorkeyToAlpha(dst);
    5.17 +                SDL_ConvertColorkeyToAlpha(dst);
    5.18                  SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
    5.19                  SDL_FreeSurface(dst);
    5.20              }
     6.1 --- a/src/video/SDL_yuv_sw.c	Tue Nov 25 02:12:19 2008 +0000
     6.2 +++ b/src/video/SDL_yuv_sw.c	Tue Nov 25 02:21:53 2008 +0000
     6.3 @@ -91,9 +91,9 @@
     6.4  
     6.5  struct SDL_SW_YUVTexture
     6.6  {
     6.7 -	Uint32 format;
     6.8 +    Uint32 format;
     6.9      Uint32 target_format;
    6.10 -	int w, h;
    6.11 +    int w, h;
    6.12      Uint8 *pixels;
    6.13      int *colortab;
    6.14      Uint32 *rgb_2_pix;
    6.15 @@ -1075,8 +1075,8 @@
    6.16  
    6.17      swdata->format = format;
    6.18      swdata->target_format = SDL_PIXELFORMAT_UNKNOWN;
    6.19 -	swdata->w = w;
    6.20 -	swdata->h = h;
    6.21 +    swdata->w = w;
    6.22 +    swdata->h = h;
    6.23      swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2);
    6.24      swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int));
    6.25      swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32));
    6.26 @@ -1110,10 +1110,8 @@
    6.27          swdata->pitches[1] = swdata->pitches[0] / 2;
    6.28          swdata->pitches[2] = swdata->pitches[0] / 2;
    6.29          swdata->planes[0] = swdata->pixels;
    6.30 -        swdata->planes[1] =
    6.31 -            swdata->planes[0] + swdata->pitches[0] * h;
    6.32 -        swdata->planes[2] =
    6.33 -            swdata->planes[1] + swdata->pitches[1] * h / 2;
    6.34 +        swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h;
    6.35 +        swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2;
    6.36          break;
    6.37      case SDL_PIXELFORMAT_YUY2:
    6.38      case SDL_PIXELFORMAT_UYVY:
     7.1 --- a/src/video/win32/SDL_d3drender.c	Tue Nov 25 02:12:19 2008 +0000
     7.2 +++ b/src/video/win32/SDL_d3drender.c	Tue Nov 25 02:21:53 2008 +0000
     7.3 @@ -27,7 +27,7 @@
     7.4  
     7.5  /* Direct3D renderer implementation */
     7.6  
     7.7 -#if 1 /* This takes more memory but you won't lose your texture data */
     7.8 +#if 1                           /* This takes more memory but you won't lose your texture data */
     7.9  #define D3DPOOL_SDL	D3DPOOL_MANAGED
    7.10  #define SDL_MEMORY_POOL_MANAGED
    7.11  #else
    7.12 @@ -633,7 +633,8 @@
    7.13      d3drect.top = rect->y;
    7.14      d3drect.bottom = rect->y + rect->h;
    7.15  
    7.16 -    result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
    7.17 +    result =
    7.18 +        IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
    7.19      if (FAILED(result)) {
    7.20          D3D_SetError("LockRect()", result);
    7.21          return -1;
     8.1 --- a/src/video/win32/SDL_gdirender.c	Tue Nov 25 02:12:19 2008 +0000
     8.2 +++ b/src/video/win32/SDL_gdirender.c	Tue Nov 25 02:21:53 2008 +0000
     8.3 @@ -294,7 +294,8 @@
     8.4      texture->driverdata = data;
     8.5  
     8.6      if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
     8.7 -        data->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
     8.8 +        data->yuv =
     8.9 +            SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
    8.10          if (!data->yuv) {
    8.11              return -1;
    8.12          }
     9.1 --- a/test/testsprite.c	Tue Nov 25 02:12:19 2008 +0000
     9.2 +++ b/test/testsprite.c	Tue Nov 25 02:21:53 2008 +0000
     9.3 @@ -311,7 +311,7 @@
     9.4      /* Print out some timing information */
     9.5      now = SDL_GetTicks();
     9.6      if (now > then) {
     9.7 -		double fps = ((double) frames * 1000) / (now - then);
     9.8 +        double fps = ((double) frames * 1000) / (now - then);
     9.9          printf("%2.2f frames per second\n", fps);
    9.10      }
    9.11      SDL_Quit();
    10.1 --- a/test/testsprite2.c	Tue Nov 25 02:12:19 2008 +0000
    10.2 +++ b/test/testsprite2.c	Tue Nov 25 02:21:53 2008 +0000
    10.3 @@ -291,7 +291,7 @@
    10.4      /* Print out some timing information */
    10.5      now = SDL_GetTicks();
    10.6      if (now > then) {
    10.7 -		double fps = ((double) frames * 1000) / (now - then);
    10.8 +        double fps = ((double) frames * 1000) / (now - then);
    10.9          printf("%2.2f frames per second\n", fps);
   10.10      }
   10.11      quit(0);