1 /* DirectDrawPalette XF86DGA implementation
3 * Copyright 1997-2000 Marcus Meissner
4 * Copyright 1998 Lionel Ulmer (most of Direct3D stuff)
15 #include "debugtools.h"
17 #include "dga_private.h"
19 DEFAULT_DEBUG_CHANNEL(ddraw);
21 #define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private)
22 #define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->private)
24 HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries(
25 LPDIRECTDRAWPALETTE iface,DWORD x,DWORD start,DWORD count,LPPALETTEENTRY palent
27 ICOM_THIS(IDirectDrawPaletteImpl,iface);
29 DDPRIVATE(This->ddraw);
34 TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,x,start,count,palent);
35 if (!dppriv->cm) /* should not happen */ {
36 FIXME("app tried to set colormap in non-palettized mode\n");
39 /* FIXME: free colorcells instead of freeing whole map */
41 dppriv->cm = TSXCopyColormapAndFree(display,dppriv->cm);
42 TSXFreeColormap(display,cm);
44 for (i=0;i<count;i++) {
45 xc.red = palent[i].peRed<<8;
46 xc.blue = palent[i].peBlue<<8;
47 xc.green = palent[i].peGreen<<8;
48 xc.flags = DoRed|DoBlue|DoGreen;
51 TSXStoreColor(display,dppriv->cm,&xc);
53 This->palents[start+i].peRed = palent[i].peRed;
54 This->palents[start+i].peBlue = palent[i].peBlue;
55 This->palents[start+i].peGreen = palent[i].peGreen;
56 This->palents[start+i].peFlags = palent[i].peFlags;
58 ddpriv->InstallColormap(display,DefaultScreen(display),dppriv->cm);
61 ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt =
63 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
64 IDirectDrawPaletteImpl_QueryInterface,
65 IDirectDrawPaletteImpl_AddRef,
66 Xlib_IDirectDrawPaletteImpl_Release,
67 IDirectDrawPaletteImpl_GetCaps,
68 IDirectDrawPaletteImpl_GetEntries,
69 IDirectDrawPaletteImpl_Initialize,
70 DGA_IDirectDrawPaletteImpl_SetEntries