Skip to content
Permalink
Browse files
Update for Visual C++ 6.0
  • Loading branch information
slouken committed Feb 24, 2006
1 parent 8751a85 commit 33ac91fa10baf96d92ef49806cdaf44f27ec63ac
BIN +7 Bytes (100%) VisualC.zip
Binary file not shown.
@@ -34,6 +34,9 @@ typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#if _MSC_VER <= 1200
typedef unsigned long uintptr_t;
#endif
#endif
#define SDL_HAS_64BIT_TYPE 1

@@ -47,7 +47,7 @@ void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
if ( sample > 255 ) {
*dst = 255;
} else {
*dst = sample;
*dst = (Uint8)sample;
}
src += 2;
dst += 1;
@@ -68,7 +68,7 @@ void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
if ( sample < -128 ) {
*dst = -128;
} else {
*dst = sample;
*dst = (Sint8)sample;
}
src += 2;
dst += 1;
@@ -185,10 +185,8 @@ void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
src = cvt->buf;
dst = cvt->buf;
for ( i=cvt->len_cvt/6; i; --i ) {
lsample = src[0];
rsample = src[1];
dst[0] = lsample;
dst[1] = rsample;
dst[0] = src[0];
dst[1] = src[1];
src += 6;
dst += 2;
}
@@ -201,10 +199,8 @@ void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
src = (Sint8 *)cvt->buf;
dst = (Sint8 *)cvt->buf;
for ( i=cvt->len_cvt/6; i; --i ) {
lsample = src[0];
rsample = src[1];
dst[0] = lsample;
dst[1] = rsample;
dst[0] = src[0];
dst[1] = src[1];
src += 6;
dst += 2;
}
@@ -305,10 +301,8 @@ void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
src = cvt->buf;
dst = cvt->buf;
for ( i=cvt->len_cvt/4; i; --i ) {
lsample = src[0];
rsample = src[1];
dst[0] = lsample;
dst[1] = rsample;
dst[0] = src[0];
dst[1] = src[1];
src += 4;
dst += 2;
}
@@ -321,10 +315,8 @@ void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
src = (Sint8 *)cvt->buf;
dst = (Sint8 *)cvt->buf;
for ( i=cvt->len_cvt/4; i; --i ) {
lsample = src[0];
rsample = src[1];
dst[0] = lsample;
dst[1] = rsample;
dst[0] = src[0];
dst[1] = src[1];
src += 4;
dst += 2;
}
@@ -108,9 +108,9 @@ static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
if ( delta < 16 ) {
delta = 16;
}
state->iDelta = delta;
state->iDelta = (Uint16)delta;
state->iSamp2 = state->iSamp1;
state->iSamp1 = new_sample;
state->iSamp1 = (Sint16)new_sample;
return(new_sample);
}

@@ -371,8 +371,8 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
}

/* Store the initial sample we start with */
decoded[0] = state[c].sample&0xFF;
decoded[1] = state[c].sample>>8;
decoded[0] = (Uint8)(state[c].sample&0xFF);
decoded[1] = (Uint8)(state[c].sample>>8);
decoded += 2;
}

@@ -110,9 +110,9 @@
#define PIXEL_COPY(to, from, len, bpp) \
do { \
if(bpp == 4) { \
SDL_memcpy4(to, from, (unsigned)(len)); \
SDL_memcpy4(to, from, (size_t)(len)); \
} else { \
SDL_memcpy(to, from, (unsigned)(len) * (bpp)); \
SDL_memcpy(to, from, (size_t)(len) * (bpp)); \
} \
} while(0)

@@ -423,7 +423,7 @@ do { \
d = (d | d << 16) & 0x07e0f81f; \
d += (s - d) * ALPHA >> 5; \
d &= 0x07e0f81f; \
*dst++ = d | d >> 16; \
*dst++ = (Uint16)(d | d >> 16); \
} \
} while(0)

@@ -440,7 +440,7 @@ do { \
d = (d | d << 16) & 0x03e07c1f; \
d += (s - d) * ALPHA >> 5; \
d &= 0x03e07c1f; \
*dst++ = d | d >> 16; \
*dst++ = (Uint16)(d | d >> 16); \
} \
} while(0)

@@ -482,17 +482,17 @@ do { \
PIXEL_FROM_RGB(d, fmt, rd, gd, bd); \
switch(bpp) { \
case 2: \
*(Uint16 *)dst = d; \
*(Uint16 *)dst = (Uint16)d; \
break; \
case 3: \
if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
dst[0] = d >> 16; \
dst[1] = d >> 8; \
dst[2] = d; \
dst[0] = (Uint8)(d >> 16); \
dst[1] = (Uint8)(d >> 8); \
dst[2] = (Uint8)(d); \
} else { \
dst[0] = d; \
dst[1] = d >> 8; \
dst[2] = d >> 16; \
dst[0] = (Uint8)d; \
dst[1] = (Uint8)(d >> 8); \
dst[2] = (Uint8)(d >> 16); \
} \
break; \
case 4: \
@@ -575,10 +575,10 @@ do { \
/* helper: blend a single 16 bit pixel at 50% */
#define BLEND16_50(dst, src, mask) \
do { \
Uint32 s = *src++; \
Uint32 s = *src++; \
Uint32 d = *dst; \
*dst++ = (((s & mask) + (d & mask)) >> 1) \
+ (s & d & (~mask & 0xffff)); \
*dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
(s & d & (~mask & 0xffff))); \
} while(0)

/* basic 16bpp blender. mask is the pixels to keep when adding. */
@@ -971,32 +971,32 @@ int SDL_RLEBlit(SDL_Surface *src, SDL_Rect *srcrect,
*/
#define BLIT_TRANSL_565(src, dst) \
do { \
Uint32 s = src; \
Uint32 s = src; \
Uint32 d = dst; \
unsigned alpha = (s & 0x3e0) >> 5; \
s &= 0x07e0f81f; \
d = (d | d << 16) & 0x07e0f81f; \
d += (s - d) * alpha >> 5; \
d &= 0x07e0f81f; \
dst = d | d >> 16; \
dst = (Uint16)(d | d >> 16); \
} while(0)

#define BLIT_TRANSL_555(src, dst) \
do { \
Uint32 s = src; \
Uint32 s = src; \
Uint32 d = dst; \
unsigned alpha = (s & 0x3e0) >> 5; \
s &= 0x03e07c1f; \
d = (d | d << 16) & 0x03e07c1f; \
d += (s - d) * alpha >> 5; \
d &= 0x03e07c1f; \
dst = d | d >> 16; \
dst = (Uint16)(d | d >> 16); \
} while(0)

/* used to save the destination format in the encoding. Designed to be
macro-compatible with SDL_PixelFormat but without the unneeded fields */
typedef struct {
Uint8 BytesPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
@@ -1483,9 +1483,9 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask)
if(w) {
Uint16 d = *dstp, s;
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
s = prev_sw;
s = (Uint16)prev_sw;
else
s = prev_sw >> 16;
s = (Uint16)(prev_sw >> 16);
*dstp = BLEND16_50(d, s, mask);
srcp++;
dstp++;
@@ -1858,7 +1858,7 @@ static void Blit565to565SurfaceAlpha(SDL_BlitInfo *info)
d = (d | d << 16) & 0x07e0f81f;
d += (s - d) * alpha >> 5;
d &= 0x07e0f81f;
*dstp++ = d | d >> 16;
*dstp++ = (Uint16)(d | d >> 16);
}, width);
srcp += srcskip;
dstp += dstskip;
@@ -1894,7 +1894,7 @@ static void Blit555to555SurfaceAlpha(SDL_BlitInfo *info)
d = (d | d << 16) & 0x03e07c1f;
d += (s - d) * alpha >> 5;
d &= 0x03e07c1f;
*dstp++ = d | d >> 16;
*dstp++ = (Uint16)(d | d >> 16);
}, width);
srcp += srcskip;
dstp += dstskip;
@@ -1922,8 +1922,7 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)
Benchmark this! */
if(alpha) {
if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (s >> 8 & 0xf800) + (s >> 5 & 0x7e0)
+ (s >> 3 & 0x1f);
*dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
} else {
Uint32 d = *dstp;
/*
@@ -1935,7 +1934,7 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)
d = (d | d << 16) & 0x07e0f81f;
d += (s - d) * alpha >> 5;
d &= 0x07e0f81f;
*dstp = d | d >> 16;
*dstp = (Uint16)(d | d >> 16);
}
}
srcp++;
@@ -1967,8 +1966,7 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info)
Benchmark this! */
if(alpha) {
if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (s >> 9 & 0x7c00) + (s >> 6 & 0x3e0)
+ (s >> 3 & 0x1f);
*dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
} else {
Uint32 d = *dstp;
/*
@@ -1980,7 +1978,7 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info)
d = (d | d << 16) & 0x03e07c1f;
d += (s - d) * alpha >> 5;
d &= 0x03e07c1f;
*dstp = d | d >> 16;
*dstp = (Uint16)(d | d >> 16);
}
}
srcp++;
@@ -858,9 +858,9 @@ static Uint32 GetBlitFeatures( void )

/* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */
#define RGB888_RGB332(dst, src) { \
dst = (((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6); \
dst = (Uint8)((((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6)); \
}
static void Blit_RGB888_index8(SDL_BlitInfo *info)
{
@@ -962,9 +962,9 @@ static void Blit_RGB888_index8(SDL_BlitInfo *info)
}
/* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */
#define RGB888_RGB555(dst, src) { \
*(Uint16 *)(dst) = (((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3); \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3)); \
}
#define RGB888_RGB555_TWO(dst, src) { \
*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
@@ -1082,9 +1082,9 @@ static void Blit_RGB888_RGB555(SDL_BlitInfo *info)
}
/* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */
#define RGB888_RGB565(dst, src) { \
*(Uint16 *)(dst) = (((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3); \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3)); \
}
#define RGB888_RGB565_TWO(dst, src) { \
*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
@@ -2101,7 +2101,7 @@ static void BlitNto1Key(SDL_BlitInfo *info)
Uint32 rgbmask = ~srcfmt->Amask;
int srcbpp;
Uint32 Pixel;
Uint8 sR, sG, sB;
unsigned sR, sG, sB;

/* Set up some basic variables */
srcbpp = srcfmt->BytesPerPixel;
@@ -2115,9 +2115,9 @@ static void BlitNto1Key(SDL_BlitInfo *info)
sR, sG, sB);
if ( (Pixel & rgbmask) != ckey ) {
/* Pack RGB into 8bit pixel */
*dst = ((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ;
*dst = (Uint8)(((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)));
}
dst++;
src += srcbpp;
@@ -2134,9 +2134,9 @@ static void BlitNto1Key(SDL_BlitInfo *info)
sR, sG, sB);
if ( (Pixel & rgbmask) != ckey ) {
/* Pack RGB into 8bit pixel */
*dst = palmap[((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ];
*dst = (Uint8)palmap[((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ];
}
dst++;
src += srcbpp;
@@ -2232,7 +2232,7 @@ static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Uint8 srcbpp;
Uint8 dstbpp;
Uint32 Pixel;
Uint8 sR, sG, sB, sA;
unsigned sR, sG, sB, sA;

/* Set up some basic variables */
srcbpp = srcfmt->BytesPerPixel;

0 comments on commit 33ac91f

Please sign in to comment.