source: trunk/src/ddraw/os2palset.cpp@ 21916

Last change on this file since 21916 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 2.2 KB
Line 
1/* $Id: OS2PALSET.CPP,v 1.11 2001-04-03 20:57:24 sandervl Exp $ */
2
3/*
4 * Functions used to Set the Physical Palette in OS/2 when in 8 Bit mode
5 *
6 * Copyright 1998 Sander va Leeuwen
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11#define INCL_GREALL
12#define INCL_GPI
13#include <os2wrap.h>
14#include <pmddi.h>
15#include <stdio.h>
16#include <stdlib.h>
17#include <string.h>
18#include "os2palset.h"
19
20static BOOL fPhysPaletteChanged = FALSE;
21//******************************************************************************
22//******************************************************************************
23void OS2SetPhysPalette(void *pal)
24{
25 PALETTEENTRY *pDirectXPal = (PALETTEENTRY *)pal;
26 HPS hps;
27 HDC hdc;
28 RGB2 os2rgb[256];
29 int i;
30
31 USHORT sel = RestoreOS2FS();
32
33 fPhysPaletteChanged = TRUE;
34
35 hps = WinGetPS(HWND_DESKTOP);
36 hdc = GpiQueryDevice(hps);
37
38 for(i=0;i<256;i++)
39 {
40 os2rgb[i].bBlue = pDirectXPal[i].peBlue;
41 os2rgb[i].bGreen = pDirectXPal[i].peGreen;
42 os2rgb[i].bRed = pDirectXPal[i].peRed;
43 os2rgb[i].fcOptions = 0;
44 }
45
46 GpiCreateLogColorTable( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
47 LCOLF_CONSECRGB,
48 0,
49 256,
50 (PLONG)&os2rgb[0]);
51 Gre32Entry3( hdc,
52 0L,
53 0x000060C6L);
54
55 WinInvalidateRect( HWND_DESKTOP,
56 (PRECTL)NULL,
57 TRUE);
58 WinReleasePS(hps);
59
60 SetFS(sel);
61
62}
63
64//******************************************************************************
65//******************************************************************************
66void OS2ResetPhysPalette()
67{
68 HPS hps;
69 HDC hdc;
70
71 if(!fPhysPaletteChanged) {
72 return; //not necessary
73 }
74 USHORT sel = RestoreOS2FS();
75
76 hps = WinGetPS( HWND_DESKTOP);
77
78 hdc = GpiQueryDevice( hps);
79
80 Gre32Entry3( hdc,
81 0L,
82 0x000060C7L);
83
84 WinInvalidateRect( HWND_DESKTOP,
85 (PRECTL)NULL,
86 TRUE);
87
88 WinReleasePS(hps);
89
90 SetFS(sel);
91
92}
93//******************************************************************************
94//******************************************************************************
Note: See TracBrowser for help on using the repository browser.