2000-04-09 16:30:50 +02:00
|
|
|
/* DirectDrawPalette XF86DGA implementation
|
|
|
|
*
|
|
|
|
* Copyright 1997-2000 Marcus Meissner
|
|
|
|
* Copyright 1998 Lionel Ulmer (most of Direct3D stuff)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "debugtools.h"
|
|
|
|
|
|
|
|
#include "dga_private.h"
|
|
|
|
|
|
|
|
DEFAULT_DEBUG_CHANNEL(ddraw);
|
|
|
|
|
|
|
|
#define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private)
|
2000-07-23 15:39:52 +02:00
|
|
|
#define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->d->private)
|
2000-04-09 16:30:50 +02:00
|
|
|
|
|
|
|
HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries(
|
|
|
|
LPDIRECTDRAWPALETTE iface,DWORD x,DWORD start,DWORD count,LPPALETTEENTRY palent
|
|
|
|
) {
|
|
|
|
ICOM_THIS(IDirectDrawPaletteImpl,iface);
|
|
|
|
DPPRIVATE(This);
|
2000-04-13 17:59:22 +02:00
|
|
|
DDPRIVATE(This->ddraw);
|
2000-04-09 16:30:50 +02:00
|
|
|
XColor xc;
|
|
|
|
Colormap cm;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,x,start,count,palent);
|
|
|
|
if (!dppriv->cm) /* should not happen */ {
|
|
|
|
FIXME("app tried to set colormap in non-palettized mode\n");
|
|
|
|
return DDERR_GENERIC;
|
|
|
|
}
|
|
|
|
/* FIXME: free colorcells instead of freeing whole map */
|
|
|
|
cm = dppriv->cm;
|
|
|
|
dppriv->cm = TSXCopyColormapAndFree(display,dppriv->cm);
|
|
|
|
TSXFreeColormap(display,cm);
|
|
|
|
|
|
|
|
for (i=0;i<count;i++) {
|
|
|
|
xc.red = palent[i].peRed<<8;
|
|
|
|
xc.blue = palent[i].peBlue<<8;
|
|
|
|
xc.green = palent[i].peGreen<<8;
|
|
|
|
xc.flags = DoRed|DoBlue|DoGreen;
|
|
|
|
xc.pixel = i+start;
|
|
|
|
|
|
|
|
TSXStoreColor(display,dppriv->cm,&xc);
|
|
|
|
|
|
|
|
This->palents[start+i].peRed = palent[i].peRed;
|
|
|
|
This->palents[start+i].peBlue = palent[i].peBlue;
|
|
|
|
This->palents[start+i].peGreen = palent[i].peGreen;
|
|
|
|
This->palents[start+i].peFlags = palent[i].peFlags;
|
|
|
|
}
|
2000-05-01 16:25:49 +02:00
|
|
|
ddpriv->InstallColormap(display,DefaultScreen(display),dppriv->cm);
|
2000-06-10 06:24:41 +02:00
|
|
|
TSXFlush(display);
|
2000-04-09 16:30:50 +02:00
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
IDirectDrawPaletteImpl_QueryInterface,
|
|
|
|
IDirectDrawPaletteImpl_AddRef,
|
|
|
|
Xlib_IDirectDrawPaletteImpl_Release,
|
|
|
|
IDirectDrawPaletteImpl_GetCaps,
|
|
|
|
IDirectDrawPaletteImpl_GetEntries,
|
|
|
|
IDirectDrawPaletteImpl_Initialize,
|
|
|
|
DGA_IDirectDrawPaletteImpl_SetEntries
|
|
|
|
};
|