19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Lesser General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2.1 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Lesser General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Lesser General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free Software 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_video.h" 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_endian.h" 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_cpuinfo.h" 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_blit.h" 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Functions to blit from N-bit surfaces to other surfaces */ 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_ALTIVEC_BLITTERS 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if __MWERKS__ 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#pragma altivec_model on 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef HAVE_ALTIVEC_H 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <altivec.h> 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define assert(X) 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __MACOSX__ 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <sys/sysctl.h> 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic size_t GetL3CacheSize( void ) 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const char key[] = "hw.l3cachesize"; 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall u_int64_t result = 0; 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall size_t typeSize = sizeof( result ); 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int err = sysctlbyname( key, &result, &typeSize, NULL, 0 ); 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if( 0 != err ) return 0; 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return result; 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic size_t GetL3CacheSize( void ) 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* XXX: Just guess G4 */ 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return 2097152; 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* __MACOSX__ */ 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if (defined(__MACOSX__) && (__GNUC__ < 4)) 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p ) 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \ 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (vector unsigned short) ( a,b,c,d,e,f,g,h ) 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p } 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \ 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (vector unsigned short) { a,b,c,d,e,f,g,h } 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F) 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define VSWIZZLE32(a,b,c,d) (vector unsigned char) \ 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ( 0x00+a, 0x00+b, 0x00+c, 0x00+d, \ 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04+a, 0x04+b, 0x04+c, 0x04+d, \ 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08+a, 0x08+b, 0x08+c, 0x08+d, \ 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0C+a, 0x0C+b, 0x0C+c, 0x0C+d ) 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define MAKE8888(dstfmt, r, g, b, a) \ 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ( ((r<<dstfmt->Rshift)&dstfmt->Rmask) | \ 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((g<<dstfmt->Gshift)&dstfmt->Gmask) | \ 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((b<<dstfmt->Bshift)&dstfmt->Bmask) | \ 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((a<<dstfmt->Ashift)&dstfmt->Amask) ) 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Data Stream Touch...Altivec cache prefetching. 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Don't use this on a G5...however, the speed boost is very significant 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * on a G4. 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define DST_CHAN_SRC 1 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define DST_CHAN_DEST 2 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* macro to set DST control word value... */ 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define DST_CTRL(size, count, stride) \ 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((size) << 24) | ((count) << 16) | (stride)) 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define VEC_ALIGNER(src) ((UNALIGNED_PTR(src)) \ 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ? vec_lvsl(0, src) \ 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall : vec_add(vec_lvsl(8, src), vec_splat_u8(8))) 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Calculate the permute vector used for 32->32 swizzling */ 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt, 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const SDL_PixelFormat *dstfmt) 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * We have to assume that the bits that aren't used by other 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * colors is alpha, and it's one complete byte, since some formats 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * leave alpha with a zero mask, but we should still swizzle the bits. 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* ARGB */ 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const static struct SDL_PixelFormat default_pixel_format = { 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NULL, 0, 0, 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, 0, 0, 0, 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 16, 8, 0, 24, 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, 0}; 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (!srcfmt) { 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt = &default_pixel_format; 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (!dstfmt) { 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstfmt = &default_pixel_format; 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const vector unsigned char plus = VECUINT8_LITERAL( 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x00, 0x00, 0x00, 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04, 0x04, 0x04, 0x04, 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08, 0x08, 0x08, 0x08, 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0C, 0x0C, 0x0C, 0x0C ); 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vswiz; 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int srcvec; 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RESHIFT(X) (3 - ((X) >> 3)) 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 amask; 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Use zero for alpha if either surface doesn't have alpha */ 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask) { 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall amask = ((srcfmt->Amask) ? RESHIFT(srcfmt->Ashift) : 0x10) << (dstfmt->Ashift); 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall amask = 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ 0xFFFFFFFF); 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef RESHIFT 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned int *)(char*)&srcvec)[0] = (rmask | gmask | bmask | amask); 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vswiz = vec_add(plus, (vector unsigned char)vec_splat(srcvec, 0)); 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return(vswiz); 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_RGB565(SDL_BlitInfo *info); 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_RGB565Altivec(SDL_BlitInfo *info) { 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = (Uint8 *) info->s_pixels; 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = (Uint8 *) info->d_pixels; 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valpha = vec_splat_u8(0); 1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL); 1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vgmerge = VECUINT8_LITERAL( 1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x02, 0x00, 0x06, 1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x0a, 0x00, 0x0e, 1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x12, 0x00, 0x16, 1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x1a, 0x00, 0x1e); 1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v1 = vec_splat_u16(1); 1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v3 = vec_splat_u16(3); 1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v3f = VECUINT16_LITERAL( 1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x003f, 0x003f, 0x003f, 0x003f, 1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x003f, 0x003f, 0x003f, 0x003f); 1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vfc = VECUINT16_LITERAL( 1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00fc, 0x00fc, 0x00fc, 0x00fc, 1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00fc, 0x00fc, 0x00fc, 0x00fc); 1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vf800 = (vector unsigned short)vec_splat_u8(-7); 1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vf800 = vec_sl(vf800, vec_splat_u16(8)); 1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner; 1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char voverflow; 1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vsrc; 1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth; 1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define ONE_PIXEL_BLEND(condition, widthvar) \ 1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (condition) { \ 1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; \ 1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB, sA; \ 1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGBA((Uint8 *)src, 4, srcfmt, Pixel, \ 1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); \ 1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(Uint16 *)(dst) = (((sR << 8) & 0x0000F800) | \ 1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG << 3) & 0x000007E0) | \ 1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB >> 3) & 0x0000001F)); \ 1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; \ 1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 4; \ 1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall widthvar--; \ 1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width); 1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* After all that work, here's the vector part! */ 2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth = (width % 8); /* trailing unaligned stores */ 2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_ld(0, src); 2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valigner = VEC_ALIGNER(src); 2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vpixel, vrpixel, vgpixel, vbpixel; 2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vsrc1, vsrc2; 2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vdst; 2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_perm(vsrc, voverflow, valigner); 2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc1 = (vector unsigned int)vec_perm(vsrc, valpha, vpermute); 2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 16; 2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = voverflow; 2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_perm(vsrc, voverflow, valigner); 2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc2 = (vector unsigned int)vec_perm(vsrc, valpha, vpermute); 2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 1555 */ 2209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vpixel = (vector unsigned short)vec_packpx(vsrc1, vsrc2); 2219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vgpixel = (vector unsigned short)vec_perm(vsrc1, vsrc2, vgmerge); 2229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vgpixel = vec_and(vgpixel, vfc); 2239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vgpixel = vec_sl(vgpixel, v3); 2249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vrpixel = vec_sl(vpixel, v1); 2259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vrpixel = vec_and(vrpixel, vf800); 2269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbpixel = vec_and(vpixel, v3f); 2279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst = vec_or((vector unsigned char)vrpixel, (vector unsigned char)vgpixel); 2289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 565 */ 2299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst = vec_or(vdst, (vector unsigned char)vbpixel); 2309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vdst, 0, dst); 2319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 8; 2339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 16; 2349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 16; 2359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = voverflow; 2369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width == 0); 2399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 2419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND((extrawidth), extrawidth); 2429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef ONE_PIXEL_BLEND 2439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; /* move to next row, accounting for pitch. */ 2459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 2469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 2509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_32Altivec(SDL_BlitInfo *info) { 2529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 2539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = (Uint8 *) info->s_pixels; 2549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 2559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = (Uint8 *) info->d_pixels; 2569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 2579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 2589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 2599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned alpha; 2609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valpha; 2619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute; 2629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vf800; 2639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int v8 = vec_splat_u32(8); 2649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int v16 = vec_add(v8, v8); 2659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v2 = vec_splat_u16(2); 2669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v3 = vec_splat_u16(3); 2679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 2689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10 - 0x1f is the alpha 2699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0e evens are the red 2709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x01 - 0x0f odds are zero 2719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vredalpha1 = VECUINT8_LITERAL( 2739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x00, 0x01, 0x01, 2749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x02, 0x01, 0x01, 2759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x04, 0x01, 0x01, 2769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x06, 0x01, 0x01 2779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 2789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vredalpha2 = (vector unsigned char) ( 2799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vredalpha1, vec_sl(v8, v16)) 2809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 2819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 2829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0f is ARxx ARxx ARxx ARxx 2839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x11 - 0x0f odds are blue 2849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vblue1 = VECUINT8_LITERAL( 2869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x01, 0x02, 0x11, 2879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04, 0x05, 0x06, 0x13, 2889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08, 0x09, 0x0a, 0x15, 2899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0c, 0x0d, 0x0e, 0x17 2909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 2919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vblue2 = (vector unsigned char)( 2929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vblue1, v8) 2939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 2949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 2959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0f is ARxB ARxB ARxB ARxB 2969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10 - 0x0e evens are green 2979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vgreen1 = VECUINT8_LITERAL( 2999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x01, 0x10, 0x03, 3009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04, 0x05, 0x12, 0x07, 3019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08, 0x09, 0x14, 0x0b, 3029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0c, 0x0d, 0x16, 0x0f 3039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 3049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vgreen2 = (vector unsigned char)( 3059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)) 3069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 3079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(srcfmt->BytesPerPixel == 2); 3109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(dstfmt->BytesPerPixel == 4); 3119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vf800 = (vector unsigned short)vec_splat_u8(-7); 3139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vf800 = vec_sl(vf800, vec_splat_u16(8)); 3149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask && srcfmt->alpha) { 3169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned char *)&valpha)[0] = alpha = srcfmt->alpha; 3179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = vec_splat(valpha, 0); 3189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 3199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall alpha = 0; 3209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = vec_splat_u8(0); 3219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 3229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vpermute = calc_swizzle32(NULL, dstfmt); 3249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 3259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner; 3269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char voverflow; 3279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vsrc; 3289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 3309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth; 3319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 3339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define ONE_PIXEL_BLEND(condition, widthvar) \ 3349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (condition) { \ 3359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB; \ 3369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned short Pixel = *((unsigned short *)src); \ 3379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR = (Pixel >> 8) & 0xf8; \ 3389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sG = (Pixel >> 3) & 0xfc; \ 3399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sB = (Pixel << 3) & 0xf8; \ 3409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \ 3419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; \ 3429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 4; \ 3439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall widthvar--; \ 3449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 3459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width); 3469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* After all that work, here's the vector part! */ 3489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth = (width % 8); /* trailing unaligned stores */ 3499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 3509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_ld(0, src); 3519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valigner = VEC_ALIGNER(src); 3529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 3549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vR, vG, vB; 3559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vdst1, vdst2; 3569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 3589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_perm(vsrc, voverflow, valigner); 3599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vR = vec_and((vector unsigned short)vsrc, vf800); 3619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vB = vec_sl((vector unsigned short)vsrc, v3); 3629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vG = vec_sl(vB, v2); 3639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = (vector unsigned char)vec_perm((vector unsigned char)vR, valpha, vredalpha1); 3659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, (vector unsigned char)vB, vblue1); 3669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, (vector unsigned char)vG, vgreen1); 3679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, valpha, vpermute); 3689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vdst1, 0, dst); 3699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = (vector unsigned char)vec_perm((vector unsigned char)vR, valpha, vredalpha2); 3719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, (vector unsigned char)vB, vblue2); 3729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, (vector unsigned char)vG, vgreen2); 3739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, valpha, vpermute); 3749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vdst2, 16, dst); 3759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 8; 3779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 32; 3789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 16; 3799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = voverflow; 3809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 3819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width == 0); 3839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 3869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND((extrawidth), extrawidth); 3879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef ONE_PIXEL_BLEND 3889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; /* move to next row, accounting for pitch. */ 3909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 3919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 3929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 3949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB555_32Altivec(SDL_BlitInfo *info) { 3979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 3989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = (Uint8 *) info->s_pixels; 3999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 4009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = (Uint8 *) info->d_pixels; 4019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 4029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 4039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 4049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned alpha; 4059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valpha; 4069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute; 4079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vf800; 4089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int v8 = vec_splat_u32(8); 4099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int v16 = vec_add(v8, v8); 4109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v1 = vec_splat_u16(1); 4119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short v3 = vec_splat_u16(3); 4129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 4139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10 - 0x1f is the alpha 4149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0e evens are the red 4159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x01 - 0x0f odds are zero 4169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vredalpha1 = VECUINT8_LITERAL( 4189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x00, 0x01, 0x01, 4199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x02, 0x01, 0x01, 4209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x04, 0x01, 0x01, 4219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10, 0x06, 0x01, 0x01 4229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vredalpha2 = (vector unsigned char)( 4249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vredalpha1, vec_sl(v8, v16)) 4259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 4279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0f is ARxx ARxx ARxx ARxx 4289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x11 - 0x0f odds are blue 4299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vblue1 = VECUINT8_LITERAL( 4319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x01, 0x02, 0x11, 4329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04, 0x05, 0x06, 0x13, 4339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08, 0x09, 0x0a, 0x15, 4349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0c, 0x0d, 0x0e, 0x17 4359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vblue2 = (vector unsigned char)( 4379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vblue1, v8) 4389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 4409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00 - 0x0f is ARxB ARxB ARxB ARxB 4419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10 - 0x0e evens are green 4429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vgreen1 = VECUINT8_LITERAL( 4449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00, 0x01, 0x10, 0x03, 4459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x04, 0x05, 0x12, 0x07, 4469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x08, 0x09, 0x14, 0x0b, 4479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0c, 0x0d, 0x16, 0x0f 4489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vgreen2 = (vector unsigned char)( 4509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)) 4519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 4529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(srcfmt->BytesPerPixel == 2); 4559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(dstfmt->BytesPerPixel == 4); 4569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vf800 = (vector unsigned short)vec_splat_u8(-7); 4589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vf800 = vec_sl(vf800, vec_splat_u16(8)); 4599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask && srcfmt->alpha) { 4619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned char *)&valpha)[0] = alpha = srcfmt->alpha; 4629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = vec_splat(valpha, 0); 4639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 4649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall alpha = 0; 4659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = vec_splat_u8(0); 4669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 4679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vpermute = calc_swizzle32(NULL, dstfmt); 4699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 4709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner; 4719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char voverflow; 4729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vsrc; 4739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 4759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth; 4769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 4789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define ONE_PIXEL_BLEND(condition, widthvar) \ 4799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (condition) { \ 4809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB; \ 4819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned short Pixel = *((unsigned short *)src); \ 4829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR = (Pixel >> 7) & 0xf8; \ 4839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sG = (Pixel >> 2) & 0xf8; \ 4849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sB = (Pixel << 3) & 0xf8; \ 4859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \ 4869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; \ 4879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 4; \ 4889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall widthvar--; \ 4899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 4909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width); 4919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* After all that work, here's the vector part! */ 4939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth = (width % 8); /* trailing unaligned stores */ 4949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 4959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_ld(0, src); 4969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valigner = VEC_ALIGNER(src); 4979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 4999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned short vR, vG, vB; 5009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vdst1, vdst2; 5019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 5039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = vec_perm(vsrc, voverflow, valigner); 5049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vR = vec_and(vec_sl((vector unsigned short)vsrc,v1), vf800); 5069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vB = vec_sl((vector unsigned short)vsrc, v3); 5079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vG = vec_sl(vB, v3); 5089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = (vector unsigned char)vec_perm((vector unsigned char)vR, valpha, vredalpha1); 5109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, (vector unsigned char)vB, vblue1); 5119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, (vector unsigned char)vG, vgreen1); 5129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst1 = vec_perm(vdst1, valpha, vpermute); 5139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vdst1, 0, dst); 5149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = (vector unsigned char)vec_perm((vector unsigned char)vR, valpha, vredalpha2); 5169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, (vector unsigned char)vB, vblue2); 5179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, (vector unsigned char)vG, vgreen2); 5189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vdst2 = vec_perm(vdst2, valpha, vpermute); 5199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vdst2, 16, dst); 5209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 8; 5229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 32; 5239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 16; 5249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsrc = voverflow; 5259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 5269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width == 0); 5289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 5319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND((extrawidth), extrawidth); 5329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef ONE_PIXEL_BLEND 5339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; /* move to next row, accounting for pitch. */ 5359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 5369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 5379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 5399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoNKey(SDL_BlitInfo *info); 5419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info); 5429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit32to32KeyAltivec(SDL_BlitInfo *info) 5439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 5449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 5459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *srcp = (Uint32 *) info->s_pixels; 5469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 5479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *dstp = (Uint32 *) info->d_pixels; 5489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 5499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 5509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp = srcfmt->BytesPerPixel; 5519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 5529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstbpp = dstfmt->BytesPerPixel; 5539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int copy_alpha = (srcfmt->Amask && dstfmt->Amask); 5549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0; 5559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; 5569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 ckey = info->src->colorkey; 5579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int valpha; 5589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute; 5599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vzero; 5609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vckey; 5619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vrgbmask; 5629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vpermute = calc_swizzle32(srcfmt, dstfmt); 5639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (info->d_width < 16) { 5649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(copy_alpha) { 5659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BlitNtoNKeyCopyAlpha(info); 5669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 5679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BlitNtoNKey(info); 5689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 5699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return; 5709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 5719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vzero = vec_splat_u8(0); 5729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (alpha) { 5739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned char *)&valpha)[0] = (unsigned char)alpha; 5749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = (vector unsigned int)vec_splat((vector unsigned char)valpha, 0); 5759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 5769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valpha = (vector unsigned int)vzero; 5779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 5789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ckey &= rgbmask; 5799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned int *)(char*)&vckey)[0] = ckey; 5809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vckey = vec_splat(vckey, 0); 5819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned int *)(char*)&vrgbmask)[0] = rgbmask; 5829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vrgbmask = vec_splat(vrgbmask, 0); 5839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 5859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define ONE_PIXEL_BLEND(condition, widthvar) \ 5869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (copy_alpha) { \ 5879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (condition) { \ 5889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; \ 5899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB, sA; \ 5909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGBA((Uint8 *)srcp, srcbpp, srcfmt, Pixel, \ 5919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); \ 5929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (Pixel & rgbmask) != ckey ) { \ 5939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \ 5949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); \ 5959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } \ 5969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp = (Uint32 *) (((Uint8 *) dstp) + dstbpp); \ 5979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp = (Uint32 *) (((Uint8 *) srcp) + srcbpp); \ 5989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall widthvar--; \ 5999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } \ 6009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { \ 6019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (condition) { \ 6029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; \ 6039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB; \ 6049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RETRIEVE_RGB_PIXEL((Uint8 *)srcp, srcbpp, Pixel); \ 6059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( Pixel != ckey ) { \ 6069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \ 6079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \ 6089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, alpha); \ 6099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } \ 6109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \ 6119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \ 6129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall widthvar--; \ 6139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } \ 6149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 6169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width); 6179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width > 0); 6189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (width > 0) { 6199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth = (width % 4); 6209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner = VEC_ALIGNER(srcp); 6219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vs = vec_ld(0, srcp); 6229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 6239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width >= 4); 6249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 6259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vsel; 6269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vd; 6279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int voverflow = vec_ld(15, srcp); 6289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* load the source vec */ 6299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vs = vec_perm(vs, voverflow, valigner); 6309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* vsel is set for items that match the key */ 6319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsel = (vector unsigned char)vec_and(vs, vrgbmask); 6329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vsel = (vector unsigned char)vec_cmpeq(vs, vckey); 6339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* permute the src vec to the dest format */ 6349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vs = vec_perm(vs, valpha, vpermute); 6359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* load the destination vec */ 6369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vd = vec_ld(0, dstp); 6379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* select the source and dest into vs */ 6389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vd = (vector unsigned int)vec_sel((vector unsigned char)vs, (vector unsigned char)vd, vsel); 6399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vd, 0, dstp); 6419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp += 4; 6429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 4; 6439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp += 4; 6449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vs = voverflow; 6459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ONE_PIXEL_BLEND((extrawidth), extrawidth); 6479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef ONE_PIXEL_BLEND 6489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp += srcskip >> 2; 6499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp += dstskip >> 2; 6509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 6539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */ 6559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Use this on a G5 */ 6569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void ConvertAltivec32to32_noprefetch(SDL_BlitInfo *info) 6579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 6589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 6599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src = (Uint32 *) info->s_pixels; 6609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 6619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *dst = (Uint32 *) info->d_pixels; 6629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 6639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 6649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 6659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vzero = vec_splat_u32(0); 6669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt); 6679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask && !srcfmt->Amask) { 6689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (srcfmt->alpha) { 6699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valpha; 6709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned char *)&valpha)[0] = srcfmt->alpha; 6719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vzero = (vector unsigned int)vec_splat(valpha, 0); 6729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(srcfmt->BytesPerPixel == 4); 6769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(dstfmt->BytesPerPixel == 4); 6779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 6799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner; 6809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vbits; 6819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int voverflow; 6829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 bits; 6839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 r, g, b, a; 6849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 6869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth; 6879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 6899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ((UNALIGNED_PTR(dst)) && (width)) { 6909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall bits = *(src++); 6919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGBA_FROM_8888(bits, srcfmt, r, g, b, a); 6929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(dst++) = MAKE8888(dstfmt, r, g, b, a); 6939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width--; 6949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 6959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* After all that work, here's the vector part! */ 6979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth = (width % 4); 6989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 6999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valigner = VEC_ALIGNER(src); 7009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_ld(0, src); 7019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 7039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 7049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 4; 7059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 4; 7069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_perm(vbits, voverflow, valigner); /* src is ready. */ 7079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_perm(vbits, vzero, vpermute); /* swizzle it. */ 7089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vbits, 0, dst); /* store it back out. */ 7099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 4; 7109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = voverflow; 7119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width == 0); 7149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* cover pixels at the end of the row that didn't fit in 16 bytes. */ 7169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (extrawidth) { 7179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall bits = *(src++); /* max 7 pixels, don't bother with prefetch. */ 7189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGBA_FROM_8888(bits, srcfmt, r, g, b, a); 7199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(dst++) = MAKE8888(dstfmt, r, g, b, a); 7209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth--; 7219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip >> 2; /* move to next row, accounting for pitch. */ 7249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip >> 2; 7259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 7289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */ 7309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Use this on a G4 */ 7319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void ConvertAltivec32to32_prefetch(SDL_BlitInfo *info) 7329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 7339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const int scalar_dst_lead = sizeof (Uint32) * 4; 7349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const int vector_dst_lead = sizeof (Uint32) * 16; 7359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 7379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src = (Uint32 *) info->s_pixels; 7389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 7399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *dst = (Uint32 *) info->d_pixels; 7409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 7419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 7429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 7439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vzero = vec_splat_u32(0); 7449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt); 7459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask && !srcfmt->Amask) { 7469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (srcfmt->alpha) { 7479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valpha; 7489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((unsigned char *)&valpha)[0] = srcfmt->alpha; 7499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vzero = (vector unsigned int)vec_splat(valpha, 0); 7509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(srcfmt->BytesPerPixel == 4); 7549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(dstfmt->BytesPerPixel == 4); 7559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (height--) { 7579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned char valigner; 7589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int vbits; 7599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vector unsigned int voverflow; 7609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 bits; 7619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 r, g, b, a; 7629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 7649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int extrawidth; 7659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* do scalar until we can align... */ 7679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ((UNALIGNED_PTR(dst)) && (width)) { 7689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dstt(src+scalar_dst_lead, DST_CTRL(2,32,1024), DST_CHAN_SRC); 7699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dstst(dst+scalar_dst_lead, DST_CTRL(2,32,1024), DST_CHAN_DEST); 7709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall bits = *(src++); 7719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGBA_FROM_8888(bits, srcfmt, r, g, b, a); 7729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(dst++) = MAKE8888(dstfmt, r, g, b, a); 7739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width--; 7749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* After all that work, here's the vector part! */ 7779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth = (width % 4); 7789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= extrawidth; 7799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall valigner = VEC_ALIGNER(src); 7809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_ld(0, src); 7819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (width) { 7839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dstt(src+vector_dst_lead, DST_CTRL(2,32,1024), DST_CHAN_SRC); 7849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dstst(dst+vector_dst_lead, DST_CTRL(2,32,1024), DST_CHAN_DEST); 7859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall voverflow = vec_ld(15, src); 7869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 4; 7879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width -= 4; 7889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_perm(vbits, voverflow, valigner); /* src is ready. */ 7899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = vec_perm(vbits, vzero, vpermute); /* swizzle it. */ 7909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_st(vbits, 0, dst); /* store it back out. */ 7919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 4; 7929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vbits = voverflow; 7939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 7949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall assert(width == 0); 7969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* cover pixels at the end of the row that didn't fit in 16 bytes. */ 7989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while (extrawidth) { 7999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall bits = *(src++); /* max 7 pixels, don't bother with prefetch. */ 8009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGBA_FROM_8888(bits, srcfmt, r, g, b, a); 8019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(dst++) = MAKE8888(dstfmt, r, g, b, a); 8029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall extrawidth--; 8039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 8049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip >> 2; /* move to next row, accounting for pitch. */ 8069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip >> 2; 8079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 8089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dss(DST_CHAN_SRC); 8109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall vec_dss(DST_CHAN_DEST); 8119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 8129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic Uint32 GetBlitFeatures( void ) 8149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 8159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall static Uint32 features = 0xffffffff; 8169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (features == 0xffffffff) { 8179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Provide an override for testing .. */ 8189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall char *override = SDL_getenv("SDL_ALTIVEC_BLIT_FEATURES"); 8199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (override) { 8209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall features = 0; 8219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_sscanf(override, "%u", &features); 8229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 8239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall features = ( 0 8249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Feature 1 is has-MMX */ 8259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall | ((SDL_HasMMX()) ? 1 : 0) 8269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Feature 2 is has-AltiVec */ 8279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall | ((SDL_HasAltiVec()) ? 2 : 0) 8289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Feature 4 is dont-use-prefetch */ 8299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */ 8309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall | ((GetL3CacheSize() == 0) ? 4 : 0) 8319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ); 8329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 8339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 8349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return features; 8359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 8369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if __MWERKS__ 8379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#pragma altivec_model off 8389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 8399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 8409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Feature 1 is has-MMX */ 8419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define GetBlitFeatures() ((Uint32)(SDL_HasMMX() ? 1 : 0)) 8429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 8439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* This is now endian dependent */ 8459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_BYTEORDER == SDL_LIL_ENDIAN 8469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define HI 1 8479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define LO 0 8489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else /* SDL_BYTEORDER == SDL_BIG_ENDIAN */ 8499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define HI 0 8509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define LO 1 8519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 8529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_HERMES_BLITTERS 8549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Heheheh, we coerce Hermes into using SDL blit information */ 8569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define X86_ASSEMBLER 8579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define HermesConverterInterface SDL_BlitInfo 8589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define HermesClearInterface void 8599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define STACKCALL 8609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../hermes/HeadMMX.h" 8629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../hermes/HeadX86.h" 8639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 8659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */ 8679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB332(dst, src) { \ 8689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint8)((((src)&0x00E00000)>>16)| \ 8699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src)&0x0000E000)>>11)| \ 8709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src)&0x000000C0)>>6)); \ 8719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 8729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_index8(SDL_BlitInfo *info) 8739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 8749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 8759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 8769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 8779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 8789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src; 8799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 *map; 8809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst; 8819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 8829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 8849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 8859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 8869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32 *)info->s_pixels; 8879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip/4; 8889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = info->d_pixels; 8899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip; 8909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall map = info->table; 8919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( map == NULL ) { 8939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 8949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 8959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 8969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 8979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 8989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 8999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 9009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 9019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch ( width & 3 ) { 9109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 9119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 9149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 9179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(*dst++, *src); 9189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 9219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 9229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 9239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 9259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int Pixel; 9269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 9289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 9299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 9309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 9349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 9359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 9369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 9379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch ( width & 3 ) { 9519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 9529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 9569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 9609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 9619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 9629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 9639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 9659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 9669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 9679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 9699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 9709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */ 9719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB555(dst, src) { \ 9729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \ 9739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((*src)&0x0000F800)>>6)| \ 9749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((*src)&0x000000F8)>>3)); \ 9759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 9769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB555_TWO(dst, src) { \ 9779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ 9789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[HI])&0x0000F800)>>6)| \ 9799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[HI])&0x000000F8)>>3))<<16)| \ 9809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x00F80000)>>9)| \ 9819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x0000F800)>>6)| \ 9829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x000000F8)>>3); \ 9839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 9849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_RGB555(SDL_BlitInfo *info) 9859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 9869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 9879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 9889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 9899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 9909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src; 9919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 *dst; 9929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 9939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 9959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 9969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 9979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32 *)info->s_pixels; 9989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip/4; 9999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint16 *)info->d_pixels; 10009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip/2; 10019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 10029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 10039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 10049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 10059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 10099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 10109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 10119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 10139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Memory align at 4-byte boundary, if necessary */ 10149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (long)dst & 0x03 ) { 10159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Don't do anything if width is 0 */ 10169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( width == 0 ) { 10179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return; 10189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall --width; 10209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 10219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 10229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Perform copy alignment */ 10239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 10279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Copy in 4 pixel chunks */ 10289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 10299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Get any leftovers */ 10379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch (width & 3) { 10389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 10399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 10439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 10479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 10489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 10529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 10549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 10559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 10579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 10589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Copy in 4 pixel chunks */ 10599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 10609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Get any leftovers */ 10689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch (width & 3) { 10699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 10709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 10749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555_TWO(dst, src); 10759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 10769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 10779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 10789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 10799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB555(dst, src); 10809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 10819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 10829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 10839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 10859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 10869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 10889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 10899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 10909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */ 10919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB565(dst, src) { \ 10929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \ 10939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((*src)&0x0000FC00)>>5)| \ 10949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((*src)&0x000000F8)>>3)); \ 10959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 10969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB565_TWO(dst, src) { \ 10979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ 10989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[HI])&0x0000FC00)>>5)| \ 10999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[HI])&0x000000F8)>>3))<<16)| \ 11009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x00F80000)>>8)| \ 11019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x0000FC00)>>5)| \ 11029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src[LO])&0x000000F8)>>3); \ 11039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 11049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_RGB565(SDL_BlitInfo *info) 11059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 11069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 11079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 11089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 11099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 11109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src; 11119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 *dst; 11129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 11139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 11149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 11159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 11169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 11179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32 *)info->s_pixels; 11189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip/4; 11199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint16 *)info->d_pixels; 11209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip/2; 11219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 11229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 11239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 11249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 11259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 11269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 11279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 11289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 11299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 11309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 11319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 11339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Memory align at 4-byte boundary, if necessary */ 11349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (long)dst & 0x03 ) { 11359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Don't do anything if width is 0 */ 11369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( width == 0 ) { 11379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return; 11389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall --width; 11409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 11419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 11429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Perform copy alignment */ 11439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 11449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 11459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 11469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 11479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Copy in 4 pixel chunks */ 11489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 11499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Get any leftovers */ 11579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch (width & 3) { 11589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 11599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 11609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 11619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 11629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 11639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 11679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 11689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 11699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 11709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 11719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 11729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 11749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 11759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 11779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 11789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Copy in 4 pixel chunks */ 11799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 11809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 11879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Get any leftovers */ 11889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch (width & 3) { 11899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 11909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 11919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 11929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 11939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 11949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565_TWO(dst, src); 11959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 11969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += 2; 11979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 11989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 11999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB565(dst, src); 12009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 12019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 12029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 12039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 12059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 12069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 12099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 12109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* SDL_HERMES_BLITTERS */ 12129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 5-6-5 --> 32-bit RGB surfaces */ 12159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB565_32(dst, src, map) (map[src[LO]*2] + map[src[HI]*2+1]) 12169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map) 12179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 12189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 12199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 12209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 12219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 12229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src; 12239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *dst; 12249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 12259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 12279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 12289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 12299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint8 *)info->s_pixels; 12309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip; 12319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint32 *)info->d_pixels; 12329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip/4; 12339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 12359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 12369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 12379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 12389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 12419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 12429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 12439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 12449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 12469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 12479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Copy in 4 pixel chunks */ 12489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 12499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Get any leftovers */ 12599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch (width & 3) { 12609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 12619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 12649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 12679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = RGB565_32(dst, src, map); 12689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += 2; 12699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 12709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 12729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 12739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 12749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 12759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 12769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 12779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 5-6-5 --> ARGB 8-8-8-8 */ 12789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const Uint32 RGB565_ARGB8888_LUT[512] = { 12799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000000, 0xff000000, 0x00000008, 0xff002000, 12809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000010, 0xff004000, 0x00000018, 0xff006100, 12819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000020, 0xff008100, 0x00000029, 0xff00a100, 12829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000031, 0xff00c200, 0x00000039, 0xff00e200, 12839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000041, 0xff080000, 0x0000004a, 0xff082000, 12849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000052, 0xff084000, 0x0000005a, 0xff086100, 12859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000062, 0xff088100, 0x0000006a, 0xff08a100, 12869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000073, 0xff08c200, 0x0000007b, 0xff08e200, 12879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000083, 0xff100000, 0x0000008b, 0xff102000, 12889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000094, 0xff104000, 0x0000009c, 0xff106100, 12899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000a4, 0xff108100, 0x000000ac, 0xff10a100, 12909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000b4, 0xff10c200, 0x000000bd, 0xff10e200, 12919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000c5, 0xff180000, 0x000000cd, 0xff182000, 12929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000d5, 0xff184000, 0x000000de, 0xff186100, 12939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000e6, 0xff188100, 0x000000ee, 0xff18a100, 12949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000f6, 0xff18c200, 0x000000ff, 0xff18e200, 12959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000400, 0xff200000, 0x00000408, 0xff202000, 12969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000410, 0xff204000, 0x00000418, 0xff206100, 12979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000420, 0xff208100, 0x00000429, 0xff20a100, 12989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000431, 0xff20c200, 0x00000439, 0xff20e200, 12999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000441, 0xff290000, 0x0000044a, 0xff292000, 13009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000452, 0xff294000, 0x0000045a, 0xff296100, 13019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000462, 0xff298100, 0x0000046a, 0xff29a100, 13029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000473, 0xff29c200, 0x0000047b, 0xff29e200, 13039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000483, 0xff310000, 0x0000048b, 0xff312000, 13049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000494, 0xff314000, 0x0000049c, 0xff316100, 13059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004a4, 0xff318100, 0x000004ac, 0xff31a100, 13069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004b4, 0xff31c200, 0x000004bd, 0xff31e200, 13079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004c5, 0xff390000, 0x000004cd, 0xff392000, 13089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004d5, 0xff394000, 0x000004de, 0xff396100, 13099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004e6, 0xff398100, 0x000004ee, 0xff39a100, 13109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000004f6, 0xff39c200, 0x000004ff, 0xff39e200, 13119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000800, 0xff410000, 0x00000808, 0xff412000, 13129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000810, 0xff414000, 0x00000818, 0xff416100, 13139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000820, 0xff418100, 0x00000829, 0xff41a100, 13149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000831, 0xff41c200, 0x00000839, 0xff41e200, 13159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000841, 0xff4a0000, 0x0000084a, 0xff4a2000, 13169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000852, 0xff4a4000, 0x0000085a, 0xff4a6100, 13179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000862, 0xff4a8100, 0x0000086a, 0xff4aa100, 13189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000873, 0xff4ac200, 0x0000087b, 0xff4ae200, 13199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000883, 0xff520000, 0x0000088b, 0xff522000, 13209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000894, 0xff524000, 0x0000089c, 0xff526100, 13219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008a4, 0xff528100, 0x000008ac, 0xff52a100, 13229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008b4, 0xff52c200, 0x000008bd, 0xff52e200, 13239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008c5, 0xff5a0000, 0x000008cd, 0xff5a2000, 13249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008d5, 0xff5a4000, 0x000008de, 0xff5a6100, 13259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008e6, 0xff5a8100, 0x000008ee, 0xff5aa100, 13269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000008f6, 0xff5ac200, 0x000008ff, 0xff5ae200, 13279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c00, 0xff620000, 0x00000c08, 0xff622000, 13289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c10, 0xff624000, 0x00000c18, 0xff626100, 13299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c20, 0xff628100, 0x00000c29, 0xff62a100, 13309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c31, 0xff62c200, 0x00000c39, 0xff62e200, 13319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c41, 0xff6a0000, 0x00000c4a, 0xff6a2000, 13329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c52, 0xff6a4000, 0x00000c5a, 0xff6a6100, 13339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c62, 0xff6a8100, 0x00000c6a, 0xff6aa100, 13349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c73, 0xff6ac200, 0x00000c7b, 0xff6ae200, 13359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c83, 0xff730000, 0x00000c8b, 0xff732000, 13369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000c94, 0xff734000, 0x00000c9c, 0xff736100, 13379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000ca4, 0xff738100, 0x00000cac, 0xff73a100, 13389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000cb4, 0xff73c200, 0x00000cbd, 0xff73e200, 13399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000cc5, 0xff7b0000, 0x00000ccd, 0xff7b2000, 13409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000cd5, 0xff7b4000, 0x00000cde, 0xff7b6100, 13419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000ce6, 0xff7b8100, 0x00000cee, 0xff7ba100, 13429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000cf6, 0xff7bc200, 0x00000cff, 0xff7be200, 13439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001000, 0xff830000, 0x00001008, 0xff832000, 13449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001010, 0xff834000, 0x00001018, 0xff836100, 13459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001020, 0xff838100, 0x00001029, 0xff83a100, 13469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001031, 0xff83c200, 0x00001039, 0xff83e200, 13479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001041, 0xff8b0000, 0x0000104a, 0xff8b2000, 13489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001052, 0xff8b4000, 0x0000105a, 0xff8b6100, 13499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001062, 0xff8b8100, 0x0000106a, 0xff8ba100, 13509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001073, 0xff8bc200, 0x0000107b, 0xff8be200, 13519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001083, 0xff940000, 0x0000108b, 0xff942000, 13529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001094, 0xff944000, 0x0000109c, 0xff946100, 13539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010a4, 0xff948100, 0x000010ac, 0xff94a100, 13549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010b4, 0xff94c200, 0x000010bd, 0xff94e200, 13559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010c5, 0xff9c0000, 0x000010cd, 0xff9c2000, 13569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010d5, 0xff9c4000, 0x000010de, 0xff9c6100, 13579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010e6, 0xff9c8100, 0x000010ee, 0xff9ca100, 13589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010f6, 0xff9cc200, 0x000010ff, 0xff9ce200, 13599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001400, 0xffa40000, 0x00001408, 0xffa42000, 13609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001410, 0xffa44000, 0x00001418, 0xffa46100, 13619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001420, 0xffa48100, 0x00001429, 0xffa4a100, 13629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001431, 0xffa4c200, 0x00001439, 0xffa4e200, 13639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001441, 0xffac0000, 0x0000144a, 0xffac2000, 13649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001452, 0xffac4000, 0x0000145a, 0xffac6100, 13659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001462, 0xffac8100, 0x0000146a, 0xffaca100, 13669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001473, 0xffacc200, 0x0000147b, 0xfface200, 13679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001483, 0xffb40000, 0x0000148b, 0xffb42000, 13689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001494, 0xffb44000, 0x0000149c, 0xffb46100, 13699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014a4, 0xffb48100, 0x000014ac, 0xffb4a100, 13709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014b4, 0xffb4c200, 0x000014bd, 0xffb4e200, 13719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014c5, 0xffbd0000, 0x000014cd, 0xffbd2000, 13729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014d5, 0xffbd4000, 0x000014de, 0xffbd6100, 13739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014e6, 0xffbd8100, 0x000014ee, 0xffbda100, 13749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000014f6, 0xffbdc200, 0x000014ff, 0xffbde200, 13759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001800, 0xffc50000, 0x00001808, 0xffc52000, 13769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001810, 0xffc54000, 0x00001818, 0xffc56100, 13779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001820, 0xffc58100, 0x00001829, 0xffc5a100, 13789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001831, 0xffc5c200, 0x00001839, 0xffc5e200, 13799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001841, 0xffcd0000, 0x0000184a, 0xffcd2000, 13809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001852, 0xffcd4000, 0x0000185a, 0xffcd6100, 13819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001862, 0xffcd8100, 0x0000186a, 0xffcda100, 13829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001873, 0xffcdc200, 0x0000187b, 0xffcde200, 13839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001883, 0xffd50000, 0x0000188b, 0xffd52000, 13849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001894, 0xffd54000, 0x0000189c, 0xffd56100, 13859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018a4, 0xffd58100, 0x000018ac, 0xffd5a100, 13869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018b4, 0xffd5c200, 0x000018bd, 0xffd5e200, 13879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018c5, 0xffde0000, 0x000018cd, 0xffde2000, 13889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018d5, 0xffde4000, 0x000018de, 0xffde6100, 13899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018e6, 0xffde8100, 0x000018ee, 0xffdea100, 13909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000018f6, 0xffdec200, 0x000018ff, 0xffdee200, 13919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c00, 0xffe60000, 0x00001c08, 0xffe62000, 13929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c10, 0xffe64000, 0x00001c18, 0xffe66100, 13939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c20, 0xffe68100, 0x00001c29, 0xffe6a100, 13949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c31, 0xffe6c200, 0x00001c39, 0xffe6e200, 13959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c41, 0xffee0000, 0x00001c4a, 0xffee2000, 13969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c52, 0xffee4000, 0x00001c5a, 0xffee6100, 13979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c62, 0xffee8100, 0x00001c6a, 0xffeea100, 13989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c73, 0xffeec200, 0x00001c7b, 0xffeee200, 13999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c83, 0xfff60000, 0x00001c8b, 0xfff62000, 14009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001c94, 0xfff64000, 0x00001c9c, 0xfff66100, 14019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001ca4, 0xfff68100, 0x00001cac, 0xfff6a100, 14029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001cb4, 0xfff6c200, 0x00001cbd, 0xfff6e200, 14039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001cc5, 0xffff0000, 0x00001ccd, 0xffff2000, 14049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001cd5, 0xffff4000, 0x00001cde, 0xffff6100, 14059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100, 14069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200 14079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 14089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_ARGB8888(SDL_BlitInfo *info) 14099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 14109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Blit_RGB565_32(info, RGB565_ARGB8888_LUT); 14119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 14129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 14139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 5-6-5 --> ABGR 8-8-8-8 */ 14149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const Uint32 RGB565_ABGR8888_LUT[512] = { 14159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff000000, 0x00000000, 0xff080000, 0x00002000, 14169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff100000, 0x00004000, 0xff180000, 0x00006100, 14179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff200000, 0x00008100, 0xff290000, 0x0000a100, 14189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff310000, 0x0000c200, 0xff390000, 0x0000e200, 14199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff410000, 0x00000008, 0xff4a0000, 0x00002008, 14209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff520000, 0x00004008, 0xff5a0000, 0x00006108, 14219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff620000, 0x00008108, 0xff6a0000, 0x0000a108, 14229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff730000, 0x0000c208, 0xff7b0000, 0x0000e208, 14239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff830000, 0x00000010, 0xff8b0000, 0x00002010, 14249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff940000, 0x00004010, 0xff9c0000, 0x00006110, 14259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa40000, 0x00008110, 0xffac0000, 0x0000a110, 14269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb40000, 0x0000c210, 0xffbd0000, 0x0000e210, 14279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc50000, 0x00000018, 0xffcd0000, 0x00002018, 14289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd50000, 0x00004018, 0xffde0000, 0x00006118, 14299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe60000, 0x00008118, 0xffee0000, 0x0000a118, 14309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff60000, 0x0000c218, 0xffff0000, 0x0000e218, 14319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff000400, 0x00000020, 0xff080400, 0x00002020, 14329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff100400, 0x00004020, 0xff180400, 0x00006120, 14339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff200400, 0x00008120, 0xff290400, 0x0000a120, 14349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff310400, 0x0000c220, 0xff390400, 0x0000e220, 14359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff410400, 0x00000029, 0xff4a0400, 0x00002029, 14369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff520400, 0x00004029, 0xff5a0400, 0x00006129, 14379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff620400, 0x00008129, 0xff6a0400, 0x0000a129, 14389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff730400, 0x0000c229, 0xff7b0400, 0x0000e229, 14399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff830400, 0x00000031, 0xff8b0400, 0x00002031, 14409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff940400, 0x00004031, 0xff9c0400, 0x00006131, 14419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa40400, 0x00008131, 0xffac0400, 0x0000a131, 14429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb40400, 0x0000c231, 0xffbd0400, 0x0000e231, 14439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc50400, 0x00000039, 0xffcd0400, 0x00002039, 14449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd50400, 0x00004039, 0xffde0400, 0x00006139, 14459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe60400, 0x00008139, 0xffee0400, 0x0000a139, 14469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff60400, 0x0000c239, 0xffff0400, 0x0000e239, 14479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff000800, 0x00000041, 0xff080800, 0x00002041, 14489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff100800, 0x00004041, 0xff180800, 0x00006141, 14499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff200800, 0x00008141, 0xff290800, 0x0000a141, 14509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff310800, 0x0000c241, 0xff390800, 0x0000e241, 14519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff410800, 0x0000004a, 0xff4a0800, 0x0000204a, 14529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff520800, 0x0000404a, 0xff5a0800, 0x0000614a, 14539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff620800, 0x0000814a, 0xff6a0800, 0x0000a14a, 14549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff730800, 0x0000c24a, 0xff7b0800, 0x0000e24a, 14559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff830800, 0x00000052, 0xff8b0800, 0x00002052, 14569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff940800, 0x00004052, 0xff9c0800, 0x00006152, 14579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa40800, 0x00008152, 0xffac0800, 0x0000a152, 14589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb40800, 0x0000c252, 0xffbd0800, 0x0000e252, 14599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc50800, 0x0000005a, 0xffcd0800, 0x0000205a, 14609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd50800, 0x0000405a, 0xffde0800, 0x0000615a, 14619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe60800, 0x0000815a, 0xffee0800, 0x0000a15a, 14629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff60800, 0x0000c25a, 0xffff0800, 0x0000e25a, 14639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff000c00, 0x00000062, 0xff080c00, 0x00002062, 14649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff100c00, 0x00004062, 0xff180c00, 0x00006162, 14659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff200c00, 0x00008162, 0xff290c00, 0x0000a162, 14669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff310c00, 0x0000c262, 0xff390c00, 0x0000e262, 14679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff410c00, 0x0000006a, 0xff4a0c00, 0x0000206a, 14689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff520c00, 0x0000406a, 0xff5a0c00, 0x0000616a, 14699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff620c00, 0x0000816a, 0xff6a0c00, 0x0000a16a, 14709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff730c00, 0x0000c26a, 0xff7b0c00, 0x0000e26a, 14719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff830c00, 0x00000073, 0xff8b0c00, 0x00002073, 14729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff940c00, 0x00004073, 0xff9c0c00, 0x00006173, 14739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa40c00, 0x00008173, 0xffac0c00, 0x0000a173, 14749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb40c00, 0x0000c273, 0xffbd0c00, 0x0000e273, 14759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc50c00, 0x0000007b, 0xffcd0c00, 0x0000207b, 14769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd50c00, 0x0000407b, 0xffde0c00, 0x0000617b, 14779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe60c00, 0x0000817b, 0xffee0c00, 0x0000a17b, 14789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff60c00, 0x0000c27b, 0xffff0c00, 0x0000e27b, 14799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff001000, 0x00000083, 0xff081000, 0x00002083, 14809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff101000, 0x00004083, 0xff181000, 0x00006183, 14819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff201000, 0x00008183, 0xff291000, 0x0000a183, 14829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff311000, 0x0000c283, 0xff391000, 0x0000e283, 14839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff411000, 0x0000008b, 0xff4a1000, 0x0000208b, 14849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff521000, 0x0000408b, 0xff5a1000, 0x0000618b, 14859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff621000, 0x0000818b, 0xff6a1000, 0x0000a18b, 14869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff731000, 0x0000c28b, 0xff7b1000, 0x0000e28b, 14879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff831000, 0x00000094, 0xff8b1000, 0x00002094, 14889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff941000, 0x00004094, 0xff9c1000, 0x00006194, 14899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa41000, 0x00008194, 0xffac1000, 0x0000a194, 14909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb41000, 0x0000c294, 0xffbd1000, 0x0000e294, 14919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc51000, 0x0000009c, 0xffcd1000, 0x0000209c, 14929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd51000, 0x0000409c, 0xffde1000, 0x0000619c, 14939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe61000, 0x0000819c, 0xffee1000, 0x0000a19c, 14949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff61000, 0x0000c29c, 0xffff1000, 0x0000e29c, 14959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff001400, 0x000000a4, 0xff081400, 0x000020a4, 14969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff101400, 0x000040a4, 0xff181400, 0x000061a4, 14979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff201400, 0x000081a4, 0xff291400, 0x0000a1a4, 14989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff311400, 0x0000c2a4, 0xff391400, 0x0000e2a4, 14999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff411400, 0x000000ac, 0xff4a1400, 0x000020ac, 15009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff521400, 0x000040ac, 0xff5a1400, 0x000061ac, 15019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff621400, 0x000081ac, 0xff6a1400, 0x0000a1ac, 15029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff731400, 0x0000c2ac, 0xff7b1400, 0x0000e2ac, 15039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff831400, 0x000000b4, 0xff8b1400, 0x000020b4, 15049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff941400, 0x000040b4, 0xff9c1400, 0x000061b4, 15059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa41400, 0x000081b4, 0xffac1400, 0x0000a1b4, 15069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb41400, 0x0000c2b4, 0xffbd1400, 0x0000e2b4, 15079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc51400, 0x000000bd, 0xffcd1400, 0x000020bd, 15089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd51400, 0x000040bd, 0xffde1400, 0x000061bd, 15099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe61400, 0x000081bd, 0xffee1400, 0x0000a1bd, 15109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff61400, 0x0000c2bd, 0xffff1400, 0x0000e2bd, 15119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff001800, 0x000000c5, 0xff081800, 0x000020c5, 15129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff101800, 0x000040c5, 0xff181800, 0x000061c5, 15139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff201800, 0x000081c5, 0xff291800, 0x0000a1c5, 15149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff311800, 0x0000c2c5, 0xff391800, 0x0000e2c5, 15159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff411800, 0x000000cd, 0xff4a1800, 0x000020cd, 15169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff521800, 0x000040cd, 0xff5a1800, 0x000061cd, 15179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff621800, 0x000081cd, 0xff6a1800, 0x0000a1cd, 15189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff731800, 0x0000c2cd, 0xff7b1800, 0x0000e2cd, 15199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff831800, 0x000000d5, 0xff8b1800, 0x000020d5, 15209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff941800, 0x000040d5, 0xff9c1800, 0x000061d5, 15219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa41800, 0x000081d5, 0xffac1800, 0x0000a1d5, 15229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb41800, 0x0000c2d5, 0xffbd1800, 0x0000e2d5, 15239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc51800, 0x000000de, 0xffcd1800, 0x000020de, 15249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd51800, 0x000040de, 0xffde1800, 0x000061de, 15259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe61800, 0x000081de, 0xffee1800, 0x0000a1de, 15269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff61800, 0x0000c2de, 0xffff1800, 0x0000e2de, 15279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff001c00, 0x000000e6, 0xff081c00, 0x000020e6, 15289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff101c00, 0x000040e6, 0xff181c00, 0x000061e6, 15299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff201c00, 0x000081e6, 0xff291c00, 0x0000a1e6, 15309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff311c00, 0x0000c2e6, 0xff391c00, 0x0000e2e6, 15319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff411c00, 0x000000ee, 0xff4a1c00, 0x000020ee, 15329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff521c00, 0x000040ee, 0xff5a1c00, 0x000061ee, 15339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff621c00, 0x000081ee, 0xff6a1c00, 0x0000a1ee, 15349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff731c00, 0x0000c2ee, 0xff7b1c00, 0x0000e2ee, 15359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff831c00, 0x000000f6, 0xff8b1c00, 0x000020f6, 15369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xff941c00, 0x000040f6, 0xff9c1c00, 0x000061f6, 15379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffa41c00, 0x000081f6, 0xffac1c00, 0x0000a1f6, 15389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffb41c00, 0x0000c2f6, 0xffbd1c00, 0x0000e2f6, 15399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffc51c00, 0x000000ff, 0xffcd1c00, 0x000020ff, 15409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffd51c00, 0x000040ff, 0xffde1c00, 0x000061ff, 15419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff, 15429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff 15439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 15449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_ABGR8888(SDL_BlitInfo *info) 15459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 15469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Blit_RGB565_32(info, RGB565_ABGR8888_LUT); 15479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 15489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 15499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 5-6-5 --> RGBA 8-8-8-8 */ 15509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const Uint32 RGB565_RGBA8888_LUT[512] = { 15519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000000ff, 0x00000000, 0x000008ff, 0x00200000, 15529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000010ff, 0x00400000, 0x000018ff, 0x00610000, 15539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000020ff, 0x00810000, 0x000029ff, 0x00a10000, 15549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000031ff, 0x00c20000, 0x000039ff, 0x00e20000, 15559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000041ff, 0x08000000, 0x00004aff, 0x08200000, 15569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000052ff, 0x08400000, 0x00005aff, 0x08610000, 15579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000062ff, 0x08810000, 0x00006aff, 0x08a10000, 15589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000073ff, 0x08c20000, 0x00007bff, 0x08e20000, 15599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000083ff, 0x10000000, 0x00008bff, 0x10200000, 15609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000094ff, 0x10400000, 0x00009cff, 0x10610000, 15619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000a4ff, 0x10810000, 0x0000acff, 0x10a10000, 15629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000b4ff, 0x10c20000, 0x0000bdff, 0x10e20000, 15639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000c5ff, 0x18000000, 0x0000cdff, 0x18200000, 15649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000d5ff, 0x18400000, 0x0000deff, 0x18610000, 15659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000e6ff, 0x18810000, 0x0000eeff, 0x18a10000, 15669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0000f6ff, 0x18c20000, 0x0000ffff, 0x18e20000, 15679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000400ff, 0x20000000, 0x000408ff, 0x20200000, 15689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000410ff, 0x20400000, 0x000418ff, 0x20610000, 15699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000420ff, 0x20810000, 0x000429ff, 0x20a10000, 15709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000431ff, 0x20c20000, 0x000439ff, 0x20e20000, 15719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000441ff, 0x29000000, 0x00044aff, 0x29200000, 15729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000452ff, 0x29400000, 0x00045aff, 0x29610000, 15739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000462ff, 0x29810000, 0x00046aff, 0x29a10000, 15749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000473ff, 0x29c20000, 0x00047bff, 0x29e20000, 15759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000483ff, 0x31000000, 0x00048bff, 0x31200000, 15769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000494ff, 0x31400000, 0x00049cff, 0x31610000, 15779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004a4ff, 0x31810000, 0x0004acff, 0x31a10000, 15789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004b4ff, 0x31c20000, 0x0004bdff, 0x31e20000, 15799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004c5ff, 0x39000000, 0x0004cdff, 0x39200000, 15809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004d5ff, 0x39400000, 0x0004deff, 0x39610000, 15819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004e6ff, 0x39810000, 0x0004eeff, 0x39a10000, 15829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0004f6ff, 0x39c20000, 0x0004ffff, 0x39e20000, 15839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000800ff, 0x41000000, 0x000808ff, 0x41200000, 15849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000810ff, 0x41400000, 0x000818ff, 0x41610000, 15859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000820ff, 0x41810000, 0x000829ff, 0x41a10000, 15869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000831ff, 0x41c20000, 0x000839ff, 0x41e20000, 15879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000841ff, 0x4a000000, 0x00084aff, 0x4a200000, 15889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000852ff, 0x4a400000, 0x00085aff, 0x4a610000, 15899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000862ff, 0x4a810000, 0x00086aff, 0x4aa10000, 15909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000873ff, 0x4ac20000, 0x00087bff, 0x4ae20000, 15919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000883ff, 0x52000000, 0x00088bff, 0x52200000, 15929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000894ff, 0x52400000, 0x00089cff, 0x52610000, 15939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008a4ff, 0x52810000, 0x0008acff, 0x52a10000, 15949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008b4ff, 0x52c20000, 0x0008bdff, 0x52e20000, 15959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008c5ff, 0x5a000000, 0x0008cdff, 0x5a200000, 15969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008d5ff, 0x5a400000, 0x0008deff, 0x5a610000, 15979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008e6ff, 0x5a810000, 0x0008eeff, 0x5aa10000, 15989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0008f6ff, 0x5ac20000, 0x0008ffff, 0x5ae20000, 15999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c00ff, 0x62000000, 0x000c08ff, 0x62200000, 16009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c10ff, 0x62400000, 0x000c18ff, 0x62610000, 16019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c20ff, 0x62810000, 0x000c29ff, 0x62a10000, 16029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c31ff, 0x62c20000, 0x000c39ff, 0x62e20000, 16039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c41ff, 0x6a000000, 0x000c4aff, 0x6a200000, 16049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c52ff, 0x6a400000, 0x000c5aff, 0x6a610000, 16059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c62ff, 0x6a810000, 0x000c6aff, 0x6aa10000, 16069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c73ff, 0x6ac20000, 0x000c7bff, 0x6ae20000, 16079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c83ff, 0x73000000, 0x000c8bff, 0x73200000, 16089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c94ff, 0x73400000, 0x000c9cff, 0x73610000, 16099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000ca4ff, 0x73810000, 0x000cacff, 0x73a10000, 16109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000cb4ff, 0x73c20000, 0x000cbdff, 0x73e20000, 16119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000cc5ff, 0x7b000000, 0x000ccdff, 0x7b200000, 16129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000cd5ff, 0x7b400000, 0x000cdeff, 0x7b610000, 16139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000ce6ff, 0x7b810000, 0x000ceeff, 0x7ba10000, 16149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000cf6ff, 0x7bc20000, 0x000cffff, 0x7be20000, 16159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001000ff, 0x83000000, 0x001008ff, 0x83200000, 16169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001010ff, 0x83400000, 0x001018ff, 0x83610000, 16179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001020ff, 0x83810000, 0x001029ff, 0x83a10000, 16189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001031ff, 0x83c20000, 0x001039ff, 0x83e20000, 16199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001041ff, 0x8b000000, 0x00104aff, 0x8b200000, 16209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001052ff, 0x8b400000, 0x00105aff, 0x8b610000, 16219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001062ff, 0x8b810000, 0x00106aff, 0x8ba10000, 16229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001073ff, 0x8bc20000, 0x00107bff, 0x8be20000, 16239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001083ff, 0x94000000, 0x00108bff, 0x94200000, 16249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001094ff, 0x94400000, 0x00109cff, 0x94610000, 16259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010a4ff, 0x94810000, 0x0010acff, 0x94a10000, 16269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010b4ff, 0x94c20000, 0x0010bdff, 0x94e20000, 16279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010c5ff, 0x9c000000, 0x0010cdff, 0x9c200000, 16289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010d5ff, 0x9c400000, 0x0010deff, 0x9c610000, 16299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010e6ff, 0x9c810000, 0x0010eeff, 0x9ca10000, 16309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0010f6ff, 0x9cc20000, 0x0010ffff, 0x9ce20000, 16319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001400ff, 0xa4000000, 0x001408ff, 0xa4200000, 16329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001410ff, 0xa4400000, 0x001418ff, 0xa4610000, 16339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001420ff, 0xa4810000, 0x001429ff, 0xa4a10000, 16349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001431ff, 0xa4c20000, 0x001439ff, 0xa4e20000, 16359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001441ff, 0xac000000, 0x00144aff, 0xac200000, 16369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001452ff, 0xac400000, 0x00145aff, 0xac610000, 16379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001462ff, 0xac810000, 0x00146aff, 0xaca10000, 16389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001473ff, 0xacc20000, 0x00147bff, 0xace20000, 16399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001483ff, 0xb4000000, 0x00148bff, 0xb4200000, 16409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001494ff, 0xb4400000, 0x00149cff, 0xb4610000, 16419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014a4ff, 0xb4810000, 0x0014acff, 0xb4a10000, 16429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014b4ff, 0xb4c20000, 0x0014bdff, 0xb4e20000, 16439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014c5ff, 0xbd000000, 0x0014cdff, 0xbd200000, 16449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014d5ff, 0xbd400000, 0x0014deff, 0xbd610000, 16459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014e6ff, 0xbd810000, 0x0014eeff, 0xbda10000, 16469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0014f6ff, 0xbdc20000, 0x0014ffff, 0xbde20000, 16479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001800ff, 0xc5000000, 0x001808ff, 0xc5200000, 16489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001810ff, 0xc5400000, 0x001818ff, 0xc5610000, 16499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001820ff, 0xc5810000, 0x001829ff, 0xc5a10000, 16509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001831ff, 0xc5c20000, 0x001839ff, 0xc5e20000, 16519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001841ff, 0xcd000000, 0x00184aff, 0xcd200000, 16529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001852ff, 0xcd400000, 0x00185aff, 0xcd610000, 16539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001862ff, 0xcd810000, 0x00186aff, 0xcda10000, 16549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001873ff, 0xcdc20000, 0x00187bff, 0xcde20000, 16559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001883ff, 0xd5000000, 0x00188bff, 0xd5200000, 16569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001894ff, 0xd5400000, 0x00189cff, 0xd5610000, 16579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018a4ff, 0xd5810000, 0x0018acff, 0xd5a10000, 16589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018b4ff, 0xd5c20000, 0x0018bdff, 0xd5e20000, 16599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018c5ff, 0xde000000, 0x0018cdff, 0xde200000, 16609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018d5ff, 0xde400000, 0x0018deff, 0xde610000, 16619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018e6ff, 0xde810000, 0x0018eeff, 0xdea10000, 16629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x0018f6ff, 0xdec20000, 0x0018ffff, 0xdee20000, 16639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c00ff, 0xe6000000, 0x001c08ff, 0xe6200000, 16649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c10ff, 0xe6400000, 0x001c18ff, 0xe6610000, 16659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c20ff, 0xe6810000, 0x001c29ff, 0xe6a10000, 16669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c31ff, 0xe6c20000, 0x001c39ff, 0xe6e20000, 16679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c41ff, 0xee000000, 0x001c4aff, 0xee200000, 16689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c52ff, 0xee400000, 0x001c5aff, 0xee610000, 16699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c62ff, 0xee810000, 0x001c6aff, 0xeea10000, 16709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c73ff, 0xeec20000, 0x001c7bff, 0xeee20000, 16719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c83ff, 0xf6000000, 0x001c8bff, 0xf6200000, 16729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c94ff, 0xf6400000, 0x001c9cff, 0xf6610000, 16739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001ca4ff, 0xf6810000, 0x001cacff, 0xf6a10000, 16749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001cb4ff, 0xf6c20000, 0x001cbdff, 0xf6e20000, 16759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000, 16769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000, 16779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000, 16789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000, 16799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 16809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_RGBA8888(SDL_BlitInfo *info) 16819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 16829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Blit_RGB565_32(info, RGB565_RGBA8888_LUT); 16839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 16849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 16859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 5-6-5 --> BGRA 8-8-8-8 */ 16869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const Uint32 RGB565_BGRA8888_LUT[512] = { 16879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00000000, 0x000000ff, 0x08000000, 0x002000ff, 16889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10000000, 0x004000ff, 0x18000000, 0x006100ff, 16899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20000000, 0x008100ff, 0x29000000, 0x00a100ff, 16909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31000000, 0x00c200ff, 0x39000000, 0x00e200ff, 16919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41000000, 0x000008ff, 0x4a000000, 0x002008ff, 16929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52000000, 0x004008ff, 0x5a000000, 0x006108ff, 16939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62000000, 0x008108ff, 0x6a000000, 0x00a108ff, 16949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73000000, 0x00c208ff, 0x7b000000, 0x00e208ff, 16959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83000000, 0x000010ff, 0x8b000000, 0x002010ff, 16969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94000000, 0x004010ff, 0x9c000000, 0x006110ff, 16979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4000000, 0x008110ff, 0xac000000, 0x00a110ff, 16989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4000000, 0x00c210ff, 0xbd000000, 0x00e210ff, 16999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5000000, 0x000018ff, 0xcd000000, 0x002018ff, 17009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5000000, 0x004018ff, 0xde000000, 0x006118ff, 17019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6000000, 0x008118ff, 0xee000000, 0x00a118ff, 17029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6000000, 0x00c218ff, 0xff000000, 0x00e218ff, 17039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00040000, 0x000020ff, 0x08040000, 0x002020ff, 17049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10040000, 0x004020ff, 0x18040000, 0x006120ff, 17059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20040000, 0x008120ff, 0x29040000, 0x00a120ff, 17069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31040000, 0x00c220ff, 0x39040000, 0x00e220ff, 17079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41040000, 0x000029ff, 0x4a040000, 0x002029ff, 17089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52040000, 0x004029ff, 0x5a040000, 0x006129ff, 17099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62040000, 0x008129ff, 0x6a040000, 0x00a129ff, 17109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73040000, 0x00c229ff, 0x7b040000, 0x00e229ff, 17119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83040000, 0x000031ff, 0x8b040000, 0x002031ff, 17129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94040000, 0x004031ff, 0x9c040000, 0x006131ff, 17139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4040000, 0x008131ff, 0xac040000, 0x00a131ff, 17149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4040000, 0x00c231ff, 0xbd040000, 0x00e231ff, 17159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5040000, 0x000039ff, 0xcd040000, 0x002039ff, 17169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5040000, 0x004039ff, 0xde040000, 0x006139ff, 17179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6040000, 0x008139ff, 0xee040000, 0x00a139ff, 17189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6040000, 0x00c239ff, 0xff040000, 0x00e239ff, 17199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00080000, 0x000041ff, 0x08080000, 0x002041ff, 17209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10080000, 0x004041ff, 0x18080000, 0x006141ff, 17219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20080000, 0x008141ff, 0x29080000, 0x00a141ff, 17229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31080000, 0x00c241ff, 0x39080000, 0x00e241ff, 17239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41080000, 0x00004aff, 0x4a080000, 0x00204aff, 17249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52080000, 0x00404aff, 0x5a080000, 0x00614aff, 17259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62080000, 0x00814aff, 0x6a080000, 0x00a14aff, 17269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73080000, 0x00c24aff, 0x7b080000, 0x00e24aff, 17279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83080000, 0x000052ff, 0x8b080000, 0x002052ff, 17289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94080000, 0x004052ff, 0x9c080000, 0x006152ff, 17299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4080000, 0x008152ff, 0xac080000, 0x00a152ff, 17309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4080000, 0x00c252ff, 0xbd080000, 0x00e252ff, 17319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5080000, 0x00005aff, 0xcd080000, 0x00205aff, 17329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5080000, 0x00405aff, 0xde080000, 0x00615aff, 17339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6080000, 0x00815aff, 0xee080000, 0x00a15aff, 17349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6080000, 0x00c25aff, 0xff080000, 0x00e25aff, 17359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x000c0000, 0x000062ff, 0x080c0000, 0x002062ff, 17369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x100c0000, 0x004062ff, 0x180c0000, 0x006162ff, 17379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x200c0000, 0x008162ff, 0x290c0000, 0x00a162ff, 17389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x310c0000, 0x00c262ff, 0x390c0000, 0x00e262ff, 17399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x410c0000, 0x00006aff, 0x4a0c0000, 0x00206aff, 17409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x520c0000, 0x00406aff, 0x5a0c0000, 0x00616aff, 17419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x620c0000, 0x00816aff, 0x6a0c0000, 0x00a16aff, 17429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x730c0000, 0x00c26aff, 0x7b0c0000, 0x00e26aff, 17439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x830c0000, 0x000073ff, 0x8b0c0000, 0x002073ff, 17449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x940c0000, 0x004073ff, 0x9c0c0000, 0x006173ff, 17459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa40c0000, 0x008173ff, 0xac0c0000, 0x00a173ff, 17469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb40c0000, 0x00c273ff, 0xbd0c0000, 0x00e273ff, 17479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc50c0000, 0x00007bff, 0xcd0c0000, 0x00207bff, 17489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd50c0000, 0x00407bff, 0xde0c0000, 0x00617bff, 17499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe60c0000, 0x00817bff, 0xee0c0000, 0x00a17bff, 17509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf60c0000, 0x00c27bff, 0xff0c0000, 0x00e27bff, 17519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00100000, 0x000083ff, 0x08100000, 0x002083ff, 17529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10100000, 0x004083ff, 0x18100000, 0x006183ff, 17539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20100000, 0x008183ff, 0x29100000, 0x00a183ff, 17549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31100000, 0x00c283ff, 0x39100000, 0x00e283ff, 17559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41100000, 0x00008bff, 0x4a100000, 0x00208bff, 17569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52100000, 0x00408bff, 0x5a100000, 0x00618bff, 17579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62100000, 0x00818bff, 0x6a100000, 0x00a18bff, 17589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73100000, 0x00c28bff, 0x7b100000, 0x00e28bff, 17599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83100000, 0x000094ff, 0x8b100000, 0x002094ff, 17609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94100000, 0x004094ff, 0x9c100000, 0x006194ff, 17619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4100000, 0x008194ff, 0xac100000, 0x00a194ff, 17629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4100000, 0x00c294ff, 0xbd100000, 0x00e294ff, 17639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5100000, 0x00009cff, 0xcd100000, 0x00209cff, 17649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5100000, 0x00409cff, 0xde100000, 0x00619cff, 17659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6100000, 0x00819cff, 0xee100000, 0x00a19cff, 17669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6100000, 0x00c29cff, 0xff100000, 0x00e29cff, 17679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00140000, 0x0000a4ff, 0x08140000, 0x0020a4ff, 17689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10140000, 0x0040a4ff, 0x18140000, 0x0061a4ff, 17699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20140000, 0x0081a4ff, 0x29140000, 0x00a1a4ff, 17709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31140000, 0x00c2a4ff, 0x39140000, 0x00e2a4ff, 17719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41140000, 0x0000acff, 0x4a140000, 0x0020acff, 17729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52140000, 0x0040acff, 0x5a140000, 0x0061acff, 17739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62140000, 0x0081acff, 0x6a140000, 0x00a1acff, 17749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73140000, 0x00c2acff, 0x7b140000, 0x00e2acff, 17759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83140000, 0x0000b4ff, 0x8b140000, 0x0020b4ff, 17769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94140000, 0x0040b4ff, 0x9c140000, 0x0061b4ff, 17779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4140000, 0x0081b4ff, 0xac140000, 0x00a1b4ff, 17789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4140000, 0x00c2b4ff, 0xbd140000, 0x00e2b4ff, 17799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5140000, 0x0000bdff, 0xcd140000, 0x0020bdff, 17809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5140000, 0x0040bdff, 0xde140000, 0x0061bdff, 17819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6140000, 0x0081bdff, 0xee140000, 0x00a1bdff, 17829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6140000, 0x00c2bdff, 0xff140000, 0x00e2bdff, 17839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x00180000, 0x0000c5ff, 0x08180000, 0x0020c5ff, 17849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x10180000, 0x0040c5ff, 0x18180000, 0x0061c5ff, 17859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x20180000, 0x0081c5ff, 0x29180000, 0x00a1c5ff, 17869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x31180000, 0x00c2c5ff, 0x39180000, 0x00e2c5ff, 17879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x41180000, 0x0000cdff, 0x4a180000, 0x0020cdff, 17889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x52180000, 0x0040cdff, 0x5a180000, 0x0061cdff, 17899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x62180000, 0x0081cdff, 0x6a180000, 0x00a1cdff, 17909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x73180000, 0x00c2cdff, 0x7b180000, 0x00e2cdff, 17919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x83180000, 0x0000d5ff, 0x8b180000, 0x0020d5ff, 17929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x94180000, 0x0040d5ff, 0x9c180000, 0x0061d5ff, 17939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa4180000, 0x0081d5ff, 0xac180000, 0x00a1d5ff, 17949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb4180000, 0x00c2d5ff, 0xbd180000, 0x00e2d5ff, 17959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc5180000, 0x0000deff, 0xcd180000, 0x0020deff, 17969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd5180000, 0x0040deff, 0xde180000, 0x0061deff, 17979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe6180000, 0x0081deff, 0xee180000, 0x00a1deff, 17989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf6180000, 0x00c2deff, 0xff180000, 0x00e2deff, 17999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x001c0000, 0x0000e6ff, 0x081c0000, 0x0020e6ff, 18009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x101c0000, 0x0040e6ff, 0x181c0000, 0x0061e6ff, 18019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x201c0000, 0x0081e6ff, 0x291c0000, 0x00a1e6ff, 18029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x311c0000, 0x00c2e6ff, 0x391c0000, 0x00e2e6ff, 18039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x411c0000, 0x0000eeff, 0x4a1c0000, 0x0020eeff, 18049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x521c0000, 0x0040eeff, 0x5a1c0000, 0x0061eeff, 18059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x621c0000, 0x0081eeff, 0x6a1c0000, 0x00a1eeff, 18069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x731c0000, 0x00c2eeff, 0x7b1c0000, 0x00e2eeff, 18079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x831c0000, 0x0000f6ff, 0x8b1c0000, 0x0020f6ff, 18089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0x941c0000, 0x0040f6ff, 0x9c1c0000, 0x0061f6ff, 18099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xa41c0000, 0x0081f6ff, 0xac1c0000, 0x00a1f6ff, 18109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xb41c0000, 0x00c2f6ff, 0xbd1c0000, 0x00e2f6ff, 18119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xc51c0000, 0x0000ffff, 0xcd1c0000, 0x0020ffff, 18129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xd51c0000, 0x0040ffff, 0xde1c0000, 0x0061ffff, 18139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff, 18149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff 18159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 18169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB565_BGRA8888(SDL_BlitInfo *info) 18179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 18189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Blit_RGB565_32(info, RGB565_BGRA8888_LUT); 18199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 18209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 18219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */ 18229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef RGB888_RGB332 18239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define RGB888_RGB332(dst, src) { \ 18249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (((src)&0x00E00000)>>16)| \ 18259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src)&0x0000E000)>>11)| \ 18269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (((src)&0x000000C0)>>6); \ 18279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 18289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 18299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit_RGB888_index8_map(SDL_BlitInfo *info) 18309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 18319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 18329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 18339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 18349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int Pixel; 18359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 18369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src; 18379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 *map; 18389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst; 18399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 18409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 18419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 18429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 18439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 18449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32 *)info->s_pixels; 18459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip/4; 18469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = info->d_pixels; 18479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip; 18489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall map = info->table; 18499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 18509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 18519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 18529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 18539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 18579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 18589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 18599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 18609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 18619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 18629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width/4; c; --c ) { 18639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 18649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 18779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall switch ( width & 3 ) { 18789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 3: 18799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 2: 18839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall case 1: 18879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB888_RGB332(Pixel, *src); 18889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst++ = map[Pixel]; 18899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 18909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 18919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 18929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 18939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 18949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 18959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 18969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNto1(SDL_BlitInfo *info) 18979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 18989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef USE_DUFFS_LOOP 18999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 19009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 19019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, height; 19029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src; 19039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 *map; 19049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst; 19059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip, dstskip; 19069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp; 19079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 19089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int sR, sG, sB; 19099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt; 19109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 19119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 19129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width = info->d_width; 19139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall height = info->d_height; 19149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = info->s_pixels; 19159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip = info->s_skip; 19169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = info->d_pixels; 19179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip = info->d_skip; 19189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall map = info->table; 19199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt = info->src; 19209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcbpp = srcfmt->BytesPerPixel; 19219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 19229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( map == NULL ) { 19239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 19249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 19259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 19269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 19279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 19289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( 1 ) { 19299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 19309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = ((sR>>5)<<(3+2))| 19319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 19329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0)) ; 19339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 19359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 19369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 19379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 19389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width; c; --c ) { 19399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 19409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 19419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( 1 ) { 19429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 19439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = ((sR>>5)<<(3+2))| 19449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 19459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0)) ; 19469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 19489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 19499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 19519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 19529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 19539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 19559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 19569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef USE_DUFFS_LOOP 19579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 19589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 19599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 19609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( 1 ) { 19619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 19629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = map[((sR>>5)<<(3+2))| 19639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 19649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0)) ]; 19659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 19679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 19689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall , width); 19699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 19709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width; c; --c ) { 19719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 19729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 19739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( 1 ) { 19749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 19759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = map[((sR>>5)<<(3+2))| 19769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 19779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0)) ]; 19789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 19809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 19819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* USE_DUFFS_LOOP */ 19839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 19849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 19859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 19879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 19889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 19899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* blits 32 bit RGB<->RGBA with both surfaces having the same R,G,B fields */ 19909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit4to4MaskAlpha(SDL_BlitInfo *info) 19919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 19929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 19939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 19949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *src = (Uint32 *)info->s_pixels; 19959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 19969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 *dst = (Uint32 *)info->d_pixels; 19979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 19989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 19999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 20009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dstfmt->Amask) { 20029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* RGB->RGBA, SET_ALPHA */ 20039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 mask = (srcfmt->alpha >> dstfmt->Aloss) << dstfmt->Ashift; 20049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 20069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 20079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 20089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = *src | mask; 20099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 20109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 20119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 20129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 20139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32*)((Uint8*)src + srcskip); 20149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint32*)((Uint8*)dst + dstskip); 20159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 20179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* RGBA->RGB, NO_ALPHA */ 20189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; 20199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 20219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 20229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 20239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = *src & mask; 20249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++dst; 20259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++src; 20269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 20279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 20289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src = (Uint32*)((Uint8*)src + srcskip); 20299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst = (Uint32*)((Uint8*)dst + dstskip); 20309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 20339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoN(SDL_BlitInfo *info) 20359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 20369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 20379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 20389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = info->s_pixels; 20399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 20409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = info->d_pixels; 20419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 20429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 20439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp = srcfmt->BytesPerPixel; 20449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 20459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstbpp = dstfmt->BytesPerPixel; 20469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0; 20479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 20499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 20509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 20519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 20529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR; 20539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sG; 20549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sB; 20559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); 20569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha); 20579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstbpp; 20589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 20599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 20609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 20619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 20629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 20639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 20659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoNCopyAlpha(SDL_BlitInfo *info) 20679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 20689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 20699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 20709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = info->s_pixels; 20719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 20729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = info->d_pixels; 20739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 20749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 20759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp = srcfmt->BytesPerPixel; 20769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 20779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstbpp = dstfmt->BytesPerPixel; 20789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int c; 20799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* FIXME: should map alpha to [0..255] correctly! */ 20819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 20829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( c=width; c; --c ) { 20839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 20849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB, sA; 20859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, 20869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); 20879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, dstbpp, dstfmt, 20889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); 20899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstbpp; 20909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 20919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 20939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 20949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 20959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 20969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 20979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNto1Key(SDL_BlitInfo *info) 20989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 20999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 21009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 21019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = info->s_pixels; 21029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 21039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = info->d_pixels; 21049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 21059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 21069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 *palmap = info->table; 21079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 ckey = srcfmt->colorkey; 21089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rgbmask = ~srcfmt->Amask; 21099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp; 21109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 21119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB; 21129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 21149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcbpp = srcfmt->BytesPerPixel; 21159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ckey &= rgbmask; 21169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( palmap == NULL ) { 21189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 21199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 21209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 21219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 21229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 21239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (Pixel & rgbmask) != ckey ) { 21249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 21259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = (Uint8)(((sR>>5)<<(3+2))| 21269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 21279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0))); 21289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 21309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 21319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 21329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 21339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 21349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 21359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 21379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 21389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 21399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 21409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, 21419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB); 21429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (Pixel & rgbmask) != ckey ) { 21439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Pack RGB into 8bit pixel */ 21449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dst = (Uint8)palmap[((sR>>5)<<(3+2))| 21459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sG>>5)<<(2)) | 21469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((sB>>6)<<(0)) ]; 21479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst++; 21499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 21509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 21519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 21529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 21539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 21549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 21579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void Blit2to2Key(SDL_BlitInfo *info) 21599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 21609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 21619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 21629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 *srcp = (Uint16 *)info->s_pixels; 21639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 21649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 *dstp = (Uint16 *)info->d_pixels; 21659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 21669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 ckey = info->src->colorkey; 21679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rgbmask = ~info->src->Amask; 21689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 21709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcskip /= 2; 21719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstskip /= 2; 21729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ckey &= rgbmask; 21739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 21759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 21769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 21779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (*srcp & rgbmask) != ckey ) { 21789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *dstp = *srcp; 21799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp++; 21819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp++; 21829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 21839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 21849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcp += srcskip; 21859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstp += dstskip; 21869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 21879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 21889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 21899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoNKey(SDL_BlitInfo *info) 21909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 21919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 21929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 21939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = info->s_pixels; 21949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 21959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = info->d_pixels; 21969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 21979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 ckey = info->src->colorkey; 21989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 21999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 22009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcbpp = srcfmt->BytesPerPixel; 22019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstbpp = dstfmt->BytesPerPixel; 22029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0; 22039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rgbmask = ~srcfmt->Amask; 22049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 22069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ckey &= rgbmask; 22079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 22099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 22109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 22119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 22129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR; 22139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sG; 22149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sB; 22159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); 22169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (Pixel & rgbmask) != ckey ) { 22179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); 22189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, dstbpp, dstfmt, 22199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, alpha); 22209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 22219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstbpp; 22229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 22239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 22249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 22259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 22269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 22279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 22289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 22299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info) 22319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 22329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width = info->d_width; 22339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int height = info->d_height; 22349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *src = info->s_pixels; 22359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int srcskip = info->s_skip; 22369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *dst = info->d_pixels; 22379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstskip = info->d_skip; 22389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 ckey = info->src->colorkey; 22399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt = info->src; 22409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt = info->dst; 22419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 rgbmask = ~srcfmt->Amask; 22429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 srcbpp; 22449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 dstbpp; 22459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Pixel; 22469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned sR, sG, sB, sA; 22479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up some basic variables */ 22499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcbpp = srcfmt->BytesPerPixel; 22509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstbpp = dstfmt->BytesPerPixel; 22519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ckey &= rgbmask; 22529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* FIXME: should map alpha to [0..255] correctly! */ 22549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( height-- ) { 22559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DUFFS_LOOP( 22569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 22579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, 22589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); 22599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (Pixel & rgbmask) != ckey ) { 22609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ASSEMBLE_RGBA(dst, dstbpp, dstfmt, 22619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sR, sG, sB, sA); 22629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 22639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstbpp; 22649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcbpp; 22659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall }, 22669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall width); 22679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall src += srcskip; 22689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dst += dstskip; 22699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 22709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 22719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 22729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Normal N to N optimized blitters */ 22739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstruct blit_table { 22749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 srcR, srcG, srcB; 22759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int dstbpp; 22769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 dstR, dstG, dstB; 22779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_features; 22789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void *aux_data; 22799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_loblit blitfunc; 22809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall enum { NO_ALPHA=1, SET_ALPHA=2, COPY_ALPHA=4 } alpha; 22819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 22829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const struct blit_table normal_blit_1[] = { 22839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Default for 8-bit RGB source, an invalid combination */ 22849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0,0,0, 0, 0,0,0, 0, NULL, NULL }, 22859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 22869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const struct blit_table normal_blit_2[] = { 22879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_HERMES_BLITTERS 22889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 2, 0x0000001F,0x000007E0,0x0000F800, 22899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p16_16BGR565, ConvertX86, NO_ALPHA }, 22909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 2, 0x00007C00,0x000003E0,0x0000001F, 22919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p16_16RGB555, ConvertX86, NO_ALPHA }, 22929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 2, 0x0000001F,0x000003E0,0x00007C00, 22939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p16_16BGR555, ConvertX86, NO_ALPHA }, 22949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#elif SDL_ALTIVEC_BLITTERS 22959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* has-altivec */ 22969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 4, 0x00000000,0x00000000,0x00000000, 22979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2, NULL, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, 22989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00007C00,0x000003E0,0x0000001F, 4, 0x00000000,0x00000000,0x00000000, 22999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2, NULL, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, 23009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 23019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 4, 0x00FF0000,0x0000FF00,0x000000FF, 23029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB565_ARGB8888, SET_ALPHA }, 23039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 4, 0x000000FF,0x0000FF00,0x00FF0000, 23049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB565_ABGR8888, SET_ALPHA }, 23059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 4, 0xFF000000,0x00FF0000,0x0000FF00, 23069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB565_RGBA8888, SET_ALPHA }, 23079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x0000F800,0x000007E0,0x0000001F, 4, 0x0000FF00,0x00FF0000,0xFF000000, 23089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB565_BGRA8888, SET_ALPHA }, 23099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Default for 16-bit RGB source, used if no other blitter matches */ 23119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 } 23129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 23139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const struct blit_table normal_blit_3[] = { 23149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Default for 24-bit RGB source, never optimized */ 23159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 } 23169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 23179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const struct blit_table normal_blit_4[] = { 23189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_HERMES_BLITTERS 23199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000F800,0x000007E0,0x0000001F, 23209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1, ConvertMMXpII32_16RGB565, ConvertMMX, NO_ALPHA }, 23219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000F800,0x000007E0,0x0000001F, 23229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_16RGB565, ConvertX86, NO_ALPHA }, 23239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000001F,0x000007E0,0x0000F800, 23249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1, ConvertMMXpII32_16BGR565, ConvertMMX, NO_ALPHA }, 23259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000001F,0x000007E0,0x0000F800, 23269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_16BGR565, ConvertX86, NO_ALPHA }, 23279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x00007C00,0x000003E0,0x0000001F, 23289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1, ConvertMMXpII32_16RGB555, ConvertMMX, NO_ALPHA }, 23299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x00007C00,0x000003E0,0x0000001F, 23309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_16RGB555, ConvertX86, NO_ALPHA }, 23319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000001F,0x000003E0,0x00007C00, 23329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1, ConvertMMXpII32_16BGR555, ConvertMMX, NO_ALPHA }, 23339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000001F,0x000003E0,0x00007C00, 23349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_16BGR555, ConvertX86, NO_ALPHA }, 23359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 3, 0x00FF0000,0x0000FF00,0x000000FF, 23369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1, ConvertMMXpII32_24RGB888, ConvertMMX, NO_ALPHA }, 23379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 3, 0x00FF0000,0x0000FF00,0x000000FF, 23389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_24RGB888, ConvertX86, NO_ALPHA }, 23399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 3, 0x000000FF,0x0000FF00,0x00FF0000, 23409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_24BGR888, ConvertX86, NO_ALPHA }, 23419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 4, 0x000000FF,0x0000FF00,0x00FF0000, 23429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_32BGR888, ConvertX86, NO_ALPHA }, 23439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 4, 0xFF000000,0x00FF0000,0x0000FF00, 23449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_32RGBA888, ConvertX86, NO_ALPHA }, 23459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 4, 0x0000FF00,0x00FF0000,0xFF000000, 23469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, ConvertX86p32_32BGRA888, ConvertX86, NO_ALPHA }, 23479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 23489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_ALTIVEC_BLITTERS 23499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* has-altivec | dont-use-prefetch */ 23509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00000000,0x00000000,0x00000000, 4, 0x00000000,0x00000000,0x00000000, 23519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6, NULL, ConvertAltivec32to32_noprefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, 23529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* has-altivec */ 23539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00000000,0x00000000,0x00000000, 4, 0x00000000,0x00000000,0x00000000, 23549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2, NULL, ConvertAltivec32to32_prefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, 23559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* has-altivec */ 23569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00000000,0x00000000,0x00000000, 2, 0x0000F800,0x000007E0,0x0000001F, 23579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2, NULL, Blit_RGB888_RGB565Altivec, NO_ALPHA }, 23589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 23599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x0000F800,0x000007E0,0x0000001F, 23609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB888_RGB565, NO_ALPHA }, 23619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0x00FF0000,0x0000FF00,0x000000FF, 2, 0x00007C00,0x000003E0,0x0000001F, 23629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 0, NULL, Blit_RGB888_RGB555, NO_ALPHA }, 23639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 23649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Default for 32-bit RGB source, used if no other blitter matches */ 23659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 } 23669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 23679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic const struct blit_table *normal_blit[] = { 23689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4 23699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 23709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Mask matches table, or table entry is zero */ 23729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define MASKOK(x, y) (((x) == (y)) || ((y) == 0x00000000)) 23739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSDL_loblit SDL_CalculateBlitN(SDL_Surface *surface, int blit_index) 23759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 23769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct private_swaccel *sdata; 23779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *srcfmt; 23789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *dstfmt; 23799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const struct blit_table *table; 23809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int which; 23819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_loblit blitfun; 23829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Set up data for choosing the blit */ 23849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sdata = surface->map->sw_data; 23859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt = surface->format; 23869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstfmt = surface->map->dst->format; 23879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( blit_index & 2 ) { 23899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* alpha or alpha+colorkey */ 23909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return SDL_CalculateAlphaBlit(surface, blit_index); 23919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 23929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* We don't support destinations less than 8-bits */ 23949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( dstfmt->BitsPerPixel < 8 ) { 23959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return(NULL); 23969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 23979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 23989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(blit_index == 1) { 23999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* colorkey blit: Here we don't have too many options, mostly 24009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall because RLE is the preferred fast way to deal with this. 24019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall If a particular case turns out to be useful we'll add it. */ 24029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(srcfmt->BytesPerPixel == 2 24049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall && surface->map->identity) 24059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return Blit2to2Key; 24069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else if(dstfmt->BytesPerPixel == 1) 24079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return BlitNto1Key; 24089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else { 24099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_ALTIVEC_BLITTERS 24109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4) && SDL_HasAltiVec()) { 24119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return Blit32to32KeyAltivec; 24129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else 24139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 24149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(srcfmt->Amask && dstfmt->Amask) 24169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return BlitNtoNKeyCopyAlpha; 24179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else 24189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return BlitNtoNKey; 24199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = NULL; 24239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( dstfmt->BitsPerPixel == 8 ) { 24249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* We assume 8-bit destinations are palettized */ 24259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (srcfmt->BytesPerPixel == 4) && 24269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (srcfmt->Rmask == 0x00FF0000) && 24279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (srcfmt->Gmask == 0x0000FF00) && 24289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (srcfmt->Bmask == 0x000000FF) ) { 24299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( surface->map->table ) { 24309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = Blit_RGB888_index8_map; 24319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 24329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_HERMES_BLITTERS 24339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sdata->aux_data = ConvertX86p32_8RGB332; 24349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = ConvertX86; 24359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 24369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = Blit_RGB888_index8; 24379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 24389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 24409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = BlitNto1; 24419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 24439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Now the meat, choose the blitter we want */ 24449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int a_need = NO_ALPHA; 24459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(dstfmt->Amask) 24469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA; 24479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall table = normal_blit[srcfmt->BytesPerPixel-1]; 24489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( which=0; table[which].dstbpp; ++which ) { 24499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( MASKOK(srcfmt->Rmask, table[which].srcR) && 24509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MASKOK(srcfmt->Gmask, table[which].srcG) && 24519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MASKOK(srcfmt->Bmask, table[which].srcB) && 24529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MASKOK(dstfmt->Rmask, table[which].dstR) && 24539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MASKOK(dstfmt->Gmask, table[which].dstG) && 24549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MASKOK(dstfmt->Bmask, table[which].dstB) && 24559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dstfmt->BytesPerPixel == table[which].dstbpp && 24569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (a_need & table[which].alpha) == a_need && 24579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((table[which].blit_features & GetBlitFeatures()) == table[which].blit_features) ) 24589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 24599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall sdata->aux_data = table[which].aux_data; 24619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = table[which].blitfunc; 24629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if(blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */ 24649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */ 24659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4 && 24669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt->Rmask == dstfmt->Rmask && 24679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt->Gmask == dstfmt->Gmask && 24689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall srcfmt->Bmask == dstfmt->Bmask ) { 24699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = Blit4to4MaskAlpha; 24709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else if ( a_need == COPY_ALPHA ) { 24719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall blitfun = BlitNtoNCopyAlpha; 24729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 24759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef DEBUG_ASM 24779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_HERMES_BLITTERS 24789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( blitfun == ConvertMMX ) 24799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall fprintf(stderr, "Using mmx blit\n"); 24809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else 24819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( blitfun == ConvertX86 ) 24829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall fprintf(stderr, "Using asm blit\n"); 24839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else 24849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 24859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( (blitfun == BlitNtoN) || (blitfun == BlitNto1) ) 24869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall fprintf(stderr, "Using C blit\n"); 24879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else 24889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall fprintf(stderr, "Using optimized C blit\n"); 24899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* DEBUG_ASM */ 24909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 24919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return(blitfun); 24929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 2493