src/video/SDL_RLEaccel.c
branchgsoc2008_nds
changeset 2669 e27bdcc80744
parent 2328 91e601d9df8b
child 2798 5f3831f1c3ea
equal deleted inserted replaced
2668:bb3241de289e 2669:e27bdcc80744
  1152                         if (run) {
  1152                         if (run) {
  1153                             srcbuf += 2 * run;
  1153                             srcbuf += 2 * run;
  1154                             ofs += run;
  1154                             ofs += run;
  1155                         } else if (!ofs)
  1155                         } else if (!ofs)
  1156                             goto done;
  1156                             goto done;
  1157                     }
  1157                     } while (ofs < w);
  1158                     while (ofs < w);
       
  1159 
  1158 
  1160                     /* skip padding */
  1159                     /* skip padding */
  1161                     srcbuf += (uintptr_t) srcbuf & 2;
  1160                     srcbuf += (uintptr_t) srcbuf & 2;
  1162 
  1161 
  1163                     /* skip translucent line */
  1162                     /* skip translucent line */
  1166                         int run;
  1165                         int run;
  1167                         ofs += ((Uint16 *) srcbuf)[0];
  1166                         ofs += ((Uint16 *) srcbuf)[0];
  1168                         run = ((Uint16 *) srcbuf)[1];
  1167                         run = ((Uint16 *) srcbuf)[1];
  1169                         srcbuf += 4 * (run + 1);
  1168                         srcbuf += 4 * (run + 1);
  1170                         ofs += run;
  1169                         ofs += run;
  1171                     }
  1170                     } while (ofs < w);
  1172                     while (ofs < w);
  1171                 } while (--vskip);
  1173                 }
       
  1174                 while (--vskip);
       
  1175             } else {
  1172             } else {
  1176                 /* the 32/32 interleaved format */
  1173                 /* the 32/32 interleaved format */
  1177                 vskip <<= 1;    /* opaque and translucent have same format */
  1174                 vskip <<= 1;    /* opaque and translucent have same format */
  1178                 do {
  1175                 do {
  1179                     ofs = 0;
  1176                     ofs = 0;
  1185                         if (run) {
  1182                         if (run) {
  1186                             srcbuf += 4 * run;
  1183                             srcbuf += 4 * run;
  1187                             ofs += run;
  1184                             ofs += run;
  1188                         } else if (!ofs)
  1185                         } else if (!ofs)
  1189                             goto done;
  1186                             goto done;
  1190                     }
  1187                     } while (ofs < w);
  1191                     while (ofs < w);
  1188                 } while (--vskip);
  1192                 }
       
  1193                 while (--vskip);
       
  1194             }
  1189             }
  1195         }
  1190         }
  1196     }
  1191     }
  1197 
  1192 
  1198     /* if left or right edge clipping needed, call clip blit */
  1193     /* if left or right edge clipping needed, call clip blit */
  1565                     ADD_OPAQUE_COUNTS(0, len);
  1560                     ADD_OPAQUE_COUNTS(0, len);
  1566                     dst += copy_opaque(dst, src + runstart, len, sf, df);
  1561                     dst += copy_opaque(dst, src + runstart, len, sf, df);
  1567                     runstart += len;
  1562                     runstart += len;
  1568                     run -= len;
  1563                     run -= len;
  1569                 }
  1564                 }
  1570             }
  1565             } while (x < w);
  1571             while (x < w);
       
  1572 
  1566 
  1573             /* Make sure the next output address is 32-bit aligned */
  1567             /* Make sure the next output address is 32-bit aligned */
  1574             dst += (uintptr_t) dst & 2;
  1568             dst += (uintptr_t) dst & 2;
  1575 
  1569 
  1576             /* Next, encode all translucent pixels of the same scan line */
  1570             /* Next, encode all translucent pixels of the same scan line */
  1602                     runstart += len;
  1596                     runstart += len;
  1603                     run -= len;
  1597                     run -= len;
  1604                 }
  1598                 }
  1605                 if (!blankline)
  1599                 if (!blankline)
  1606                     lastline = dst;
  1600                     lastline = dst;
  1607             }
  1601             } while (x < w);
  1608             while (x < w);
       
  1609 
  1602 
  1610             src += surface->pitch >> 2;
  1603             src += surface->pitch >> 2;
  1611         }
  1604         }
  1612         dst = lastline;         /* back up past trailing blank lines */
  1605         dst = lastline;         /* back up past trailing blank lines */
  1613         ADD_OPAQUE_COUNTS(0, 0);
  1606         ADD_OPAQUE_COUNTS(0, 0);
  1769                 runstart += len;
  1762                 runstart += len;
  1770                 run -= len;
  1763                 run -= len;
  1771             }
  1764             }
  1772             if (!blankline)
  1765             if (!blankline)
  1773                 lastline = dst;
  1766                 lastline = dst;
  1774         }
  1767         } while (x < w);
  1775         while (x < w);
       
  1776 
  1768 
  1777         srcbuf += surface->pitch;
  1769         srcbuf += surface->pitch;
  1778     }
  1770     }
  1779     dst = lastline;             /* back up bast trailing blank lines */
  1771     dst = lastline;             /* back up bast trailing blank lines */
  1780     ADD_COUNTS(0, 0);
  1772     ADD_COUNTS(0, 0);
  1909             if (run) {
  1901             if (run) {
  1910                 srcbuf += uncopy_opaque(dst + ofs, srcbuf, run, df, sf);
  1902                 srcbuf += uncopy_opaque(dst + ofs, srcbuf, run, df, sf);
  1911                 ofs += run;
  1903                 ofs += run;
  1912             } else if (!ofs)
  1904             } else if (!ofs)
  1913                 return (SDL_TRUE);
  1905                 return (SDL_TRUE);
  1914         }
  1906         } while (ofs < w);
  1915         while (ofs < w);
       
  1916 
  1907 
  1917         /* skip padding if needed */
  1908         /* skip padding if needed */
  1918         if (bpp == 2)
  1909         if (bpp == 2)
  1919             srcbuf += (uintptr_t) srcbuf & 2;
  1910             srcbuf += (uintptr_t) srcbuf & 2;
  1920 
  1911 
  1927             srcbuf += 4;
  1918             srcbuf += 4;
  1928             if (run) {
  1919             if (run) {
  1929                 srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
  1920                 srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
  1930                 ofs += run;
  1921                 ofs += run;
  1931             }
  1922             }
  1932         }
  1923         } while (ofs < w);
  1933         while (ofs < w);
       
  1934         dst += surface->pitch >> 2;
  1924         dst += surface->pitch >> 2;
  1935     }
  1925     }
  1936     /* Make the compiler happy */
  1926     /* Make the compiler happy */
  1937     return (SDL_TRUE);
  1927     return (SDL_TRUE);
  1938 }
  1928 }