comparison src/video/SDL_blit_A.c @ 1428:5f52867ba65c

Update for Visual C++ 6.0
author Sam Lantinga <slouken@libsdl.org>
date Fri, 24 Feb 2006 18:24:57 +0000
parents d910939febfa
children 9ebbbb4ae53b
comparison
equal deleted inserted replaced
1427:5f5a74d29d18 1428:5f52867ba65c
1481 1481
1482 /* final pixel if any */ 1482 /* final pixel if any */
1483 if(w) { 1483 if(w) {
1484 Uint16 d = *dstp, s; 1484 Uint16 d = *dstp, s;
1485 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) 1485 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
1486 s = prev_sw; 1486 s = (Uint16)prev_sw;
1487 else 1487 else
1488 s = prev_sw >> 16; 1488 s = (Uint16)(prev_sw >> 16);
1489 *dstp = BLEND16_50(d, s, mask); 1489 *dstp = BLEND16_50(d, s, mask);
1490 srcp++; 1490 srcp++;
1491 dstp++; 1491 dstp++;
1492 } 1492 }
1493 srcp += srcskip - 1; 1493 srcp += srcskip - 1;
1856 */ 1856 */
1857 s = (s | s << 16) & 0x07e0f81f; 1857 s = (s | s << 16) & 0x07e0f81f;
1858 d = (d | d << 16) & 0x07e0f81f; 1858 d = (d | d << 16) & 0x07e0f81f;
1859 d += (s - d) * alpha >> 5; 1859 d += (s - d) * alpha >> 5;
1860 d &= 0x07e0f81f; 1860 d &= 0x07e0f81f;
1861 *dstp++ = d | d >> 16; 1861 *dstp++ = (Uint16)(d | d >> 16);
1862 }, width); 1862 }, width);
1863 srcp += srcskip; 1863 srcp += srcskip;
1864 dstp += dstskip; 1864 dstp += dstskip;
1865 } 1865 }
1866 } 1866 }
1892 */ 1892 */
1893 s = (s | s << 16) & 0x03e07c1f; 1893 s = (s | s << 16) & 0x03e07c1f;
1894 d = (d | d << 16) & 0x03e07c1f; 1894 d = (d | d << 16) & 0x03e07c1f;
1895 d += (s - d) * alpha >> 5; 1895 d += (s - d) * alpha >> 5;
1896 d &= 0x03e07c1f; 1896 d &= 0x03e07c1f;
1897 *dstp++ = d | d >> 16; 1897 *dstp++ = (Uint16)(d | d >> 16);
1898 }, width); 1898 }, width);
1899 srcp += srcskip; 1899 srcp += srcskip;
1900 dstp += dstskip; 1900 dstp += dstskip;
1901 } 1901 }
1902 } 1902 }
1920 compositioning used (>>8 instead of /255) doesn't handle 1920 compositioning used (>>8 instead of /255) doesn't handle
1921 it correctly. Also special-case alpha=0 for speed? 1921 it correctly. Also special-case alpha=0 for speed?
1922 Benchmark this! */ 1922 Benchmark this! */
1923 if(alpha) { 1923 if(alpha) {
1924 if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { 1924 if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
1925 *dstp = (s >> 8 & 0xf800) + (s >> 5 & 0x7e0) 1925 *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
1926 + (s >> 3 & 0x1f);
1927 } else { 1926 } else {
1928 Uint32 d = *dstp; 1927 Uint32 d = *dstp;
1929 /* 1928 /*
1930 * convert source and destination to G0RAB65565 1929 * convert source and destination to G0RAB65565
1931 * and blend all components at the same time 1930 * and blend all components at the same time
1933 s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800) 1932 s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
1934 + (s >> 3 & 0x1f); 1933 + (s >> 3 & 0x1f);
1935 d = (d | d << 16) & 0x07e0f81f; 1934 d = (d | d << 16) & 0x07e0f81f;
1936 d += (s - d) * alpha >> 5; 1935 d += (s - d) * alpha >> 5;
1937 d &= 0x07e0f81f; 1936 d &= 0x07e0f81f;
1938 *dstp = d | d >> 16; 1937 *dstp = (Uint16)(d | d >> 16);
1939 } 1938 }
1940 } 1939 }
1941 srcp++; 1940 srcp++;
1942 dstp++; 1941 dstp++;
1943 }, width); 1942 }, width);
1965 compositioning used (>>8 instead of /255) doesn't handle 1964 compositioning used (>>8 instead of /255) doesn't handle
1966 it correctly. Also special-case alpha=0 for speed? 1965 it correctly. Also special-case alpha=0 for speed?
1967 Benchmark this! */ 1966 Benchmark this! */
1968 if(alpha) { 1967 if(alpha) {
1969 if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { 1968 if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
1970 *dstp = (s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) 1969 *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
1971 + (s >> 3 & 0x1f);
1972 } else { 1970 } else {
1973 Uint32 d = *dstp; 1971 Uint32 d = *dstp;
1974 /* 1972 /*
1975 * convert source and destination to G0RAB65565 1973 * convert source and destination to G0RAB65565
1976 * and blend all components at the same time 1974 * and blend all components at the same time
1978 s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00) 1976 s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
1979 + (s >> 3 & 0x1f); 1977 + (s >> 3 & 0x1f);
1980 d = (d | d << 16) & 0x03e07c1f; 1978 d = (d | d << 16) & 0x03e07c1f;
1981 d += (s - d) * alpha >> 5; 1979 d += (s - d) * alpha >> 5;
1982 d &= 0x03e07c1f; 1980 d &= 0x03e07c1f;
1983 *dstp = d | d >> 16; 1981 *dstp = (Uint16)(d | d >> 16);
1984 } 1982 }
1985 } 1983 }
1986 srcp++; 1984 srcp++;
1987 dstp++; 1985 dstp++;
1988 }, width); 1986 }, width);