Added 16 (565) -> 15 (555) bit depth converter.
This commit is contained in:
parent
beca6ada2a
commit
fad4593a74
|
@ -157,6 +157,27 @@ static void palette_convert_24_to_8(
|
||||||
((unsigned int) palent[i].peBlue));
|
((unsigned int) palent[i].peBlue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *************************************
|
||||||
|
16 bpp to 15 bpp
|
||||||
|
************************************* */
|
||||||
|
static void pixel_convert_15_to_16(
|
||||||
|
void *src, void *dst, DWORD width, DWORD height, LONG pitch,
|
||||||
|
IDirectDrawPaletteImpl* palette
|
||||||
|
) {
|
||||||
|
unsigned short *c_src = (unsigned short *) src;
|
||||||
|
unsigned short *c_dst = (unsigned short *) dst;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
for (y = height; y--; ) {
|
||||||
|
unsigned short * srclineend = c_src+width;
|
||||||
|
while (c_src < srclineend ) {
|
||||||
|
unsigned short val = *c_src++;
|
||||||
|
*c_dst++=((val&0xFFC0)>>1)|(val&0x001f);
|
||||||
|
}
|
||||||
|
c_src+=((pitch/2)-width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* *************************************
|
/* *************************************
|
||||||
32 bpp to 16 bpp
|
32 bpp to 16 bpp
|
||||||
************************************* */
|
************************************* */
|
||||||
|
@ -203,11 +224,12 @@ static void pixel_convert_32_to_24(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Convert ModeEmulations[6] = {
|
Convert ModeEmulations[7] = {
|
||||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 24, 24, 0xFF0000, 0x0000FF00, 0x00FF }, { pixel_convert_32_to_24, NULL } },
|
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 24, 24, 0xFF0000, 0x0000FF00, 0x00FF }, { pixel_convert_32_to_24, NULL } },
|
||||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_32_to_8, palette_convert_24_to_8 } },
|
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_32_to_8, palette_convert_24_to_8 } },
|
||||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 16, 16, 0xF800, 0x07E0, 0x001F }, { pixel_convert_32_to_16, NULL } },
|
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 16, 16, 0xF800, 0x07E0, 0x001F }, { pixel_convert_32_to_16, NULL } },
|
||||||
{ { 24, 24, 0xFF0000, 0x00FF00, 0x0000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_24_to_8, palette_convert_24_to_8 } },
|
{ { 24, 24, 0xFF0000, 0x00FF00, 0x0000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_24_to_8, palette_convert_24_to_8 } },
|
||||||
|
{ { 16, 15, 0x7C00, 0x03E0, 0x001F }, { 16,16, 0xf800, 0x07e0, 0x001f }, { pixel_convert_15_to_16, NULL } },
|
||||||
{ { 16, 16, 0xF800, 0x07E0, 0x001F }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_16_to_8, palette_convert_16_to_8 } },
|
{ { 16, 16, 0xF800, 0x07E0, 0x001F }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_16_to_8, palette_convert_16_to_8 } },
|
||||||
{ { 16, 15, 0x7C00, 0x03E0, 0x001F }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_16_to_8, palette_convert_15_to_8 } },
|
{ { 16, 15, 0x7C00, 0x03E0, 0x001F }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_16_to_8, palette_convert_15_to_8 } },
|
||||||
};
|
};
|
||||||
|
|
|
@ -380,7 +380,7 @@ typedef struct {
|
||||||
ConvertFuncs funcs;
|
ConvertFuncs funcs;
|
||||||
} Convert;
|
} Convert;
|
||||||
|
|
||||||
extern Convert ModeEmulations[6];
|
extern Convert ModeEmulations[7];
|
||||||
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
|
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
|
||||||
|
|
||||||
extern HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl*);
|
extern HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl*);
|
||||||
|
|
Loading…
Reference in New Issue