Henri Verbeet : wined3d: Pass floating point colors to IWineD3DDeviceImpl_ColorFill().
Alexandre Julliard
julliard at winehq.org
Tue Aug 24 11:09:17 CDT 2010
Module: wine
Branch: master
Commit: 0df144164bea7f555bfba062ffada1780367d348
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0df144164bea7f555bfba062ffada1780367d348
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Aug 23 18:28:09 2010 +0200
wined3d: Pass floating point colors to IWineD3DDeviceImpl_ColorFill().
---
dlls/d3d9/device.c | 13 +++++++++++--
dlls/wined3d/device.c | 19 +++++++++++--------
include/wine/wined3d.idl | 2 +-
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index b9f539e..76e1964 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1007,7 +1007,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface
return hr;
}
-static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) {
+static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface,
+ IDirect3DSurface9 *pSurface, const RECT *pRect, D3DCOLOR color)
+{
+ const WINED3DCOLORVALUE c =
+ {
+ ((color >> 16) & 0xff) / 255.0f,
+ ((color >> 8) & 0xff) / 255.0f,
+ (color & 0xff) / 255.0f,
+ ((color >> 24) & 0xff) / 255.0f,
+ };
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface;
WINED3DPOOL pool;
@@ -1036,7 +1045,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9EX iface
/* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */
/* Note: D3DRECT is compatible with WINED3DRECT */
- hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, (CONST WINED3DRECT*)pRect, color);
+ hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, (const WINED3DRECT *)pRect, &c);
wined3d_mutex_unlock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e528296..ba77888 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1675,9 +1675,12 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
colorkey.dwColorSpaceLowValue = 0;
colorkey.dwColorSpaceHighValue = 0;
IWineD3DSurface_SetColorKey(This->logo_surface, WINEDDCKEY_SRCBLT, &colorkey);
- } else {
+ }
+ else
+ {
+ const WINED3DCOLORVALUE c = {1.0f, 1.0f, 1.0f, 1.0f};
/* Fill the surface with a white color to show that wined3d is there */
- IWineD3DDevice_ColorFill((IWineD3DDevice *) This, This->logo_surface, NULL, 0xffffffff);
+ IWineD3DDevice_ColorFill((IWineD3DDevice *)This, This->logo_surface, NULL, &c);
}
out:
@@ -5494,14 +5497,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT
}
static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
- IWineD3DSurface *surface, const WINED3DRECT *pRect, WINED3DCOLOR color)
+ IWineD3DSurface *surface, const WINED3DRECT *pRect, const WINED3DCOLORVALUE *color)
{
- const WINED3DCOLORVALUE c = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)};
IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)surface;
WINEDDBLTFX BltFx;
- TRACE("iface %p, surface %p, rect %s, color 0x%08x.\n",
- iface, surface, wine_dbgstr_rect((const RECT *)pRect), color);
+ TRACE("iface %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
+ iface, surface, wine_dbgstr_rect((const RECT *)pRect),
+ color->r, color->g, color->b, color->a);
if (s->resource.pool != WINED3DPOOL_DEFAULT && s->resource.pool != WINED3DPOOL_SYSTEMMEM)
{
@@ -5514,14 +5517,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
const RECT draw_rect = {0, 0, s->currentDesc.Width, s->currentDesc.Height};
return device_clear_render_targets((IWineD3DDeviceImpl *)iface, 1, &s,
- !!pRect, (const RECT *)pRect, &draw_rect, WINED3DCLEAR_TARGET, &c, 0.0f, 0);
+ !!pRect, (const RECT *)pRect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
}
else
{
/* Just forward this to the DirectDraw blitting engine */
memset(&BltFx, 0, sizeof(BltFx));
BltFx.dwSize = sizeof(BltFx);
- BltFx.u5.dwFillColor = wined3d_format_convert_from_float(s->resource.format_desc, &c);
+ BltFx.u5.dwFillColor = wined3d_format_convert_from_float(s->resource.format_desc, color);
return IWineD3DSurface_Blt(surface, (const RECT *)pRect, NULL, NULL,
WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
}
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index ea2f855..853c2d7 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -3376,7 +3376,7 @@ interface IWineD3DDevice : IWineD3DBase
HRESULT ColorFill(
[in] IWineD3DSurface *surface,
[in] const WINED3DRECT *rect,
- [in] WINED3DCOLOR color
+ [in] const WINED3DCOLORVALUE *color
);
HRESULT UpdateTexture(
[in] IWineD3DBaseTexture *src_texture,
More information about the wine-cvs
mailing list