wined3d: Pass floating point colors to IWineD3DDeviceImpl_ColorFill().

This commit is contained in:
Henri Verbeet 2010-08-23 18:28:09 +02:00 committed by Alexandre Julliard
parent 50b5955288
commit 0df144164b
3 changed files with 23 additions and 11 deletions

View File

@ -1007,7 +1007,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface
return hr; 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; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface; IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface;
WINED3DPOOL pool; 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 */ /* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */
/* Note: D3DRECT is compatible with WINED3DRECT */ /* 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(); wined3d_mutex_unlock();

View File

@ -1675,9 +1675,12 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
colorkey.dwColorSpaceLowValue = 0; colorkey.dwColorSpaceLowValue = 0;
colorkey.dwColorSpaceHighValue = 0; colorkey.dwColorSpaceHighValue = 0;
IWineD3DSurface_SetColorKey(This->logo_surface, WINEDDCKEY_SRCBLT, &colorkey); 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 */ /* 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: out:
@ -5494,14 +5497,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT
} }
static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, 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; IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)surface;
WINEDDBLTFX BltFx; WINEDDBLTFX BltFx;
TRACE("iface %p, surface %p, rect %s, color 0x%08x.\n", TRACE("iface %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
iface, surface, wine_dbgstr_rect((const RECT *)pRect), color); 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) 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}; const RECT draw_rect = {0, 0, s->currentDesc.Width, s->currentDesc.Height};
return device_clear_render_targets((IWineD3DDeviceImpl *)iface, 1, &s, 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 else
{ {
/* Just forward this to the DirectDraw blitting engine */ /* Just forward this to the DirectDraw blitting engine */
memset(&BltFx, 0, sizeof(BltFx)); memset(&BltFx, 0, sizeof(BltFx));
BltFx.dwSize = 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, return IWineD3DSurface_Blt(surface, (const RECT *)pRect, NULL, NULL,
WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT); WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
} }

View File

@ -3376,7 +3376,7 @@ interface IWineD3DDevice : IWineD3DBase
HRESULT ColorFill( HRESULT ColorFill(
[in] IWineD3DSurface *surface, [in] IWineD3DSurface *surface,
[in] const WINED3DRECT *rect, [in] const WINED3DRECT *rect,
[in] WINED3DCOLOR color [in] const WINED3DCOLORVALUE *color
); );
HRESULT UpdateTexture( HRESULT UpdateTexture(
[in] IWineD3DBaseTexture *src_texture, [in] IWineD3DBaseTexture *src_texture,