mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
add (commented out) clipper support to dds_blt
This commit is contained in:
parent
2ddc0b5ceb
commit
11801618df
@ -7,6 +7,8 @@
|
||||
#include "IDirectDrawSurface.h"
|
||||
#include "IDirectDraw.h"
|
||||
|
||||
#define DDBLT_NO_CLIP (1 << 31)
|
||||
|
||||
/* enables redraw via blt/unlock if there wasn't any flip for X ms */
|
||||
#define FLIP_REDRAW_TIMEOUT 1000 / 10
|
||||
|
||||
|
@ -20,8 +20,8 @@ HRESULT dds_AddAttachedSurface(IDirectDrawSurfaceImpl* This, IDirectDrawSurfaceI
|
||||
|
||||
if (!This->backbuffer)
|
||||
{
|
||||
lpDDSurface->caps |= DDSCAPS_BACKBUFFER;
|
||||
This->backbuffer = lpDDSurface;
|
||||
lpDDSurface->caps |= DDSCAPS_BACKBUFFER;
|
||||
This->backbuffer = lpDDSurface;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,6 +140,45 @@ HRESULT dds_Blt(
|
||||
BOOL mirror_left_right = got_fx && (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORLEFTRIGHT);
|
||||
BOOL mirror_up_down = got_fx && (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORUPDOWN);
|
||||
|
||||
/* keep this commented out until tested and confirmed working
|
||||
if (This->clipper && !(dwFlags & DDBLT_NO_CLIP))
|
||||
{
|
||||
DWORD size = 0;
|
||||
|
||||
if (SUCCEEDED(IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, NULL, &size)) && size > 0)
|
||||
{
|
||||
RGNDATA* list = (RGNDATA*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
|
||||
if (list)
|
||||
{
|
||||
if (SUCCEEDED(IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, list, &size)))
|
||||
{
|
||||
float scale_w = (float)src_w / dst_w;
|
||||
float scale_h = (float)src_h / dst_h;
|
||||
|
||||
RECT* dst_c_rect = (RECT*)list->Buffer;
|
||||
|
||||
for (int i = 0; i < list->rdh.nCount; ++i)
|
||||
{
|
||||
RECT src_c_rect = src_rect;
|
||||
|
||||
src_c_rect.left += (LONG)((dst_c_rect[i].left - dst_rect.left) * scale_w);
|
||||
src_c_rect.top += (LONG)((dst_c_rect[i].top - dst_rect.top) * scale_h);
|
||||
src_c_rect.right -= (LONG)((dst_rect.right - dst_c_rect[i].right) * scale_w);
|
||||
src_c_rect.bottom -= (LONG)((dst_rect.bottom - dst_c_rect[i].bottom) * scale_h);
|
||||
|
||||
dds_Blt(This, &dst_c_rect[i], src_surface, &src_c_rect, dwFlags | DDBLT_NO_CLIP, lpDDBltFx);
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, list);
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (This->bpp != src_surface->bpp)
|
||||
{
|
||||
TRACE_EXT(" NOT_IMPLEMENTED This->bpp=%u, src_surface->bpp=%u\n", This->bpp, src_surface->bpp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user