src/video/SDL_blit_N.c
changeset 1428 5f52867ba65c
parent 1402 d910939febfa
child 1443 9ebbbb4ae53b
equal deleted inserted replaced
1427:5f5a74d29d18 1428:5f52867ba65c
   856 
   856 
   857 #else
   857 #else
   858 
   858 
   859 /* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */
   859 /* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */
   860 #define RGB888_RGB332(dst, src) { \
   860 #define RGB888_RGB332(dst, src) { \
   861 	dst = (((src)&0x00E00000)>>16)| \
   861 	dst = (Uint8)((((src)&0x00E00000)>>16)| \
   862 	      (((src)&0x0000E000)>>11)| \
   862 	              (((src)&0x0000E000)>>11)| \
   863 	      (((src)&0x000000C0)>>6); \
   863 	              (((src)&0x000000C0)>>6)); \
   864 }
   864 }
   865 static void Blit_RGB888_index8(SDL_BlitInfo *info)
   865 static void Blit_RGB888_index8(SDL_BlitInfo *info)
   866 {
   866 {
   867 #ifndef USE_DUFFS_LOOP
   867 #ifndef USE_DUFFS_LOOP
   868 	int c;
   868 	int c;
   960 		}
   960 		}
   961 	}
   961 	}
   962 }
   962 }
   963 /* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */
   963 /* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */
   964 #define RGB888_RGB555(dst, src) { \
   964 #define RGB888_RGB555(dst, src) { \
   965 	*(Uint16 *)(dst) = (((*src)&0x00F80000)>>9)| \
   965 	*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
   966 	                   (((*src)&0x0000F800)>>6)| \
   966 	                            (((*src)&0x0000F800)>>6)| \
   967 	                   (((*src)&0x000000F8)>>3); \
   967 	                            (((*src)&0x000000F8)>>3)); \
   968 }
   968 }
   969 #define RGB888_RGB555_TWO(dst, src) { \
   969 #define RGB888_RGB555_TWO(dst, src) { \
   970 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
   970 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
   971 	                     (((src[HI])&0x0000F800)>>6)| \
   971 	                     (((src[HI])&0x0000F800)>>6)| \
   972 	                     (((src[HI])&0x000000F8)>>3))<<16)| \
   972 	                     (((src[HI])&0x000000F8)>>3))<<16)| \
  1080 	}
  1080 	}
  1081 #endif /* USE_DUFFS_LOOP */
  1081 #endif /* USE_DUFFS_LOOP */
  1082 }
  1082 }
  1083 /* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */
  1083 /* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */
  1084 #define RGB888_RGB565(dst, src) { \
  1084 #define RGB888_RGB565(dst, src) { \
  1085 	*(Uint16 *)(dst) = (((*src)&0x00F80000)>>8)| \
  1085 	*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
  1086 	                   (((*src)&0x0000FC00)>>5)| \
  1086 	                            (((*src)&0x0000FC00)>>5)| \
  1087 	                   (((*src)&0x000000F8)>>3); \
  1087 	                            (((*src)&0x000000F8)>>3)); \
  1088 }
  1088 }
  1089 #define RGB888_RGB565_TWO(dst, src) { \
  1089 #define RGB888_RGB565_TWO(dst, src) { \
  1090 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
  1090 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
  1091 	                     (((src[HI])&0x0000FC00)>>5)| \
  1091 	                     (((src[HI])&0x0000FC00)>>5)| \
  1092 	                     (((src[HI])&0x000000F8)>>3))<<16)| \
  1092 	                     (((src[HI])&0x000000F8)>>3))<<16)| \
  2099 	const Uint8 *palmap = info->table;
  2099 	const Uint8 *palmap = info->table;
  2100 	Uint32 ckey = srcfmt->colorkey;
  2100 	Uint32 ckey = srcfmt->colorkey;
  2101 	Uint32 rgbmask = ~srcfmt->Amask;
  2101 	Uint32 rgbmask = ~srcfmt->Amask;
  2102 	int srcbpp;
  2102 	int srcbpp;
  2103 	Uint32 Pixel;
  2103 	Uint32 Pixel;
  2104 	Uint8  sR, sG, sB;
  2104 	unsigned sR, sG, sB;
  2105 
  2105 
  2106 	/* Set up some basic variables */
  2106 	/* Set up some basic variables */
  2107 	srcbpp = srcfmt->BytesPerPixel;
  2107 	srcbpp = srcfmt->BytesPerPixel;
  2108 	ckey &= rgbmask;
  2108 	ckey &= rgbmask;
  2109 
  2109 
  2113 			{
  2113 			{
  2114 				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
  2114 				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
  2115 								sR, sG, sB);
  2115 								sR, sG, sB);
  2116 				if ( (Pixel & rgbmask) != ckey ) {
  2116 				if ( (Pixel & rgbmask) != ckey ) {
  2117 				  	/* Pack RGB into 8bit pixel */
  2117 				  	/* Pack RGB into 8bit pixel */
  2118 				  	*dst = ((sR>>5)<<(3+2))|
  2118 				  	*dst = (Uint8)(((sR>>5)<<(3+2))|
  2119 						((sG>>5)<<(2)) |
  2119 						           ((sG>>5)<<(2)) |
  2120 						((sB>>6)<<(0)) ;
  2120 						           ((sB>>6)<<(0)));
  2121 				}
  2121 				}
  2122 				dst++;
  2122 				dst++;
  2123 				src += srcbpp;
  2123 				src += srcbpp;
  2124 			},
  2124 			},
  2125 			width);
  2125 			width);
  2132 			{
  2132 			{
  2133 				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
  2133 				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
  2134 								sR, sG, sB);
  2134 								sR, sG, sB);
  2135 				if ( (Pixel & rgbmask) != ckey ) {
  2135 				if ( (Pixel & rgbmask) != ckey ) {
  2136 				  	/* Pack RGB into 8bit pixel */
  2136 				  	/* Pack RGB into 8bit pixel */
  2137 				  	*dst = palmap[((sR>>5)<<(3+2))|
  2137 				  	*dst = (Uint8)palmap[((sR>>5)<<(3+2))|
  2138 							((sG>>5)<<(2))  |
  2138 							             ((sG>>5)<<(2))  |
  2139 							((sB>>6)<<(0))  ];
  2139 							             ((sB>>6)<<(0))  ];
  2140 				}
  2140 				}
  2141 				dst++;
  2141 				dst++;
  2142 				src += srcbpp;
  2142 				src += srcbpp;
  2143 			},
  2143 			},
  2144 			width);
  2144 			width);
  2230 	Uint32 rgbmask = ~srcfmt->Amask;
  2230 	Uint32 rgbmask = ~srcfmt->Amask;
  2231 
  2231 
  2232 	Uint8 srcbpp;
  2232 	Uint8 srcbpp;
  2233 	Uint8 dstbpp;
  2233 	Uint8 dstbpp;
  2234 	Uint32 Pixel;
  2234 	Uint32 Pixel;
  2235 	Uint8  sR, sG, sB, sA;
  2235 	unsigned sR, sG, sB, sA;
  2236 
  2236 
  2237 	/* Set up some basic variables */
  2237 	/* Set up some basic variables */
  2238 	srcbpp = srcfmt->BytesPerPixel;
  2238 	srcbpp = srcfmt->BytesPerPixel;
  2239 	dstbpp = dstfmt->BytesPerPixel;
  2239 	dstbpp = dstfmt->BytesPerPixel;
  2240 	ckey &= rgbmask;
  2240 	ckey &= rgbmask;