comparison src/video/SDL_blit_N.c @ 2698:e1da92da346c gsoc2008_nds

Clean up.
author Darren Alton <dalton@stevens.edu>
date Wed, 27 Aug 2008 04:23:38 +0000
parents c785543d1843
children 6258fa7cd300
comparison
equal deleted inserted replaced
2697:c9121b04cffa 2698:e1da92da346c
139 Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); 139 Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
140 Uint32 amask; 140 Uint32 amask;
141 /* Use zero for alpha if either surface doesn't have alpha */ 141 /* Use zero for alpha if either surface doesn't have alpha */
142 if (dstfmt->Amask) { 142 if (dstfmt->Amask) {
143 amask = 143 amask =
144 ((srcfmt->Amask) ? RESHIFT(srcfmt->Ashift) : 0x10) << (dstfmt-> 144 ((srcfmt->Amask) ? RESHIFT(srcfmt->
145 Ashift); 145 Ashift) : 0x10) << (dstfmt->Ashift);
146 } else { 146 } else {
147 amask = 147 amask =
148 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ 148 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^
149 0xFFFFFFFF); 149 0xFFFFFFFF);
150 } 150 }
1433 0x00001cc5, 0xffff0000, 0x00001ccd, 0xffff2000, 1433 0x00001cc5, 0xffff0000, 0x00001ccd, 0xffff2000,
1434 0x00001cd5, 0xffff4000, 0x00001cde, 0xffff6100, 1434 0x00001cd5, 0xffff4000, 0x00001cde, 0xffff6100,
1435 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100, 1435 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100,
1436 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200 1436 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200
1437 }; 1437 };
1438
1438 static void 1439 static void
1439 Blit_RGB565_ARGB8888(SDL_BlitInfo * info) 1440 Blit_RGB565_ARGB8888(SDL_BlitInfo * info)
1440 { 1441 {
1441 Blit_RGB565_32(info, RGB565_ARGB8888_LUT); 1442 Blit_RGB565_32(info, RGB565_ARGB8888_LUT);
1442 } 1443 }
1570 0xffc51c00, 0x000000ff, 0xffcd1c00, 0x000020ff, 1571 0xffc51c00, 0x000000ff, 0xffcd1c00, 0x000020ff,
1571 0xffd51c00, 0x000040ff, 0xffde1c00, 0x000061ff, 1572 0xffd51c00, 0x000040ff, 0xffde1c00, 0x000061ff,
1572 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff, 1573 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff,
1573 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff 1574 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff
1574 }; 1575 };
1576
1575 static void 1577 static void
1576 Blit_RGB565_ABGR8888(SDL_BlitInfo * info) 1578 Blit_RGB565_ABGR8888(SDL_BlitInfo * info)
1577 { 1579 {
1578 Blit_RGB565_32(info, RGB565_ABGR8888_LUT); 1580 Blit_RGB565_32(info, RGB565_ABGR8888_LUT);
1579 } 1581 }
1707 0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000, 1709 0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000,
1708 0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000, 1710 0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000,
1709 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000, 1711 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000,
1710 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000, 1712 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000,
1711 }; 1713 };
1714
1712 static void 1715 static void
1713 Blit_RGB565_RGBA8888(SDL_BlitInfo * info) 1716 Blit_RGB565_RGBA8888(SDL_BlitInfo * info)
1714 { 1717 {
1715 Blit_RGB565_32(info, RGB565_RGBA8888_LUT); 1718 Blit_RGB565_32(info, RGB565_RGBA8888_LUT);
1716 } 1719 }
1844 0xc51c0000, 0x0000ffff, 0xcd1c0000, 0x0020ffff, 1847 0xc51c0000, 0x0000ffff, 0xcd1c0000, 0x0020ffff,
1845 0xd51c0000, 0x0040ffff, 0xde1c0000, 0x0061ffff, 1848 0xd51c0000, 0x0040ffff, 0xde1c0000, 0x0061ffff,
1846 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff, 1849 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff,
1847 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff 1850 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff
1848 }; 1851 };
1852
1849 static void 1853 static void
1850 Blit_RGB565_BGRA8888(SDL_BlitInfo * info) 1854 Blit_RGB565_BGRA8888(SDL_BlitInfo * info)
1851 { 1855 {
1852 Blit_RGB565_32(info, RGB565_BGRA8888_LUT); 1856 Blit_RGB565_32(info, RGB565_BGRA8888_LUT);
1853 } 1857 }
1928 src += srcskip; 1932 src += srcskip;
1929 dst += dstskip; 1933 dst += dstskip;
1930 } 1934 }
1931 #endif /* USE_DUFFS_LOOP */ 1935 #endif /* USE_DUFFS_LOOP */
1932 } 1936 }
1937
1933 static void 1938 static void
1934 BlitNto1(SDL_BlitInfo * info) 1939 BlitNto1(SDL_BlitInfo * info)
1935 { 1940 {
1936 #ifndef USE_DUFFS_LOOP 1941 #ifndef USE_DUFFS_LOOP
1937 int c; 1942 int c;
2338 }; 2343 };
2339 static const struct blit_table normal_blit_1[] = { 2344 static const struct blit_table normal_blit_1[] = {
2340 /* Default for 8-bit RGB source, an invalid combination */ 2345 /* Default for 8-bit RGB source, an invalid combination */
2341 {0, 0, 0, 0, 0, 0, 0, 0, NULL}, 2346 {0, 0, 0, 0, 0, 0, 0, 0, NULL},
2342 }; 2347 };
2348
2343 static const struct blit_table normal_blit_2[] = { 2349 static const struct blit_table normal_blit_2[] = {
2344 #if SDL_ALTIVEC_BLITTERS 2350 #if SDL_ALTIVEC_BLITTERS
2345 /* has-altivec */ 2351 /* has-altivec */
2346 {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000, 2352 {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000,
2347 0x00000000, 2353 0x00000000,
2364 0, Blit_RGB565_BGRA8888, SET_ALPHA}, 2370 0, Blit_RGB565_BGRA8888, SET_ALPHA},
2365 2371
2366 /* Default for 16-bit RGB source, used if no other blitter matches */ 2372 /* Default for 16-bit RGB source, used if no other blitter matches */
2367 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} 2373 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
2368 }; 2374 };
2375
2369 static const struct blit_table normal_blit_3[] = { 2376 static const struct blit_table normal_blit_3[] = {
2370 /* Default for 24-bit RGB source, never optimized */ 2377 /* Default for 24-bit RGB source, never optimized */
2371 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} 2378 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
2372 }; 2379 };
2380
2373 static const struct blit_table normal_blit_4[] = { 2381 static const struct blit_table normal_blit_4[] = {
2374 #if SDL_ALTIVEC_BLITTERS 2382 #if SDL_ALTIVEC_BLITTERS
2375 /* has-altivec | dont-use-prefetch */ 2383 /* has-altivec | dont-use-prefetch */
2376 {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000, 2384 {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000,
2377 0x00000000, 2385 0x00000000,
2394 0x0000001F, 2402 0x0000001F,
2395 0, Blit_RGB888_RGB555, NO_ALPHA}, 2403 0, Blit_RGB888_RGB555, NO_ALPHA},
2396 /* Default for 32-bit RGB source, used if no other blitter matches */ 2404 /* Default for 32-bit RGB source, used if no other blitter matches */
2397 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} 2405 {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
2398 }; 2406 };
2407
2399 static const struct blit_table *normal_blit[] = { 2408 static const struct blit_table *normal_blit[] = {
2400 normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4 2409 normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4
2401 }; 2410 };
2402 2411
2403 /* Mask matches table, or table entry is zero */ 2412 /* Mask matches table, or table entry is zero */