Added 'blt' and 'bltfast' override functions.
This commit is contained in:
parent
ce3d96889f
commit
6fb7ed8fa7
|
@ -1685,14 +1685,16 @@ static HRESULT d3ddevice_clear(IDirect3DDeviceImpl *This,
|
|||
|
||||
TRACE("(%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
|
||||
if (TRACE_ON(ddraw)) {
|
||||
int i;
|
||||
TRACE(" rectangles : \n");
|
||||
for (i = 0; i < dwCount; i++) {
|
||||
TRACE(" - %ld x %ld %ld x %ld\n", lpRects[i].u1.x1, lpRects[i].u2.y1, lpRects[i].u3.x2, lpRects[i].u4.y2);
|
||||
if (dwCount > 0) {
|
||||
int i;
|
||||
TRACE(" rectangles : \n");
|
||||
for (i = 0; i < dwCount; i++) {
|
||||
TRACE(" - %ld x %ld %ld x %ld\n", lpRects[i].u1.x1, lpRects[i].u2.y1, lpRects[i].u3.x2, lpRects[i].u4.y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwCount != 1) {
|
||||
if (dwCount > 1) {
|
||||
WARN(" Warning, this function only for now clears the whole screen...\n");
|
||||
}
|
||||
|
||||
|
@ -1745,6 +1747,29 @@ static HRESULT d3ddevice_clear(IDirect3DDeviceImpl *This,
|
|||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
d3ddevice_blt(IDirectDrawSurfaceImpl *This, LPRECT rdst,
|
||||
LPDIRECTDRAWSURFACE7 src, LPRECT rsrc,
|
||||
DWORD dwFlags, LPDDBLTFX lpbltfx)
|
||||
{
|
||||
if (dwFlags & DDBLT_COLORFILL) {
|
||||
/* This is easy to handle for the D3D Device... */
|
||||
DWORD color = lpbltfx->u5.dwFillColor;
|
||||
TRACE(" executing D3D Device override.\n");
|
||||
d3ddevice_clear(This->d3ddevice, 0, NULL, D3DCLEAR_TARGET, color, 0.0, 0x00000000);
|
||||
return DD_OK;
|
||||
}
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
d3ddevice_bltfast(IDirectDrawSurfaceImpl *This, DWORD dstx,
|
||||
DWORD dsty, LPDIRECTDRAWSURFACE7 src,
|
||||
LPRECT rsrc, DWORD trans)
|
||||
{
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
|
||||
/* TODO for both these functions :
|
||||
- change / restore OpenGL parameters for pictures transfers in case they are ever modified
|
||||
|
@ -1916,6 +1941,9 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
|
|||
/* Override the Lock / Unlock function for all these surfaces */
|
||||
surf->lock_update = d3ddevice_lock_update;
|
||||
surf->unlock_update = d3ddevice_unlock_update;
|
||||
/* And install also the blt / bltfast overrides */
|
||||
surf->aux_blt = d3ddevice_blt;
|
||||
surf->aux_bltfast = d3ddevice_bltfast;
|
||||
}
|
||||
surf->d3ddevice = object;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ static void snoop_texture(IDirectDrawSurfaceImpl *This) {
|
|||
/*******************************************************************************
|
||||
* IDirectSurface callback methods
|
||||
*/
|
||||
HRESULT WINAPI gltex_setcolorkey_cb(IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey )
|
||||
HRESULT gltex_setcolorkey_cb(IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey )
|
||||
{
|
||||
DDSURFACEDESC *tex_d;
|
||||
GLuint current_texture;
|
||||
|
@ -689,7 +689,7 @@ HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOL
|
|||
surf->lock_update = gltex_lock_update;
|
||||
surf->unlock_update = gltex_unlock_update;
|
||||
surf->tex_private = private;
|
||||
surf->SetColorKey_cb = gltex_setcolorkey_cb;
|
||||
surf->aux_setcolorkey_cb = gltex_setcolorkey_cb;
|
||||
|
||||
ENTER_GL();
|
||||
if (surf->mipmap_level == 0) {
|
||||
|
|
|
@ -294,7 +294,9 @@ struct IDirectDrawSurfaceImpl
|
|||
void (*aux_release)(LPVOID ctx, LPVOID data);
|
||||
BOOL (*aux_flip)(LPVOID ctx, LPVOID data);
|
||||
void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect);
|
||||
HRESULT (WINAPI *SetColorKey_cb)(struct IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
|
||||
HRESULT (*aux_blt)(struct IDirectDrawSurfaceImpl *This, LPRECT rdst, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx);
|
||||
HRESULT (*aux_bltfast)(struct IDirectDrawSurfaceImpl *This, DWORD dstx, DWORD dsty, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD trans);
|
||||
HRESULT (*aux_setcolorkey_cb)(struct IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey );
|
||||
/* This is to get the D3DDevice object associated to this surface */
|
||||
struct IDirect3DDeviceImpl *d3ddevice;
|
||||
/* This is for texture */
|
||||
|
|
|
@ -365,6 +365,11 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
|
|||
}
|
||||
}
|
||||
|
||||
/* First, check if the possible override function handles this case */
|
||||
if (This->aux_blt != NULL) {
|
||||
if (This->aux_blt(This, rdst, src, rsrc, dwFlags, lpbltfx) == DD_OK) return DD_OK;
|
||||
}
|
||||
|
||||
DD_STRUCT_INIT(&ddesc);
|
||||
DD_STRUCT_INIT(&sdesc);
|
||||
|
||||
|
@ -814,6 +819,11 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
FIXME(" srcrect: NULL\n");
|
||||
}
|
||||
|
||||
/* First, check if the possible override function handles this case */
|
||||
if (This->aux_bltfast != NULL) {
|
||||
if (This->aux_bltfast(This, dstx, dsty, src, rsrc, trans) == DD_OK) return DD_OK;
|
||||
}
|
||||
|
||||
/* We need to lock the surfaces, or we won't get refreshes when done. */
|
||||
sdesc.dwSize = sizeof(sdesc);
|
||||
IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0);
|
||||
|
|
Loading…
Reference in New Issue