source: trunk/src/ddraw/os2palset.cpp

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

Merge branch gcc-kmk to trunk.

File size: 2.2 KB
RevLine 
[5467]1/* $Id: OS2PALSET.CPP,v 1.11 2001-04-03 20:57:24 sandervl Exp $ */
[2174]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 */
[4]11#define INCL_GREALL
12#define INCL_GPI
[210]13#include <os2wrap.h>
[4]14#include <pmddi.h>
15#include <stdio.h>
16#include <stdlib.h>
17#include <string.h>
[210]18#include "os2palset.h"
[522]19
[5467]20static BOOL fPhysPaletteChanged = FALSE;
[4]21//******************************************************************************
22//******************************************************************************
[210]23void OS2SetPhysPalette(void *pal)
[4]24{
25 PALETTEENTRY *pDirectXPal = (PALETTEENTRY *)pal;
26 HPS hps;
27 HDC hdc;
28 RGB2 os2rgb[256];
29 int i;
30
[3149]31 USHORT sel = RestoreOS2FS();
[503]32
[5467]33 fPhysPaletteChanged = TRUE;
[2174]34
[210]35 hps = WinGetPS(HWND_DESKTOP);
36 hdc = GpiQueryDevice(hps);
37
38 for(i=0;i<256;i++)
39 {
[4]40 os2rgb[i].bBlue = pDirectXPal[i].peBlue;
41 os2rgb[i].bGreen = pDirectXPal[i].peGreen;
42 os2rgb[i].bRed = pDirectXPal[i].peRed;
[210]43 os2rgb[i].fcOptions = 0;
44 }
[4]45
[210]46 GpiCreateLogColorTable( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
47 LCOLF_CONSECRGB,
48 0,
49 256,
[5291]50 (PLONG)&os2rgb[0]);
[210]51 Gre32Entry3( hdc,
52 0L,
53 0x000060C6L);
54
55 WinInvalidateRect( HWND_DESKTOP,
56 (PRECTL)NULL,
57 TRUE);
58 WinReleasePS(hps);
[503]59
[3149]60 SetFS(sel);
[503]61
[3149]62}
[2174]63
[4]64//******************************************************************************
65//******************************************************************************
66void OS2ResetPhysPalette()
67{
68 HPS hps;
69 HDC hdc;
70
[5467]71 if(!fPhysPaletteChanged) {
72 return; //not necessary
73 }
74 USHORT sel = RestoreOS2FS();
[503]75
[210]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);
[503]89
[3149]90 SetFS(sel);
[503]91
[4]92}
93//******************************************************************************
94//******************************************************************************
Note: See TracBrowser for help on using the repository browser.