1
/****************************************************************************
3
* Mesa 3-D graphics library
4
* Direct3D Driver Interface
6
* ========================================================================
8
* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
10
* Permission is hereby granted, free of charge, to any person obtaining a
11
* copy of this software and associated documentation files (the "Software"),
12
* to deal in the Software without restriction, including without limitation
13
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14
* and/or sell copies of the Software, and to permit persons to whom the
15
* Software is furnished to do so, subject to the following conditions:
17
* The above copyright notice and this permission notice shall be included
18
* in all copies or substantial portions of the Software.
20
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23
* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
25
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
* ======================================================================
31
* Environment: Windows 9x (Win32)
33
* Description: Pixel packing functions.
35
****************************************************************************/
45
/*---------------------- Macros and type definitions ----------------------*/
49
// Typedef that can be used for pixel packing function pointers.
50
#define PX_PACK_FUNC(a) void PXAPI (a)(unsigned char *pixdata, void *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2)
51
typedef void (PXAPI *PX_packFunc)(unsigned char *pixdata, void *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2);
53
// Typedef that can be used for pixel unpacking function pointers.
54
#define PX_UNPACK_FUNC(a) void PXAPI (a)(unsigned char *pixdata, void *src, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2)
55
typedef void (PXAPI *PX_unpackFunc)(unsigned char *pixdata, void *src, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2);
57
// Typedef that can be used for pixel span packing function pointers.
58
#define PX_PACK_SPAN_FUNC(a) void PXAPI (a)(GLuint n, unsigned char *pixdata, unsigned char *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2)
59
typedef void (PXAPI *PX_packSpanFunc)(GLuint n, unsigned char *pixdata, unsigned char *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2);
61
/*------------------------- Function Prototypes ---------------------------*/
67
// Function that examines a pixel format and returns the relevent
68
// pixel-packing function
69
void PXAPI pxClassifyPixelFormat(const LPDDPIXELFORMAT lpddpf, PX_packFunc *lpPackFn ,PX_unpackFunc *lpUnpackFn, PX_packSpanFunc *lpPackSpanFn);
72
PX_PACK_FUNC(pxPackGeneric);
73
PX_PACK_FUNC(pxPackRGB555);
74
PX_PACK_FUNC(pxPackARGB4444);
75
PX_PACK_FUNC(pxPackARGB1555);
76
PX_PACK_FUNC(pxPackRGB565);
77
PX_PACK_FUNC(pxPackRGB332);
78
PX_PACK_FUNC(pxPackRGB888);
79
PX_PACK_FUNC(pxPackARGB8888);
80
PX_PACK_FUNC(pxPackPAL8);
82
// Unpacking functions
83
PX_UNPACK_FUNC(pxUnpackGeneric);
84
PX_UNPACK_FUNC(pxUnpackRGB555);
85
PX_UNPACK_FUNC(pxUnpackARGB4444);
86
PX_UNPACK_FUNC(pxUnpackARGB1555);
87
PX_UNPACK_FUNC(pxUnpackRGB565);
88
PX_UNPACK_FUNC(pxUnpackRGB332);
89
PX_UNPACK_FUNC(pxUnpackRGB888);
90
PX_UNPACK_FUNC(pxUnpackARGB8888);
91
PX_UNPACK_FUNC(pxUnpackPAL8);
93
// Span Packing functions
94
PX_PACK_SPAN_FUNC(pxPackSpanGeneric);
95
PX_PACK_SPAN_FUNC(pxPackSpanRGB555);
96
PX_PACK_SPAN_FUNC(pxPackSpanARGB4444);
97
PX_PACK_SPAN_FUNC(pxPackSpanARGB1555);
98
PX_PACK_SPAN_FUNC(pxPackSpanRGB565);
99
PX_PACK_SPAN_FUNC(pxPackSpanRGB332);
100
PX_PACK_SPAN_FUNC(pxPackSpanRGB888);
101
PX_PACK_SPAN_FUNC(pxPackSpanARGB8888);
102
PX_PACK_SPAN_FUNC(pxPackSpanPAL8);