grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / hidds / graphics / rgbconv.c
bloba9d742de70cb08ba8a43a3025ea95faa9a162c53
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <hidd/graphics.h>
9 #include "colorconv/rgbconv_macros.h"
10 #include "colorconv/rgbconv_rgbswap.h"
12 #include "colorconv/rgbconv_bgra32.h"
13 #include "colorconv/rgbconv_xrgb32.h"
14 #include "colorconv/rgbconv_argb32.h"
15 #include "colorconv/rgbconv_rgba32.h"
16 #include "colorconv/rgbconv_abgr32.h"
17 #include "colorconv/rgbconv_rgb24.h"
18 #include "colorconv/rgbconv_bgr24.h"
19 #include "colorconv/rgbconv_rgb15.h"
20 #include "colorconv/rgbconv_bgr15.h"
21 #include "colorconv/rgbconv_rgb16.h"
22 #include "colorconv/rgbconv_bgr16.h"
23 #include "colorconv/rgbconv_rgb16oe.h"
24 #include "colorconv/rgbconv_bgr16oe.h"
25 #include "colorconv/rgbconv_rgb15oe.h"
26 #include "colorconv/rgbconv_bgr15oe.h"
27 #include "colorconv/rgbconv_bgrx32.h"
28 #include "colorconv/rgbconv_rgbx32.h"
29 #include "colorconv/rgbconv_xbgr32.h"
31 #define SCCF(SRCPIXFMT, DSTPIXFMT) \
32 rgbconvertfuncs[FMT_##SRCPIXFMT - FIRST_RGB_STDPIXFMT][FMT_##DSTPIXFMT - FIRST_RGB_STDPIXFMT] = convert_##SRCPIXFMT##_##DSTPIXFMT##_generic;
34 void SetRGBConversionFunctions(HIDDT_RGBConversionFunction rgbconvertfuncs[NUM_RGB_STDPIXFMT][NUM_RGB_STDPIXFMT])
36 /* ARGB32 to #? */
37 SCCF(ARGB32,RGB16) SCCF(ARGB32,BGR16) SCCF(ARGB32,RGB15) SCCF(ARGB32,BGR15)
38 SCCF(ARGB32,BGRA32) SCCF(ARGB32,RGBA32) SCCF(ARGB32,ABGR32) SCCF(ARGB32,RGB24)
39 SCCF(ARGB32,BGR24) SCCF(ARGB32,RGB16OE) SCCF(ARGB32,BGR16OE) SCCF(ARGB32,RGB15OE)
40 SCCF(ARGB32,BGR15OE) SCCF(ARGB32,XRGB32) SCCF(ARGB32,BGRX32) SCCF(ARGB32,RGBX32)
41 SCCF(ARGB32,XBGR32)
43 /* BGRA32 to #? */
44 SCCF(BGRA32,RGB16) SCCF(BGRA32,BGR16) SCCF(BGRA32,RGB15) SCCF(BGRA32,BGR15)
45 SCCF(BGRA32,ARGB32) SCCF(BGRA32,RGBA32) SCCF(BGRA32,ABGR32) SCCF(BGRA32,RGB24)
46 SCCF(BGRA32,BGR24) SCCF(BGRA32,RGB16OE) SCCF(BGRA32,BGR16OE) SCCF(BGRA32,RGB15OE)
47 SCCF(BGRA32,BGR15OE) SCCF(BGRA32,XRGB32) SCCF(BGRA32,BGRX32) SCCF(BGRA32,RGBX32)
48 SCCF(BGRA32,XBGR32)
50 /* RGBA32 to #? */
51 SCCF(RGBA32,RGB16) SCCF(RGBA32,BGR16) SCCF(RGBA32,RGB15) SCCF(RGBA32,BGR15)
52 SCCF(RGBA32,BGRA32) SCCF(RGBA32,ARGB32) SCCF(RGBA32,ABGR32) SCCF(RGBA32,RGB24)
53 SCCF(RGBA32,BGR24) SCCF(RGBA32,RGB16OE) SCCF(RGBA32,BGR16OE) SCCF(RGBA32,RGB15OE)
54 SCCF(RGBA32,BGR15OE) SCCF(RGBA32,XRGB32) SCCF(RGBA32,BGRX32) SCCF(RGBA32,RGBX32)
55 SCCF(RGBA32,XBGR32)
57 /* ABGR32 to #? */
58 SCCF(ABGR32,RGB16) SCCF(ABGR32,BGR16) SCCF(ABGR32,RGB15) SCCF(ABGR32,BGR15)
59 SCCF(ABGR32,BGRA32) SCCF(ABGR32,ARGB32) SCCF(ABGR32,RGBA32) SCCF(ABGR32,RGB24)
60 SCCF(ABGR32,BGR24) SCCF(ABGR32,RGB16OE) SCCF(ABGR32,BGR16OE) SCCF(ABGR32,RGB15OE)
61 SCCF(ABGR32,BGR15OE) SCCF(ABGR32,XRGB32) SCCF(ABGR32,BGRX32) SCCF(ABGR32,RGBX32)
62 SCCF(ABGR32,XBGR32)
64 /* RGB24 to #? */
65 SCCF(RGB24,RGB16) SCCF(RGB24,BGR16) SCCF(RGB24,RGB15) SCCF(RGB24,BGR15)
66 SCCF(RGB24,ARGB32) SCCF(RGB24,BGRA32) SCCF(RGB24,RGBA32) SCCF(RGB24,ABGR32)
67 SCCF(RGB24,BGR24) SCCF(RGB24,RGB16OE) SCCF(RGB24,BGR16OE) SCCF(RGB24,RGB15OE)
68 SCCF(RGB24,BGR15OE) SCCF(RGB24,XRGB32) SCCF(RGB24,BGRX32) SCCF(RGB24,RGBX32)
69 SCCF(RGB24,XBGR32)
71 /* BGR24 to #? */
72 SCCF(BGR24,RGB16) SCCF(BGR24,BGR16) SCCF(BGR24,RGB15) SCCF(BGR24,BGR15)
73 SCCF(BGR24,ARGB32) SCCF(BGR24,BGRA32) SCCF(BGR24,RGBA32) SCCF(BGR24,ABGR32)
74 SCCF(BGR24,RGB24) SCCF(BGR24,RGB16OE) SCCF(BGR24,BGR16OE) SCCF(BGR24,RGB15OE)
75 SCCF(BGR24,BGR15OE) SCCF(BGR24,XRGB32) SCCF(BGR24,BGRX32) SCCF(BGR24,RGBX32)
76 SCCF(BGR24,XBGR32)
78 /* RGB15 to #? */
79 SCCF(RGB15,RGB16) SCCF(RGB15,BGR16) SCCF(RGB15,BGR15) SCCF(RGB15,ARGB32)
80 SCCF(RGB15,BGRA32) SCCF(RGB15,RGBA32) SCCF(RGB15,ABGR32) SCCF(RGB15,RGB24)
81 SCCF(RGB15,BGR24) SCCF(RGB15,RGB16OE) SCCF(RGB15,RGB15OE) SCCF(RGB15,BGR16OE)
82 SCCF(RGB15,BGR15OE) SCCF(RGB15,XRGB32) SCCF(RGB15,BGRX32) SCCF(RGB15,RGBX32)
83 SCCF(RGB15,XBGR32)
85 /* BGR15 to #? */
86 SCCF(BGR15,RGB16) SCCF(BGR15,BGR16) SCCF(BGR15,RGB15) SCCF(BGR15,ARGB32)
87 SCCF(BGR15,BGRA32) SCCF(BGR15,RGBA32) SCCF(BGR15,ABGR32) SCCF(BGR15,RGB24)
88 SCCF(BGR15,BGR24) SCCF(BGR15,RGB16OE) SCCF(BGR15,RGB15OE) SCCF(BGR15,BGR16OE)
89 SCCF(BGR15,BGR15OE) SCCF(BGR15,XRGB32) SCCF(BGR15,BGRX32) SCCF(BGR15,RGBX32)
90 SCCF(BGR15,XBGR32)
92 /* RGB16 to #? */
93 SCCF(RGB16,RGB15) SCCF(RGB16,BGR16) SCCF(RGB16,BGR15) SCCF(RGB16,ARGB32)
94 SCCF(RGB16,BGRA32) SCCF(RGB16,RGBA32) SCCF(RGB16,ABGR32) SCCF(RGB16,RGB24)
95 SCCF(RGB16,BGR24) SCCF(RGB16,RGB16OE) SCCF(RGB16,RGB15OE) SCCF(RGB16,BGR16OE)
96 SCCF(RGB16,BGR15OE) SCCF(RGB16,XRGB32) SCCF(RGB16,BGRX32) SCCF(RGB16,RGBX32)
97 SCCF(RGB16,XBGR32)
99 /* BGR16 to #? */
100 SCCF(BGR16,RGB15) SCCF(BGR16,RGB16) SCCF(BGR16,BGR15) SCCF(BGR16,ARGB32)
101 SCCF(BGR16,BGRA32) SCCF(BGR16,RGBA32) SCCF(BGR16,ABGR32) SCCF(BGR16,RGB24)
102 SCCF(BGR16,BGR24) SCCF(BGR16,RGB16OE) SCCF(BGR16,RGB15OE) SCCF(BGR16,BGR16OE)
103 SCCF(BGR16,BGR15OE) SCCF(BGR16,XRGB32) SCCF(BGR16,BGRX32) SCCF(BGR16,RGBX32)
104 SCCF(BGR16,XBGR32)
106 /* RGB16OE to #? */
107 SCCF(RGB16OE,RGB16) SCCF(RGB16OE,RGB15) SCCF(RGB16OE,BGR16) SCCF(RGB16OE,BGR15)
108 SCCF(RGB16OE,ARGB32) SCCF(RGB16OE,BGRA32) SCCF(RGB16OE,RGBA32) SCCF(RGB16OE,ABGR32)
109 SCCF(RGB16OE,RGB24) SCCF(RGB16OE,BGR24) SCCF(RGB16OE,RGB15OE) SCCF(RGB16OE,BGR16OE)
110 SCCF(RGB16OE,BGR15OE) SCCF(RGB16OE,XRGB32) SCCF(RGB16OE,BGRX32) SCCF(RGB16OE,RGBX32)
111 SCCF(RGB16OE,XBGR32)
113 /* BGR16OE to #? */
114 SCCF(BGR16OE,RGB16) SCCF(BGR16OE,RGB15) SCCF(BGR16OE,BGR16) SCCF(BGR16OE,BGR15)
115 SCCF(BGR16OE,ARGB32) SCCF(BGR16OE,BGRA32) SCCF(BGR16OE,RGBA32) SCCF(BGR16OE,ABGR32)
116 SCCF(BGR16OE,RGB24) SCCF(BGR16OE,BGR24) SCCF(BGR16OE,RGB15OE) SCCF(BGR16OE,RGB16OE)
117 SCCF(BGR16OE,BGR15OE) SCCF(BGR16OE,XRGB32) SCCF(BGR16OE,BGRX32) SCCF(BGR16OE,RGBX32)
118 SCCF(BGR16OE,XBGR32)
120 /* RGB15OE to #? */
121 SCCF(RGB15OE,RGB16) SCCF(RGB15OE,RGB15) SCCF(RGB15OE,BGR16) SCCF(RGB15OE,BGR15)
122 SCCF(RGB15OE,ARGB32) SCCF(RGB15OE,BGRA32) SCCF(RGB15OE,RGBA32) SCCF(RGB15OE,ABGR32)
123 SCCF(RGB15OE,RGB24) SCCF(RGB15OE,BGR24) SCCF(RGB15OE,RGB16OE) SCCF(RGB15OE,BGR16OE)
124 SCCF(RGB15OE,BGR15OE) SCCF(RGB15OE,XRGB32) SCCF(RGB15OE,BGRX32) SCCF(RGB15OE,RGBX32)
125 SCCF(RGB15OE,XBGR32)
127 /* BGR15OE to #? */
128 SCCF(BGR15OE,RGB16) SCCF(BGR15OE,RGB15) SCCF(BGR15OE,BGR16) SCCF(BGR15OE,BGR15)
129 SCCF(BGR15OE,ARGB32) SCCF(BGR15OE,BGRA32) SCCF(BGR15OE,RGBA32) SCCF(BGR15OE,ABGR32)
130 SCCF(BGR15OE,RGB24) SCCF(BGR15OE,BGR24) SCCF(BGR15OE,RGB16OE) SCCF(BGR15OE,BGR16OE)
131 SCCF(BGR15OE,RGB15OE) SCCF(BGR15OE,XRGB32) SCCF(BGR15OE,BGRX32) SCCF(BGR15OE,RGBX32)
132 SCCF(BGR15OE,XBGR32)
134 /* XRGB32 to #? */
135 SCCF(XRGB32,RGB16) SCCF(XRGB32,BGR16) SCCF(XRGB32,RGB15) SCCF(XRGB32,BGR15)
136 SCCF(XRGB32,ARGB32) SCCF(XRGB32,BGRA32) SCCF(XRGB32,RGBA32) SCCF(XRGB32,ABGR32)
137 SCCF(XRGB32,RGB24) SCCF(XRGB32,BGR24) SCCF(XRGB32,RGB16OE) SCCF(XRGB32,BGR16OE)
138 SCCF(XRGB32,RGB15OE) SCCF(XRGB32,BGR15OE) SCCF(XRGB32,BGRX32) SCCF(XRGB32,RGBX32)
139 SCCF(XRGB32,XBGR32)
141 /* BGRX32 to #? */
142 SCCF(BGRX32,RGB16) SCCF(BGRX32,BGR16) SCCF(BGRX32,RGB15) SCCF(BGRX32,BGR15)
143 SCCF(BGRX32,ARGB32) SCCF(BGRX32,BGRA32) SCCF(BGRX32,RGBA32) SCCF(BGRX32,ABGR32)
144 SCCF(BGRX32,RGB24) SCCF(BGRX32,BGR24) SCCF(BGRX32,RGB16OE) SCCF(BGRX32,BGR16OE)
145 SCCF(BGRX32,RGB15OE) SCCF(BGRX32,BGR15OE) SCCF(BGRX32,XRGB32) SCCF(BGRX32,RGBX32)
146 SCCF(BGRX32,XBGR32)
148 /* RGBX32 to #? */
149 SCCF(RGBX32,RGB16) SCCF(RGBX32,BGR16) SCCF(RGBX32,RGB15) SCCF(RGBX32,BGR15)
150 SCCF(RGBX32,BGRA32) SCCF(RGBX32,ARGB32) SCCF(RGBX32,ABGR32) SCCF(RGBX32,RGBA32)
151 SCCF(RGBX32,RGB24) SCCF(RGBX32,BGR24) SCCF(RGBX32,RGB16OE) SCCF(RGBX32,BGR16OE)
152 SCCF(RGBX32,RGB15OE) SCCF(RGBX32,BGR15OE) SCCF(RGBX32,XRGB32) SCCF(RGBX32,BGRX32)
153 SCCF(RGBX32,XBGR32)
155 /* XBGR32 to #? */
156 SCCF(XBGR32,RGB16) SCCF(XBGR32,BGR16) SCCF(XBGR32,RGB15) SCCF(XBGR32,BGR15)
157 SCCF(XBGR32,BGRA32) SCCF(XBGR32,ARGB32) SCCF(XBGR32,RGBA32) SCCF(XBGR32,ABGR32)
158 SCCF(XBGR32,RGB24) SCCF(XBGR32,BGR24) SCCF(XBGR32,RGB16OE) SCCF(XBGR32,BGR16OE)
159 SCCF(XBGR32,RGB15OE) SCCF(XBGR32,BGR15OE) SCCF(XBGR32,XRGB32) SCCF(XBGR32,BGRX32)
160 SCCF(XBGR32,RGBX32)