Mercurial > sdl-ios-xcode
comparison src/video/SDL_RLEaccel.c @ 1456:84de7511f79f
Fixed a bunch of 64-bit compatibility problems
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 01 Mar 2006 09:43:47 +0000 |
parents | 5f52867ba65c |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
1455:f487bb150acc | 1456:84de7511f79f |
---|---|
585 #define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \ | 585 #define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \ |
586 do { \ | 586 do { \ |
587 unsigned n = (length); \ | 587 unsigned n = (length); \ |
588 Uint16 *src = (Uint16 *)(from); \ | 588 Uint16 *src = (Uint16 *)(from); \ |
589 Uint16 *dst = (Uint16 *)(to); \ | 589 Uint16 *dst = (Uint16 *)(to); \ |
590 if(((unsigned long)src ^ (unsigned long)dst) & 3) { \ | 590 if(((uintptr_t)src ^ (uintptr_t)dst) & 3) { \ |
591 /* source and destination not in phase, blit one by one */ \ | 591 /* source and destination not in phase, blit one by one */ \ |
592 while(n--) \ | 592 while(n--) \ |
593 BLEND16_50(dst, src, mask); \ | 593 BLEND16_50(dst, src, mask); \ |
594 } else { \ | 594 } else { \ |
595 if((unsigned long)src & 3) { \ | 595 if((uintptr_t)src & 3) { \ |
596 /* first odd pixel */ \ | 596 /* first odd pixel */ \ |
597 BLEND16_50(dst, src, mask); \ | 597 BLEND16_50(dst, src, mask); \ |
598 n--; \ | 598 n--; \ |
599 } \ | 599 } \ |
600 for(; n > 1; n -= 2) { \ | 600 for(; n > 1; n -= 2) { \ |
1053 } else if(!ofs) \ | 1053 } else if(!ofs) \ |
1054 return; \ | 1054 return; \ |
1055 } while(ofs < w); \ | 1055 } while(ofs < w); \ |
1056 /* skip padding if necessary */ \ | 1056 /* skip padding if necessary */ \ |
1057 if(sizeof(Ptype) == 2) \ | 1057 if(sizeof(Ptype) == 2) \ |
1058 srcbuf += (unsigned long)srcbuf & 2; \ | 1058 srcbuf += (uintptr_t)srcbuf & 2; \ |
1059 /* blit translucent pixels on the same line */ \ | 1059 /* blit translucent pixels on the same line */ \ |
1060 ofs = 0; \ | 1060 ofs = 0; \ |
1061 do { \ | 1061 do { \ |
1062 unsigned run; \ | 1062 unsigned run; \ |
1063 ofs += ((Uint16 *)srcbuf)[0]; \ | 1063 ofs += ((Uint16 *)srcbuf)[0]; \ |
1145 } else if(!ofs) | 1145 } else if(!ofs) |
1146 goto done; | 1146 goto done; |
1147 } while(ofs < w); | 1147 } while(ofs < w); |
1148 | 1148 |
1149 /* skip padding */ | 1149 /* skip padding */ |
1150 srcbuf += (unsigned long)srcbuf & 2; | 1150 srcbuf += (uintptr_t)srcbuf & 2; |
1151 | 1151 |
1152 /* skip translucent line */ | 1152 /* skip translucent line */ |
1153 ofs = 0; | 1153 ofs = 0; |
1154 do { | 1154 do { |
1155 int run; | 1155 int run; |
1209 } else if(!ofs) \ | 1209 } else if(!ofs) \ |
1210 goto done; \ | 1210 goto done; \ |
1211 } while(ofs < w); \ | 1211 } while(ofs < w); \ |
1212 /* skip padding if necessary */ \ | 1212 /* skip padding if necessary */ \ |
1213 if(sizeof(Ptype) == 2) \ | 1213 if(sizeof(Ptype) == 2) \ |
1214 srcbuf += (unsigned long)srcbuf & 2; \ | 1214 srcbuf += (uintptr_t)srcbuf & 2; \ |
1215 /* blit translucent pixels on the same line */ \ | 1215 /* blit translucent pixels on the same line */ \ |
1216 ofs = 0; \ | 1216 ofs = 0; \ |
1217 do { \ | 1217 do { \ |
1218 unsigned run; \ | 1218 unsigned run; \ |
1219 ofs += ((Uint16 *)srcbuf)[0]; \ | 1219 ofs += ((Uint16 *)srcbuf)[0]; \ |
1545 run -= len; | 1545 run -= len; |
1546 } | 1546 } |
1547 } while(x < w); | 1547 } while(x < w); |
1548 | 1548 |
1549 /* Make sure the next output address is 32-bit aligned */ | 1549 /* Make sure the next output address is 32-bit aligned */ |
1550 dst += (unsigned long)dst & 2; | 1550 dst += (uintptr_t)dst & 2; |
1551 | 1551 |
1552 /* Next, encode all translucent pixels of the same scan line */ | 1552 /* Next, encode all translucent pixels of the same scan line */ |
1553 x = 0; | 1553 x = 0; |
1554 do { | 1554 do { |
1555 int run, skip, len; | 1555 int run, skip, len; |
1872 return(SDL_TRUE); | 1872 return(SDL_TRUE); |
1873 } while(ofs < w); | 1873 } while(ofs < w); |
1874 | 1874 |
1875 /* skip padding if needed */ | 1875 /* skip padding if needed */ |
1876 if(bpp == 2) | 1876 if(bpp == 2) |
1877 srcbuf += (unsigned long)srcbuf & 2; | 1877 srcbuf += (uintptr_t)srcbuf & 2; |
1878 | 1878 |
1879 /* copy translucent pixels */ | 1879 /* copy translucent pixels */ |
1880 ofs = 0; | 1880 ofs = 0; |
1881 do { | 1881 do { |
1882 unsigned run; | 1882 unsigned run; |