|
1 /* |
|
2 * Render Engine for framebuffer devices |
|
3 * |
|
4 * Copyright (c) 2008 CodeSourcery |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Lesser General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Lesser General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public |
|
17 * License along with this library; if not, write to the Free Software |
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 */ |
|
20 |
|
21 |
|
22 /* This file builds the definition tree. */ |
|
23 |
|
24 /* |
|
25 Tree levels: |
|
26 DEFINING_DEST_BPP |
|
27 DEFINING_COLOR_ORDER |
|
28 DEFINING_BYTE_ORDER |
|
29 DEFINING_PIXEL_ORDER |
|
30 */ |
|
31 |
|
32 /* this is for the first time definitions */ |
|
33 #ifndef DEFINING_WHAT |
|
34 |
|
35 # define FB_LITTLE_ENDIAN 0 |
|
36 # define FB_BIG_ENDIAN 1 |
|
37 |
|
38 # define FB_CO_RGB 0 |
|
39 # define FB_CO_BGR 1 |
|
40 |
|
41 # define DEFINING_DEST_BPP 1 |
|
42 # define DEFINING_SRC_COLOR_ORDER 2 |
|
43 # define DEFINING_SRC_BYTE_ORDER 3 |
|
44 # define DEFINING_SRC_PIXEL_ORDER 4 |
|
45 # define DEFINING_FUNCTIONS 5 /* Tree leaf */ |
|
46 |
|
47 # define DEFINING_WHAT DEFINING_DEST_BPP /* first definition level */ |
|
48 #endif |
|
49 |
|
50 |
|
51 /* Begin tree: |
|
52 Each #if DEFINING_WHAT == XXX has one block per option of that level. |
|
53 For example, DEFINING_DEST_BPP will have 5 blocks (8,15,16,24,32). |
|
54 Each of these blocks has the same format: |
|
55 undef DEFINING_WHAT |
|
56 define DEFINING_WHAT (next level) |
|
57 define option |
|
58 include "fb_render_def.h" |
|
59 undef option |
|
60 So, at the end of each block, the only remaining definition is DEFINING_WHAT. |
|
61 |
|
62 New combining factors (i.e. more parameters for DEST, such as COLOR ORDER, |
|
63 BYTE ORDER, etc.) will have to be added as new blocks. |
|
64 */ |
|
65 |
|
66 |
|
67 #if DEFINING_WHAT == DEFINING_DEST_BPP |
|
68 |
|
69 # undef DEFINING_WHAT |
|
70 # define DEFINING_WHAT DEFINING_SRC_COLOR_ORDER |
|
71 # define DEST_BPP 8 |
|
72 # include "fb_render_def.h" |
|
73 # undef DEST_BPP |
|
74 |
|
75 # undef DEFINING_WHAT |
|
76 # define DEFINING_WHAT DEFINING_SRC_COLOR_ORDER |
|
77 # define DEST_BPP 15 |
|
78 # include "fb_render_def.h" |
|
79 # undef DEST_BPP |
|
80 |
|
81 # undef DEFINING_WHAT |
|
82 # define DEFINING_WHAT DEFINING_SRC_COLOR_ORDER |
|
83 # define DEST_BPP 16 |
|
84 # include "fb_render_def.h" |
|
85 # undef DEST_BPP |
|
86 |
|
87 # undef DEFINING_WHAT |
|
88 # define DEFINING_WHAT DEFINING_SRC_COLOR_ORDER |
|
89 # define DEST_BPP 24 |
|
90 # include "fb_render_def.h" |
|
91 # undef DEST_BPP |
|
92 |
|
93 # undef DEFINING_WHAT |
|
94 # define DEFINING_WHAT DEFINING_SRC_COLOR_ORDER |
|
95 # define DEST_BPP 32 |
|
96 # include "fb_render_def.h" |
|
97 # undef DEST_BPP |
|
98 |
|
99 #elif DEFINING_WHAT == DEFINING_SRC_COLOR_ORDER |
|
100 |
|
101 # undef DEFINING_WHAT |
|
102 # define DEFINING_WHAT DEFINING_SRC_BYTE_ORDER |
|
103 # define FB_SRC_COLOR_ORDER FB_CO_BGR |
|
104 # include "fb_render_def.h" |
|
105 # undef FB_SRC_COLOR_ORDER |
|
106 |
|
107 # undef DEFINING_WHAT |
|
108 # define DEFINING_WHAT DEFINING_SRC_BYTE_ORDER |
|
109 # define FB_SRC_COLOR_ORDER FB_CO_RGB |
|
110 # include "fb_render_def.h" |
|
111 # undef FB_SRC_COLOR_ORDER |
|
112 |
|
113 #elif DEFINING_WHAT == DEFINING_SRC_BYTE_ORDER |
|
114 |
|
115 # undef DEFINING_WHAT |
|
116 # define DEFINING_WHAT DEFINING_SRC_PIXEL_ORDER |
|
117 # define FB_SRC_BYTE_ORDER FB_LITTLE_ENDIAN |
|
118 # include "fb_render_def.h" |
|
119 # undef FB_SRC_BYTE_ORDER |
|
120 |
|
121 # undef DEFINING_WHAT |
|
122 # define DEFINING_WHAT DEFINING_SRC_PIXEL_ORDER |
|
123 # define FB_SRC_BYTE_ORDER FB_BIG_ENDIAN |
|
124 # include "fb_render_def.h" |
|
125 # undef FB_SRC_BYTE_ORDER |
|
126 |
|
127 #elif DEFINING_WHAT == DEFINING_SRC_PIXEL_ORDER |
|
128 |
|
129 # undef DEFINING_WHAT |
|
130 # define DEFINING_WHAT DEFINING_FUNCTIONS |
|
131 # define FB_SRC_PIXEL_ORDER FB_LITTLE_ENDIAN |
|
132 # include "fb_render_def.h" |
|
133 # undef FB_SRC_PIXEL_ORDER |
|
134 |
|
135 # undef DEFINING_WHAT |
|
136 # define DEFINING_WHAT DEFINING_FUNCTIONS |
|
137 # define FB_SRC_PIXEL_ORDER FB_BIG_ENDIAN |
|
138 # include "fb_render_def.h" |
|
139 # undef FB_SRC_PIXEL_ORDER |
|
140 |
|
141 #elif DEFINING_WHAT == DEFINING_FUNCTIONS |
|
142 # undef DEFINING_WHAT |
|
143 /* End of recursion. Include the template now */ |
|
144 # include "fb_render_template.h" |
|
145 #endif |
|
146 |
|
147 |
|
148 |