1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 10:07:47 +01:00

try to use a single memcpy if possible - adds stretching support (not used in C&C games though)

This commit is contained in:
FunkyFr3sh 2018-07-03 20:54:05 +02:00
parent 897fdb5bbb
commit ff7267d044
2 changed files with 45 additions and 23 deletions

View File

@ -2,7 +2,7 @@
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
#define str(s) #s
#define VERSION 1,1,7,3
#define VERSION 1,1,7,4
1 VERSIONINFO
FILEVERSION VERSION

View File

@ -103,6 +103,26 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
#endif
if(Source)
{
//BitBlt(This->hDC, lpDestRect->left, lpDestRect->top, lpDestRect->right, lpDestRect->bottom,
// Source->hDC, lpSrcRect->left, lpSrcRect->top, SRCCOPY);
int dst_w = lpDestRect->right - lpDestRect->left;
int dst_h = lpDestRect->bottom - lpDestRect->top;
int src_w = lpSrcRect->right - lpSrcRect->left;
int src_h = lpSrcRect->bottom - lpSrcRect->top;
if (dst_w != src_w || dst_h != src_h)
{
StretchBlt(This->hDC, lpDestRect->left, lpDestRect->top, lpDestRect->right, lpDestRect->bottom,
Source->hDC, lpSrcRect->left, lpSrcRect->top, lpSrcRect->right, lpSrcRect->bottom, SRCCOPY);
}
else if (dst_w == This->width && dst_h == This->height &&
src_w == Source->width && src_h == Source->height)
{
memcpy(This->surface, Source->surface, This->width * This->height * This->lXPitch);
}
else
{
int dx=0,dy=0;
if (lpDestRect)
@ -129,6 +149,8 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
}
}
}
if(This->caps & DDSCAPS_PRIMARYSURFACE && !(This->flags & DDSD_BACKBUFFERCOUNT) && ddraw->render.run)
{
ReleaseSemaphore(ddraw->render.sem, 1, NULL);