[APPHELP][APPHELP_APITEST] Update db apitests to succeed from 2k3 to 10, paving the...
[reactos.git] / reactos / dll / 3rdparty / dxtn / wrapper.c
1 /*
2 * Texture compression
3 * Version: 1.0
4 *
5 * Copyright (C) 2004 Daniel Borca All Rights Reserved.
6 *
7 * this is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * this is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Make; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22
23 #include <assert.h>
24
25 #include "types.h"
26 #include "internal.h"
27 #include "dxtn.h"
28
29
30 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
31 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
32 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
33 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
34
35
36 TAPI void TAPIENTRY
37 fetch_2d_texel_rgb_dxt1 (int texImage_RowStride,
38 const byte *texImage_Data,
39 int i, int j,
40 byte *texel)
41 {
42 dxt1_rgb_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
43 }
44
45
46 TAPI void TAPIENTRY
47 fetch_2d_texel_rgba_dxt1 (int texImage_RowStride,
48 const byte *texImage_Data,
49 int i, int j,
50 byte *texel)
51 {
52 dxt1_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
53 }
54
55
56 TAPI void TAPIENTRY
57 fetch_2d_texel_rgba_dxt3 (int texImage_RowStride,
58 const byte *texImage_Data,
59 int i, int j,
60 byte *texel)
61 {
62 dxt3_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
63 }
64
65
66 TAPI void TAPIENTRY
67 fetch_2d_texel_rgba_dxt5 (int texImage_RowStride,
68 const byte *texImage_Data,
69 int i, int j,
70 byte *texel)
71 {
72 dxt5_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
73 }
74
75
76 TAPI void TAPIENTRY
77 tx_compress_dxtn (int srccomps, int width, int height,
78 const byte *source, int destformat, byte *dest,
79 int destRowStride)
80 {
81 int srcRowStride = width * srccomps;
82 int rv;
83
84 switch (destformat) {
85 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
86 rv = dxt1_rgb_encode(width, height, srccomps,
87 source, srcRowStride,
88 dest, destRowStride);
89 break;
90 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
91 rv = dxt1_rgba_encode(width, height, srccomps,
92 source, srcRowStride,
93 dest, destRowStride);
94 break;
95 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
96 rv = dxt3_rgba_encode(width, height, srccomps,
97 source, srcRowStride,
98 dest, destRowStride);
99 break;
100 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
101 rv = dxt5_rgba_encode(width, height, srccomps,
102 source, srcRowStride,
103 dest, destRowStride);
104 break;
105 default:
106 assert(0);
107 }
108
109 /*return rv;*/
110 }