Roderick Colenbrander : wined3d: Move A4L4 conversion to the formats table.
Alexandre Julliard
julliard at winehq.org
Wed Apr 14 11:24:59 CDT 2010
Module: wine
Branch: master
Commit: 4c87bc0c410f3d40e8c612fdb7a02aa18d6af667
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4c87bc0c410f3d40e8c612fdb7a02aa18d6af667
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Wed Apr 14 14:19:18 2010 +0200
wined3d: Move A4L4 conversion to the formats table.
---
dlls/wined3d/surface.c | 27 ---------------------------
dlls/wined3d/utils.c | 27 +++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 40921d6..667478d 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2223,15 +2223,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
}
break;
- case WINED3DFMT_L4A4_UNORM:
- /* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
- * format+type combination to load it. Thus convert it to A8L8, then load it
- * with A4L4 internal, but A8L8 format+type
- */
- *convert = CONVERT_A4L4;
- desc->conv_byte_count = 2;
- break;
-
default:
break;
}
@@ -2475,24 +2466,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
}
break;
- case CONVERT_A4L4:
- {
- unsigned int x, y;
- const unsigned char *Source;
- unsigned char *Dest;
- for(y = 0; y < height; y++) {
- Source = src + y * pitch;
- Dest = dst + y * outpitch;
- for (x = 0; x < width; x++ ) {
- unsigned char color = (*Source++);
- /* A */ Dest[1] = (color & 0xf0) << 0;
- /* L */ Dest[0] = (color & 0x0f) << 4;
- Dest += 2;
- }
- }
- break;
- }
-
default:
ERR("Unsupported conversion type %#x.\n", convert);
}
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index abe3770..5ebf92d 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -241,6 +241,29 @@ struct wined3d_format_texture_info
void (*convert)(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height);
};
+static void convert_l4a4_unorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
+{
+ /* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
+ * format+type combination to load it. Thus convert it to A8L8, then load it
+ * with A4L4 internal, but A8L8 format+type
+ */
+ unsigned int x, y;
+ const unsigned char *Source;
+ unsigned char *Dest;
+ UINT outpitch = pitch * 2;
+
+ for(y = 0; y < height; y++) {
+ Source = src + y * pitch;
+ Dest = dst + y * outpitch;
+ for (x = 0; x < width; x++ ) {
+ unsigned char color = (*Source++);
+ /* A */ Dest[1] = (color & 0xf0) << 0;
+ /* L */ Dest[0] = (color & 0x0f) << 4;
+ Dest += 2;
+ }
+ }
+}
+
static void convert_r5g5_snorm_l6_unorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
{
unsigned int x, y;
@@ -703,9 +726,9 @@ static const struct wined3d_format_texture_info format_texture_info[] =
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
WINED3D_GL_EXT_NONE, NULL},
{WINED3DFMT_L4A4_UNORM, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE4_ALPHA4, 0,
- GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
+ GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 2,
0,
- WINED3D_GL_EXT_NONE, NULL},
+ WINED3D_GL_EXT_NONE, &convert_l4a4_unorm},
/* Bump mapping stuff */
{WINED3DFMT_R8G8_SNORM, GL_RGB8, GL_RGB8, 0,
GL_BGR, GL_UNSIGNED_BYTE, 3,
More information about the wine-cvs
mailing list