From 3dd03f642dc16d5eca6895a85d6a281f2321b0db Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 7 Dec 2011 22:08:59 +0100 Subject: [PATCH] wined3d: Get rid of the WINEDDCOLORKEY typedef. --- dlls/ddraw/surface.c | 16 +++++----- dlls/wined3d/device.c | 8 ++--- dlls/wined3d/surface.c | 68 +++++++++++++++++++++--------------------- dlls/wined3d/wined3d_private.h | 10 +++---- include/wine/wined3d.h | 20 ++++++------- 5 files changed, 60 insertions(+), 62 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index ff53a56e8b4..54ec973017c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -4187,7 +4187,7 @@ static HRESULT WINAPI ddraw_surface1_GetPalette(IDirectDrawSurface *iface, IDire struct SCKContext { HRESULT ret; - WINEDDCOLORKEY *CKey; + struct wined3d_color_key *color_key; DWORD Flags; }; @@ -4200,7 +4200,7 @@ SetColorKeyEnum(IDirectDrawSurface7 *surface, struct SCKContext *ctx = context; HRESULT hr; - hr = wined3d_surface_set_color_key(This->wined3d_surface, ctx->Flags, ctx->CKey); + hr = wined3d_surface_set_color_key(This->wined3d_surface, ctx->Flags, ctx->color_key); if (FAILED(hr)) { WARN("IWineD3DSurface_SetColorKey failed, hr = %08x\n", hr); @@ -4233,7 +4233,7 @@ static HRESULT WINAPI ddraw_surface7_SetColorKey(IDirectDrawSurface7 *iface, DWO { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); DDCOLORKEY FixedCKey; - struct SCKContext ctx = { DD_OK, (WINEDDCOLORKEY *) (CKey ? &FixedCKey : NULL), Flags }; + struct SCKContext ctx = { DD_OK, (struct wined3d_color_key *)(CKey ? &FixedCKey : NULL), Flags }; TRACE("iface %p, flags %#x, color_key %p.\n", iface, Flags, CKey); @@ -4297,7 +4297,7 @@ static HRESULT WINAPI ddraw_surface7_SetColorKey(IDirectDrawSurface7 *iface, DWO return DDERR_INVALIDPARAMS; } } - ctx.ret = wined3d_surface_set_color_key(This->wined3d_surface, Flags, ctx.CKey); + ctx.ret = wined3d_surface_set_color_key(This->wined3d_surface, Flags, ctx.color_key); ddraw_surface7_EnumAttachedSurfaces(iface, &ctx, SetColorKeyEnum); wined3d_mutex_unlock(); @@ -5383,22 +5383,22 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr if (desc->dwFlags & DDSD_CKDESTOVERLAY) { wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTOVERLAY, - (WINEDDCOLORKEY *)&desc->u3.ddckCKDestOverlay); + (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay); } if (desc->dwFlags & DDSD_CKDESTBLT) { wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTBLT, - (WINEDDCOLORKEY *)&desc->ddckCKDestBlt); + (struct wined3d_color_key *)&desc->ddckCKDestBlt); } if (desc->dwFlags & DDSD_CKSRCOVERLAY) { wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCOVERLAY, - (WINEDDCOLORKEY *)&desc->ddckCKSrcOverlay); + (struct wined3d_color_key *)&desc->ddckCKSrcOverlay); } if (desc->dwFlags & DDSD_CKSRCBLT) { wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCBLT, - (WINEDDCOLORKEY *)&desc->ddckCKSrcBlt); + (struct wined3d_color_key *)&desc->ddckCKSrcBlt); } if (desc->dwFlags & DDSD_LPSURFACE) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9618bb50312..b1411ba887f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -921,11 +921,11 @@ HRESULT CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, static void device_load_logo(struct wined3d_device *device, const char *filename) { + struct wined3d_color_key color_key; HBITMAP hbm; BITMAP bm; HRESULT hr; HDC dcb = NULL, dcs = NULL; - WINEDDCOLORKEY colorkey; hbm = LoadImageA(NULL, filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if(hbm) @@ -961,9 +961,9 @@ static void device_load_logo(struct wined3d_device *device, const char *filename BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY); wined3d_surface_releasedc(device->logo_surface, dcs); - colorkey.dwColorSpaceLowValue = 0; - colorkey.dwColorSpaceHighValue = 0; - wined3d_surface_set_color_key(device->logo_surface, WINEDDCKEY_SRCBLT, &colorkey); + color_key.color_space_low_value = 0; + color_key.color_space_high_value = 0; + wined3d_surface_set_color_key(device->logo_surface, WINEDDCKEY_SRCBLT, &color_key); } else { diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b7a120ec845..a081216731c 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1448,11 +1448,11 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC TRACE("lpDDSAlphaSrc %p.\n", fx->u4.lpDDSAlphaSrc); TRACE("lpDDSPattern %p.\n", fx->u5.lpDDSPattern); TRACE("ddckDestColorkey {%#x, %#x}.\n", - fx->ddckDestColorkey.dwColorSpaceLowValue, - fx->ddckDestColorkey.dwColorSpaceHighValue); + fx->ddckDestColorkey.color_space_low_value, + fx->ddckDestColorkey.color_space_high_value); TRACE("ddckSrcColorkey {%#x, %#x}.\n", - fx->ddckSrcColorkey.dwColorSpaceLowValue, - fx->ddckSrcColorkey.dwColorSpaceHighValue); + fx->ddckSrcColorkey.color_space_low_value, + fx->ddckSrcColorkey.color_space_high_value); } if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface && (src_surface->flags & SFLAG_LOCKED))) @@ -2733,8 +2733,8 @@ HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) /* Reload if either the texture and sysmem have different ideas about the * color key, or the actual key values changed. */ if (ck_changed || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT) - && (surface->glCKey.dwColorSpaceLowValue != surface->SrcBltCKey.dwColorSpaceLowValue - || surface->glCKey.dwColorSpaceHighValue != surface->SrcBltCKey.dwColorSpaceHighValue))) + && (surface->gl_color_key.color_space_low_value != surface->src_blt_color_key.color_space_low_value + || surface->gl_color_key.color_space_high_value != surface->src_blt_color_key.color_space_high_value))) { TRACE("Reloading because of color keying\n"); /* To perform the color key conversion we need a sysmem copy of @@ -3005,7 +3005,7 @@ HRESULT CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struc } HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface, - DWORD flags, const WINEDDCOLORKEY *color_key) + DWORD flags, const struct wined3d_color_key *color_key) { TRACE("surface %p, flags %#x, color_key %p.\n", surface, flags, color_key); @@ -3021,22 +3021,22 @@ HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface, switch (flags & ~WINEDDCKEY_COLORSPACE) { case WINEDDCKEY_DESTBLT: - surface->DestBltCKey = *color_key; + surface->dst_blt_color_key = *color_key; surface->CKeyFlags |= WINEDDSD_CKDESTBLT; break; case WINEDDCKEY_DESTOVERLAY: - surface->DestOverlayCKey = *color_key; + surface->dst_overlay_color_key = *color_key; surface->CKeyFlags |= WINEDDSD_CKDESTOVERLAY; break; case WINEDDCKEY_SRCOVERLAY: - surface->SrcOverlayCKey = *color_key; + surface->src_overlay_color_key = *color_key; surface->CKeyFlags |= WINEDDSD_CKSRCOVERLAY; break; case WINEDDCKEY_SRCBLT: - surface->SrcBltCKey = *color_key; + surface->src_blt_color_key = *color_key; surface->CKeyFlags |= WINEDDSD_CKSRCBLT; break; } @@ -4578,8 +4578,8 @@ void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[25 { table[i][3] = i; } - else if (colorkey && (i >= surface->SrcBltCKey.dwColorSpaceLowValue) - && (i <= surface->SrcBltCKey.dwColorSpaceHighValue)) + else if (colorkey && (i >= surface->src_blt_color_key.color_space_low_value) + && (i <= surface->src_blt_color_key.color_space_high_value)) { table[i][3] = 0x00; } @@ -4656,8 +4656,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++ ) { WORD color = *Source++; *Dest = ((color & 0xFFC0) | ((color & 0x1F) << 1)); - if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) - || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) + if ((color < surface->src_blt_color_key.color_space_low_value) + || (color > surface->src_blt_color_key.color_space_high_value)) *Dest |= 0x0001; Dest++; } @@ -4678,8 +4678,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++ ) { WORD color = *Source++; *Dest = color; - if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) - || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) + if ((color < surface->src_blt_color_key.color_space_low_value) + || (color > surface->src_blt_color_key.color_space_high_value)) *Dest |= (1 << 15); else *Dest &= ~(1 << 15); @@ -4700,8 +4700,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++) { DWORD color = ((DWORD)source[0] << 16) + ((DWORD)source[1] << 8) + (DWORD)source[2] ; DWORD dstcolor = color << 8; - if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) - || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) + if ((color < surface->src_blt_color_key.color_space_low_value) + || (color > surface->src_blt_color_key.color_space_high_value)) dstcolor |= 0xff; *(DWORD*)dest = dstcolor; source += 3; @@ -4722,8 +4722,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++) { DWORD color = 0xffffff & *(const DWORD*)source; DWORD dstcolor = color << 8; - if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) - || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) + if ((color < surface->src_blt_color_key.color_space_low_value) + || (color > surface->src_blt_color_key.color_space_high_value)) dstcolor |= 0xff; *(DWORD*)dest = dstcolor; source += 4; @@ -5273,7 +5273,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, * the palette entries. In other cases pixels that should be masked * away have alpha set to 0. */ if (primary_render_target_is_p8(device)) - glAlphaFunc(GL_NOTEQUAL, (float)src_surface->SrcBltCKey.dwColorSpaceLowValue / 256.0f); + glAlphaFunc(GL_NOTEQUAL, (float)src_surface->src_blt_color_key.color_space_low_value / 256.0f); else glAlphaFunc(GL_NOTEQUAL, 0.0f); checkGLcall("glAlphaFunc"); @@ -5459,8 +5459,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa else if (src_surface) { /* Blit from offscreen surface to render target */ + struct wined3d_color_key old_blt_key = src_surface->src_blt_color_key; DWORD oldCKeyFlags = src_surface->CKeyFlags; - WINEDDCOLORKEY oldBltCKey = src_surface->SrcBltCKey; TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface); @@ -5487,7 +5487,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa { /* Use color key from DDBltFx */ src_surface->CKeyFlags |= WINEDDSD_CKSRCBLT; - src_surface->SrcBltCKey = DDBltFx->ddckSrcColorkey; + src_surface->src_blt_color_key = DDBltFx->ddckSrcColorkey; } else { @@ -5500,7 +5500,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa /* Restore the color key parameters */ src_surface->CKeyFlags = oldCKeyFlags; - src_surface->SrcBltCKey = oldBltCKey; + src_surface->src_blt_color_key = old_blt_key; surface_modify_location(dst_surface, dst_surface->draw_binding, TRUE); @@ -6032,7 +6032,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, if (surface->CKeyFlags & WINEDDSD_CKSRCBLT) { surface->flags |= SFLAG_GLCKEY; - surface->glCKey = surface->SrcBltCKey; + surface->gl_color_key = surface->src_blt_color_key; } else surface->flags &= ~SFLAG_GLCKEY; @@ -6873,25 +6873,25 @@ do { \ /* The color keying flags are checked for correctness in ddraw */ if (flags & WINEDDBLT_KEYSRC) { - keylow = src_surface->SrcBltCKey.dwColorSpaceLowValue; - keyhigh = src_surface->SrcBltCKey.dwColorSpaceHighValue; + keylow = src_surface->src_blt_color_key.color_space_low_value; + keyhigh = src_surface->src_blt_color_key.color_space_high_value; } else if (flags & WINEDDBLT_KEYSRCOVERRIDE) { - keylow = fx->ddckSrcColorkey.dwColorSpaceLowValue; - keyhigh = fx->ddckSrcColorkey.dwColorSpaceHighValue; + keylow = fx->ddckSrcColorkey.color_space_low_value; + keyhigh = fx->ddckSrcColorkey.color_space_high_value; } if (flags & WINEDDBLT_KEYDEST) { /* Destination color keys are taken from the source surface! */ - destkeylow = src_surface->DestBltCKey.dwColorSpaceLowValue; - destkeyhigh = src_surface->DestBltCKey.dwColorSpaceHighValue; + destkeylow = src_surface->dst_blt_color_key.color_space_low_value; + destkeyhigh = src_surface->dst_blt_color_key.color_space_high_value; } else if (flags & WINEDDBLT_KEYDESTOVERRIDE) { - destkeylow = fx->ddckDestColorkey.dwColorSpaceLowValue; - destkeyhigh = fx->ddckDestColorkey.dwColorSpaceHighValue; + destkeylow = fx->ddckDestColorkey.color_space_low_value; + destkeyhigh = fx->ddckDestColorkey.color_space_high_value; } if (bpp == 1) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d538178208a..0da0c9f6441 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2041,13 +2041,13 @@ struct wined3d_surface HDC hDC; /* Color keys for DDraw */ - WINEDDCOLORKEY DestBltCKey; - WINEDDCOLORKEY DestOverlayCKey; - WINEDDCOLORKEY SrcOverlayCKey; - WINEDDCOLORKEY SrcBltCKey; + struct wined3d_color_key dst_blt_color_key; + struct wined3d_color_key src_blt_color_key; + struct wined3d_color_key dst_overlay_color_key; + struct wined3d_color_key src_overlay_color_key; DWORD CKeyFlags; - WINEDDCOLORKEY glCKey; + struct wined3d_color_key gl_color_key; struct list renderbuffers; const struct wined3d_renderbuffer_entry *current_renderbuffer; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e26a66f2fd4..ea9f4fbd7eb 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1873,15 +1873,13 @@ typedef struct _WINED3DCAPS WINEDDCAPS DirectDrawCaps; } WINED3DCAPS; -/* DirectDraw types */ - -typedef struct _WINEDDCOLORKEY +struct wined3d_color_key { - DWORD dwColorSpaceLowValue; /* low boundary of color space that is to + DWORD color_space_low_value; /* low boundary of color space that is to * be treated as Color Key, inclusive */ - DWORD dwColorSpaceHighValue; /* high boundary of color space that is + DWORD color_space_high_value; /* high boundary of color space that is * to be treated as Color Key, inclusive */ -} WINEDDCOLORKEY,*LPWINEDDCOLORKEY; +}; typedef struct _WINEDDBLTFX { @@ -1928,8 +1926,8 @@ typedef struct _WINEDDBLTFX DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ struct wined3d_surface *lpDDSPattern; /* Surface to use as pattern */ } DUMMYUNIONNAME5; - WINEDDCOLORKEY ddckDestColorkey; /* DestColorkey override */ - WINEDDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ + struct wined3d_color_key ddckDestColorkey; /* DestColorkey override */ + struct wined3d_color_key ddckSrcColorkey; /* SrcColorkey override */ } WINEDDBLTFX,*LPWINEDDBLTFX; typedef struct _WINEDDOVERLAYFX @@ -1950,8 +1948,8 @@ typedef struct _WINEDDOVERLAYFX DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ } DUMMYUNIONNAME2; - WINEDDCOLORKEY dckDestColorkey; /* DestColorkey override */ - WINEDDCOLORKEY dckSrcColorkey; /* SrcColorkey override */ + struct wined3d_color_key dckDestColorkey; /* DestColorkey override */ + struct wined3d_color_key dckSrcColorkey; /* SrcColorkey override */ DWORD dwDDFX; /* Overlay FX */ DWORD dwFlags; /* flags */ } WINEDDOVERLAYFX; @@ -2366,7 +2364,7 @@ HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC d HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface); HRESULT __cdecl wined3d_surface_set_clipper(struct wined3d_surface *surface, struct wined3d_clipper *clipper); HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface, - DWORD flags, const WINEDDCOLORKEY *color_key); + DWORD flags, const struct wined3d_color_key *color_key); HRESULT __cdecl wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id); HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem); HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); -- 2.11.4.GIT