Commit df829de8 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Handle DDBLT_ROP in ddraw.

parent 38e4cb29
......@@ -1518,6 +1518,7 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR
struct ddraw_surface *dst_surface = impl_from_IDirectDrawSurface7(iface);
struct ddraw_surface *src_surface = unsafe_impl_from_IDirectDrawSurface7(SrcSurface);
HRESULT hr = DD_OK;
DDBLTFX rop_fx;
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
iface, wine_dbgstr_rect(DestRect), SrcSurface, wine_dbgstr_rect(SrcRect), Flags, DDBltFx);
......@@ -1583,6 +1584,35 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR
WARN("DDBLT_ROP used with DDBltFx = NULL, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS;
}
Flags &= ~DDBLT_ROP;
switch (DDBltFx->dwROP)
{
case SRCCOPY:
break;
case WHITENESS:
case BLACKNESS:
rop_fx = *DDBltFx;
if (DDBltFx->dwROP == WHITENESS)
rop_fx.u5.dwFillColor = 0xffffffff;
else
rop_fx.u5.dwFillColor = 0;
if (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
Flags |= DDBLT_DEPTHFILL;
else
Flags |= DDBLT_COLORFILL;
DDBltFx = &rop_fx;
break;
default:
wined3d_mutex_unlock();
WARN("Unsupported ROP %#x used, returning DDERR_NORASTEROPHW.\n", DDBltFx->dwROP);
return DDERR_NORASTEROPHW;
}
}
if (Flags & DDBLT_KEYSRC && (!src_surface || !(src_surface->surface_desc.dwFlags & DDSD_CKSRCBLT)))
......
......@@ -8672,6 +8672,31 @@ static void test_color_fill(void)
}
},
};
static const struct
{
DWORD rop;
const char *name;
HRESULT hr;
}
rops[] =
{
{SRCCOPY, "SRCCOPY", DD_OK},
{SRCPAINT, "SRCPAINT", DDERR_NORASTEROPHW},
{SRCAND, "SRCAND", DDERR_NORASTEROPHW},
{SRCINVERT, "SRCINVERT", DDERR_NORASTEROPHW},
{SRCERASE, "SRCERASE", DDERR_NORASTEROPHW},
{NOTSRCCOPY, "NOTSRCCOPY", DDERR_NORASTEROPHW},
{NOTSRCERASE, "NOTSRCERASE", DDERR_NORASTEROPHW},
{MERGECOPY, "MERGECOPY", DDERR_NORASTEROPHW},
{MERGEPAINT, "MERGEPAINT", DDERR_NORASTEROPHW},
{PATCOPY, "PATCOPY", DDERR_NORASTEROPHW},
{PATPAINT, "PATPAINT", DDERR_NORASTEROPHW},
{PATINVERT, "PATINVERT", DDERR_NORASTEROPHW},
{DSTINVERT, "DSTINVERT", DDERR_NORASTEROPHW},
{BLACKNESS, "BLACKNESS", DD_OK},
{WHITENESS, "WHITENESS", DD_OK},
{0xaa0029, "0xaa0029", DDERR_NORASTEROPHW} /* noop */
};
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
......@@ -8926,6 +8951,13 @@ static void test_color_fill(void)
hr = IDirectDrawSurface7_Blt(surface, &rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ROP | DDBLT_WAIT, &fx);
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < sizeof(rops) / sizeof(*rops); i++)
{
fx.dwROP = rops[i].rop;
hr = IDirectDrawSurface7_Blt(surface, NULL, surface2, NULL, DDBLT_ROP | DDBLT_WAIT, &fx);
ok(hr == rops[i].hr, "Got unexpected hr %#x for rop %s.\n", hr, rops[i].name);
}
IDirectDrawSurface7_Release(surface2);
IDirectDrawSurface7_Release(surface);
......
......@@ -4733,27 +4733,6 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
{
FIXME("DDBLT_DEPTHFILL needs to be implemented!\n");
}
if (flags & WINEDDBLT_ROP)
{
/* Catch some degenerate cases here. */
switch (fx->dwROP)
{
case BLACKNESS:
hr = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, dst_map.row_pitch, 0);
break;
case 0xaa0029: /* No-op */
break;
case WHITENESS:
hr = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, dst_map.row_pitch, ~0U);
break;
case SRCCOPY: /* Well, we do that below? */
break;
default:
FIXME("Unsupported raster op: %08x Pattern: %p\n", fx->dwROP, fx->u5.lpDDSPattern);
goto error;
}
flags &= ~WINEDDBLT_ROP;
}
if (flags & WINEDDBLT_DDROPS)
{
FIXME("\tDdraw Raster Ops: %08x Pattern: %p\n", fx->dwDDROP, fx->u5.lpDDSPattern);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment