source: trunk/src/ddraw/OS2PALSET.CPP@ 503

Last change on this file since 503 was 503, checked in by hugh, 26 years ago

Changed to use ODINCRT macros to preserve FS, but still does crash

File size: 1.8 KB
Line 
1#define INCL_GREALL
2#define INCL_GPI
3#include <os2wrap.h>
4#include <pmddi.h>
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include "os2palset.h"
9#include <odincrt.h>
10//******************************************************************************
11//******************************************************************************
12void OS2SetPhysPalette(void *pal)
13{
14 PALETTEENTRY *pDirectXPal = (PALETTEENTRY *)pal;
15 HPS hps;
16 HDC hdc;
17 RGB2 os2rgb[256];
18 int i;
19
20 ODIN_FS_BEGIN
21
22 hps = WinGetPS(HWND_DESKTOP);
23 hdc = GpiQueryDevice(hps);
24
25 for(i=0;i<256;i++)
26 {
27 os2rgb[i].bBlue = pDirectXPal[i].peBlue;
28 os2rgb[i].bGreen = pDirectXPal[i].peGreen;
29 os2rgb[i].bRed = pDirectXPal[i].peRed;
30 os2rgb[i].fcOptions = 0;
31 }
32
33 GpiCreateLogColorTable( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
34 LCOLF_CONSECRGB,
35 0,
36 256,
37 (PLONG)&os2rgb);
38 Gre32Entry3( hdc,
39 0L,
40 0x000060C6L);
41
42 WinInvalidateRect( HWND_DESKTOP,
43 (PRECTL)NULL,
44 TRUE);
45 WinReleasePS(hps);
46
47 ODIN_FS_END
48
49}
50//******************************************************************************
51//******************************************************************************
52void OS2ResetPhysPalette()
53{
54 HPS hps;
55 HDC hdc;
56
57 ODIN_FS_BEGIN
58
59 hps = WinGetPS( HWND_DESKTOP);
60
61 hdc = GpiQueryDevice( hps);
62
63 Gre32Entry3( hdc,
64 0L,
65 0x000060C7L);
66
67 WinInvalidateRect( HWND_DESKTOP,
68 (PRECTL)NULL,
69 TRUE);
70
71 WinReleasePS(hps);
72
73 ODIN_FS_END
74
75}
76//******************************************************************************
77//******************************************************************************
Note: See TracBrowser for help on using the repository browser.