src/video/SDL_stretch.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/SDL_stretch.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/SDL_stretch.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -56,7 +56,7 @@
     1.4  static unsigned char copy_row[4096];
     1.5  
     1.6  static int
     1.7 -generate_rowbytes (int src_w, int dst_w, int bpp)
     1.8 +generate_rowbytes(int src_w, int dst_w, int bpp)
     1.9  {
    1.10      static struct
    1.11      {
    1.12 @@ -89,7 +89,7 @@
    1.13          store = STORE_WORD;
    1.14          break;
    1.15      default:
    1.16 -        SDL_SetError ("ASM stretch of %d bytes isn't supported\n", bpp);
    1.17 +        SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
    1.18          return (-1);
    1.19      }
    1.20      pos = 0x10000;
    1.21 @@ -112,8 +112,8 @@
    1.22      *eip++ = RETURN;
    1.23  
    1.24      /* Verify that we didn't overflow (too late) */
    1.25 -    if (eip > (copy_row + sizeof (copy_row))) {
    1.26 -        SDL_SetError ("Copy buffer overflow");
    1.27 +    if (eip > (copy_row + sizeof(copy_row))) {
    1.28 +        SDL_SetError("Copy buffer overflow");
    1.29          return (-1);
    1.30      }
    1.31      return (0);
    1.32 @@ -139,12 +139,12 @@
    1.33  		pos += inc;				\
    1.34  	}						\
    1.35  }
    1.36 -DEFINE_COPY_ROW (copy_row1, Uint8)
    1.37 -    DEFINE_COPY_ROW (copy_row2, Uint16) DEFINE_COPY_ROW (copy_row4, Uint32)
    1.38 +DEFINE_COPY_ROW(copy_row1, Uint8)
    1.39 +    DEFINE_COPY_ROW(copy_row2, Uint16) DEFINE_COPY_ROW(copy_row4, Uint32)
    1.40  #endif /* USE_ASM_STRETCH */
    1.41  /* The ASM code doesn't handle 24-bpp stretch blits */
    1.42       void
    1.43 -     copy_row3 (Uint8 * src, int src_w, Uint8 * dst, int dst_w)
    1.44 +     copy_row3(Uint8 * src, int src_w, Uint8 * dst, int dst_w)
    1.45  {
    1.46      int i;
    1.47      int pos, inc;
    1.48 @@ -170,8 +170,8 @@
    1.49     NOTE:  This function is not safe to call from multiple threads!
    1.50  */
    1.51  int
    1.52 -SDL_SoftStretch (SDL_Surface * src, SDL_Rect * srcrect,
    1.53 -                 SDL_Surface * dst, SDL_Rect * dstrect)
    1.54 +SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect,
    1.55 +                SDL_Surface * dst, SDL_Rect * dstrect)
    1.56  {
    1.57      int src_locked;
    1.58      int dst_locked;
    1.59 @@ -189,7 +189,7 @@
    1.60      const int bpp = dst->format->BytesPerPixel;
    1.61  
    1.62      if (src->format->BitsPerPixel != dst->format->BitsPerPixel) {
    1.63 -        SDL_SetError ("Only works with same format surfaces");
    1.64 +        SDL_SetError("Only works with same format surfaces");
    1.65          return (-1);
    1.66      }
    1.67  
    1.68 @@ -198,7 +198,7 @@
    1.69          if ((srcrect->x < 0) || (srcrect->y < 0) ||
    1.70              ((srcrect->x + srcrect->w) > src->w) ||
    1.71              ((srcrect->y + srcrect->h) > src->h)) {
    1.72 -            SDL_SetError ("Invalid source blit rectangle");
    1.73 +            SDL_SetError("Invalid source blit rectangle");
    1.74              return (-1);
    1.75          }
    1.76      } else {
    1.77 @@ -212,7 +212,7 @@
    1.78          if ((dstrect->x < 0) || (dstrect->y < 0) ||
    1.79              ((dstrect->x + dstrect->w) > dst->w) ||
    1.80              ((dstrect->y + dstrect->h) > dst->h)) {
    1.81 -            SDL_SetError ("Invalid destination blit rectangle");
    1.82 +            SDL_SetError("Invalid destination blit rectangle");
    1.83              return (-1);
    1.84          }
    1.85      } else {
    1.86 @@ -225,21 +225,21 @@
    1.87  
    1.88      /* Lock the destination if it's in hardware */
    1.89      dst_locked = 0;
    1.90 -    if (SDL_MUSTLOCK (dst)) {
    1.91 -        if (SDL_LockSurface (dst) < 0) {
    1.92 -            SDL_SetError ("Unable to lock destination surface");
    1.93 +    if (SDL_MUSTLOCK(dst)) {
    1.94 +        if (SDL_LockSurface(dst) < 0) {
    1.95 +            SDL_SetError("Unable to lock destination surface");
    1.96              return (-1);
    1.97          }
    1.98          dst_locked = 1;
    1.99      }
   1.100      /* Lock the source if it's in hardware */
   1.101      src_locked = 0;
   1.102 -    if (SDL_MUSTLOCK (src)) {
   1.103 -        if (SDL_LockSurface (src) < 0) {
   1.104 +    if (SDL_MUSTLOCK(src)) {
   1.105 +        if (SDL_LockSurface(src) < 0) {
   1.106              if (dst_locked) {
   1.107 -                SDL_UnlockSurface (dst);
   1.108 +                SDL_UnlockSurface(dst);
   1.109              }
   1.110 -            SDL_SetError ("Unable to lock source surface");
   1.111 +            SDL_SetError("Unable to lock source surface");
   1.112              return (-1);
   1.113          }
   1.114          src_locked = 1;
   1.115 @@ -254,7 +254,7 @@
   1.116  
   1.117  #ifdef USE_ASM_STRETCH
   1.118      /* Write the opcodes for this stretch */
   1.119 -    if ((bpp != 3) && (generate_rowbytes (srcrect->w, dstrect->w, bpp) < 0)) {
   1.120 +    if ((bpp != 3) && (generate_rowbytes(srcrect->w, dstrect->w, bpp) < 0)) {
   1.121          return (-1);
   1.122      }
   1.123  #endif
   1.124 @@ -272,11 +272,11 @@
   1.125  #ifdef USE_ASM_STRETCH
   1.126          switch (bpp) {
   1.127          case 3:
   1.128 -            copy_row3 (srcp, srcrect->w, dstp, dstrect->w);
   1.129 +            copy_row3(srcp, srcrect->w, dstp, dstrect->w);
   1.130              break;
   1.131          default:
   1.132  #ifdef __GNUC__
   1.133 -          __asm__ __volatile__ ("call *%4": "=&D" (u1), "=&S" (u2): "0" (dstp), "1" (srcp), "r" (copy_row):"memory");
   1.134 +          __asm__ __volatile__("call *%4": "=&D"(u1), "=&S"(u2): "0"(dstp), "1"(srcp), "r"(copy_row):"memory");
   1.135  #elif defined(_MSC_VER) || defined(__WATCOMC__)
   1.136              {
   1.137                  void *code = copy_row;
   1.138 @@ -294,18 +294,18 @@
   1.139  #else
   1.140          switch (bpp) {
   1.141          case 1:
   1.142 -            copy_row1 (srcp, srcrect->w, dstp, dstrect->w);
   1.143 +            copy_row1(srcp, srcrect->w, dstp, dstrect->w);
   1.144              break;
   1.145          case 2:
   1.146 -            copy_row2 ((Uint16 *) srcp, srcrect->w,
   1.147 -                       (Uint16 *) dstp, dstrect->w);
   1.148 +            copy_row2((Uint16 *) srcp, srcrect->w,
   1.149 +                      (Uint16 *) dstp, dstrect->w);
   1.150              break;
   1.151          case 3:
   1.152 -            copy_row3 (srcp, srcrect->w, dstp, dstrect->w);
   1.153 +            copy_row3(srcp, srcrect->w, dstp, dstrect->w);
   1.154              break;
   1.155          case 4:
   1.156 -            copy_row4 ((Uint32 *) srcp, srcrect->w,
   1.157 -                       (Uint32 *) dstp, dstrect->w);
   1.158 +            copy_row4((Uint32 *) srcp, srcrect->w,
   1.159 +                      (Uint32 *) dstp, dstrect->w);
   1.160              break;
   1.161          }
   1.162  #endif
   1.163 @@ -314,10 +314,10 @@
   1.164  
   1.165      /* We need to unlock the surfaces if they're locked */
   1.166      if (dst_locked) {
   1.167 -        SDL_UnlockSurface (dst);
   1.168 +        SDL_UnlockSurface(dst);
   1.169      }
   1.170      if (src_locked) {
   1.171 -        SDL_UnlockSurface (src);
   1.172 +        SDL_UnlockSurface(src);
   1.173      }
   1.174      return (0);
   1.175  }