1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Display Management (Display) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_display.h" |
29 |
|
|
|
30 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_raw_blend PORTABLE C */ |
35 |
|
|
/* 6.1.7 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
43 |
|
|
/* pixlemap file without alpha channel. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* context Drawing context */ |
48 |
|
|
/* xpos x-coord of top-left draw point*/ |
49 |
|
|
/* ypos y-coord of top-left draw point*/ |
50 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
51 |
|
|
/* alpha blending value 0 to 255 */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
965 |
static VOID _gx_display_driver_24xrgb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
67 |
|
|
{ |
68 |
|
|
INT yval; |
69 |
|
|
INT xval; |
70 |
|
|
INT draw_width; |
71 |
|
|
GX_COLOR color; |
72 |
|
|
ULONG *get; |
73 |
|
|
|
74 |
|
965 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
75 |
|
|
|
76 |
|
965 |
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data; |
77 |
|
965 |
get += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
78 |
|
965 |
get += (clip -> gx_rectangle_left - xpos); |
79 |
|
|
|
80 |
|
965 |
draw_width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1; |
81 |
|
|
|
82 |
✓✓ |
192606 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
83 |
|
|
{ |
84 |
✓✓ |
88821272 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
85 |
|
|
{ |
86 |
|
88629631 |
color = *get & 0x00ffffff; |
87 |
|
88629631 |
get++; |
88 |
|
88629631 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha); |
89 |
|
|
} |
90 |
|
191641 |
get += pixelmap -> gx_pixelmap_width - draw_width; |
91 |
|
|
} |
92 |
|
965 |
} |
93 |
|
|
|
94 |
|
|
/**************************************************************************/ |
95 |
|
|
/* */ |
96 |
|
|
/* FUNCTION RELEASE */ |
97 |
|
|
/* */ |
98 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_alpha_blend PORTABLE C */ |
99 |
|
|
/* 6.1.7 */ |
100 |
|
|
/* AUTHOR */ |
101 |
|
|
/* */ |
102 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
103 |
|
|
/* */ |
104 |
|
|
/* DESCRIPTION */ |
105 |
|
|
/* */ |
106 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
107 |
|
|
/* pixlemap file with alpha channel. */ |
108 |
|
|
/* */ |
109 |
|
|
/* INPUT */ |
110 |
|
|
/* */ |
111 |
|
|
/* context Drawing context */ |
112 |
|
|
/* xpos x-coord of top-left draw point*/ |
113 |
|
|
/* ypos y-coord of top-left draw point*/ |
114 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
115 |
|
|
/* alpha blending value 0 to 255 */ |
116 |
|
|
/* */ |
117 |
|
|
/* OUTPUT */ |
118 |
|
|
/* */ |
119 |
|
|
/* None */ |
120 |
|
|
/* */ |
121 |
|
|
/* CALLS */ |
122 |
|
|
/* */ |
123 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
124 |
|
|
/* */ |
125 |
|
|
/* CALLED BY */ |
126 |
|
|
/* */ |
127 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
128 |
|
|
/* */ |
129 |
|
|
/**************************************************************************/ |
130 |
|
9972 |
static VOID _gx_display_driver_24xrgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, |
131 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
132 |
|
|
{ |
133 |
|
|
int xval; |
134 |
|
|
int yval; |
135 |
|
|
int color; |
136 |
|
|
int width; |
137 |
|
|
ULONG *get; |
138 |
|
|
UCHAR alpha_value; |
139 |
|
|
ULONG combined_alpha; |
140 |
|
|
|
141 |
|
9972 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
142 |
|
|
|
143 |
|
9972 |
get = (GX_COLOR *)(pixelmap -> gx_pixelmap_data + (INT)sizeof(GX_COLOR) * pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos)); |
144 |
|
9972 |
get += (clip -> gx_rectangle_left - xpos); |
145 |
|
|
|
146 |
|
9972 |
width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1; |
147 |
|
|
|
148 |
✓✓ |
247795 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
149 |
|
|
{ |
150 |
✓✓ |
1000316 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
151 |
|
|
{ |
152 |
|
762493 |
alpha_value = (UCHAR)(*get >> 24); |
153 |
|
|
|
154 |
✓✓ |
762493 |
if (alpha_value) |
155 |
|
|
{ |
156 |
|
735951 |
combined_alpha = alpha_value; |
157 |
|
735951 |
combined_alpha *= alpha; |
158 |
|
735951 |
combined_alpha /= 255; |
159 |
|
|
|
160 |
✓✓ |
735951 |
if (combined_alpha) |
161 |
|
|
{ |
162 |
|
735821 |
color = *get & 0x00ffffff; |
163 |
|
735821 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, (GX_COLOR)color, (GX_UBYTE)combined_alpha); |
164 |
|
|
} |
165 |
|
|
} |
166 |
|
762493 |
get++; |
167 |
|
|
} |
168 |
|
237823 |
get += pixelmap -> gx_pixelmap_width - width; |
169 |
|
|
} |
170 |
|
9972 |
} |
171 |
|
|
|
172 |
|
|
|
173 |
|
|
/**************************************************************************/ |
174 |
|
|
/* */ |
175 |
|
|
/* FUNCTION RELEASE */ |
176 |
|
|
/* */ |
177 |
|
|
/* _gx_display_driver_24xrgb_palette_pixelmap_blend PORTABLE C */ |
178 |
|
|
/* 6.1.7 */ |
179 |
|
|
/* AUTHOR */ |
180 |
|
|
/* */ |
181 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
182 |
|
|
/* */ |
183 |
|
|
/* DESCRIPTION */ |
184 |
|
|
/* */ |
185 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
186 |
|
|
/* pixlemap file without transparent of palette pixelmap. */ |
187 |
|
|
/* */ |
188 |
|
|
/* INPUT */ |
189 |
|
|
/* */ |
190 |
|
|
/* context Drawing context */ |
191 |
|
|
/* xpos x-coord of top-left draw point*/ |
192 |
|
|
/* ypos y-coord of top-left draw point*/ |
193 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
194 |
|
|
/* alpha blending value 0 to 255 */ |
195 |
|
|
/* */ |
196 |
|
|
/* OUTPUT */ |
197 |
|
|
/* */ |
198 |
|
|
/* None */ |
199 |
|
|
/* */ |
200 |
|
|
/* CALLS */ |
201 |
|
|
/* */ |
202 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
203 |
|
|
/* */ |
204 |
|
|
/* CALLED BY */ |
205 |
|
|
/* */ |
206 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
207 |
|
|
/* */ |
208 |
|
|
/**************************************************************************/ |
209 |
|
7 |
static VOID _gx_display_driver_24xrgb_palette_pixelmap_blend(GX_DRAW_CONTEXT *context, |
210 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
211 |
|
|
{ |
212 |
|
|
INT xval; |
213 |
|
|
INT yval; |
214 |
|
|
GX_COLOR color; |
215 |
|
|
INT width; |
216 |
|
|
GX_UBYTE *get; |
217 |
|
|
GX_COLOR *palette; |
218 |
|
|
GX_UBYTE r; |
219 |
|
|
GX_UBYTE g; |
220 |
|
|
GX_UBYTE b; |
221 |
|
|
|
222 |
|
7 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
223 |
|
|
|
224 |
|
7 |
get = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data + pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos)); |
225 |
|
7 |
get += (clip -> gx_rectangle_left - xpos); |
226 |
|
|
|
227 |
|
7 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
228 |
|
|
|
229 |
|
7 |
width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1; |
230 |
|
|
|
231 |
|
|
|
232 |
✓✓ |
1697 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
233 |
|
|
{ |
234 |
✓✓ |
266591 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
235 |
|
|
{ |
236 |
|
264901 |
r = (GX_UBYTE)REDVAL_32BPP(palette[*get]); |
237 |
|
264901 |
g = (GX_UBYTE)GREENVAL_32BPP(palette[*get]); |
238 |
|
264901 |
b = (GX_UBYTE)BLUEVAL_32BPP(palette[*get++]); |
239 |
|
|
|
240 |
|
264901 |
color = (GX_COLOR)ASSEMBLECOLOR_24BPP(r, g, b); |
241 |
|
|
|
242 |
|
264901 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha); |
243 |
|
|
} |
244 |
|
|
|
245 |
|
1690 |
get += pixelmap -> gx_pixelmap_width - width; |
246 |
|
|
} |
247 |
|
7 |
} |
248 |
|
|
|
249 |
|
|
/**************************************************************************/ |
250 |
|
|
/* */ |
251 |
|
|
/* FUNCTION RELEASE */ |
252 |
|
|
/* */ |
253 |
|
|
/* _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend */ |
254 |
|
|
/* PORTABLE C */ |
255 |
|
|
/* 6.1.7 */ |
256 |
|
|
/* AUTHOR */ |
257 |
|
|
/* */ |
258 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
259 |
|
|
/* */ |
260 |
|
|
/* DESCRIPTION */ |
261 |
|
|
/* */ |
262 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
263 |
|
|
/* pixlemap file with transparent of palette pixelmap. */ |
264 |
|
|
/* */ |
265 |
|
|
/* INPUT */ |
266 |
|
|
/* */ |
267 |
|
|
/* context Drawing context */ |
268 |
|
|
/* xpos x-coord of top-left draw point*/ |
269 |
|
|
/* ypos y-coord of top-left draw point*/ |
270 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
271 |
|
|
/* alpha blending value 0 to 255 */ |
272 |
|
|
/* */ |
273 |
|
|
/* OUTPUT */ |
274 |
|
|
/* */ |
275 |
|
|
/* None */ |
276 |
|
|
/* */ |
277 |
|
|
/* CALLS */ |
278 |
|
|
/* */ |
279 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
280 |
|
|
/* */ |
281 |
|
|
/* CALLED BY */ |
282 |
|
|
/* */ |
283 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
284 |
|
|
/* */ |
285 |
|
|
/**************************************************************************/ |
286 |
|
2 |
static VOID _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT *context, |
287 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
288 |
|
|
{ |
289 |
|
|
INT xval; |
290 |
|
|
INT yval; |
291 |
|
|
GX_COLOR color; |
292 |
|
|
INT width; |
293 |
|
|
GX_UBYTE *get; |
294 |
|
|
GX_COLOR *palette; |
295 |
|
|
GX_UBYTE r; |
296 |
|
|
GX_UBYTE g; |
297 |
|
|
GX_UBYTE b; |
298 |
|
|
|
299 |
|
2 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
300 |
|
|
|
301 |
|
2 |
get = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data + pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos)); |
302 |
|
2 |
get += (clip -> gx_rectangle_left - xpos); |
303 |
|
|
|
304 |
|
2 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
305 |
|
|
|
306 |
|
2 |
width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1; |
307 |
|
|
|
308 |
✓✓ |
498 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
309 |
|
|
{ |
310 |
✓✓ |
86304 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
311 |
|
|
{ |
312 |
✓✓ |
85808 |
if ((*get) != pixelmap -> gx_pixelmap_transparent_color) |
313 |
|
|
{ |
314 |
|
66228 |
r = (GX_UBYTE)REDVAL_32BPP(palette[*get]); |
315 |
|
66228 |
g = (GX_UBYTE)GREENVAL_32BPP(palette[*get]); |
316 |
|
66228 |
b = (GX_UBYTE)BLUEVAL_32BPP(palette[*get]); |
317 |
|
66228 |
color = (GX_COLOR)ASSEMBLECOLOR_24BPP(r, g, b); |
318 |
|
66228 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha); |
319 |
|
|
} |
320 |
|
85808 |
get++; |
321 |
|
|
} |
322 |
|
|
|
323 |
|
496 |
get += pixelmap -> gx_pixelmap_width - width; |
324 |
|
|
} |
325 |
|
2 |
} |
326 |
|
|
|
327 |
|
|
/**************************************************************************/ |
328 |
|
|
/* */ |
329 |
|
|
/* FUNCTION RELEASE */ |
330 |
|
|
/* */ |
331 |
|
|
/* _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend */ |
332 |
|
|
/* PORTABLE C */ |
333 |
|
|
/* 6.1 */ |
334 |
|
|
/* AUTHOR */ |
335 |
|
|
/* */ |
336 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
337 |
|
|
/* */ |
338 |
|
|
/* DESCRIPTION */ |
339 |
|
|
/* */ |
340 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
341 |
|
|
/* pixlemap file with alpha channel of 4444argb format. */ |
342 |
|
|
/* */ |
343 |
|
|
/* INPUT */ |
344 |
|
|
/* */ |
345 |
|
|
/* context Drawing context */ |
346 |
|
|
/* xpos x-coord of top-left draw point*/ |
347 |
|
|
/* ypos y-coord of top-left draw point*/ |
348 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
349 |
|
|
/* alpha blending value 0 to 255 */ |
350 |
|
|
/* */ |
351 |
|
|
/* OUTPUT */ |
352 |
|
|
/* */ |
353 |
|
|
/* None */ |
354 |
|
|
/* */ |
355 |
|
|
/* CALLS */ |
356 |
|
|
/* */ |
357 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
358 |
|
|
/* */ |
359 |
|
|
/* CALLED BY */ |
360 |
|
|
/* */ |
361 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
362 |
|
|
/* */ |
363 |
|
|
/**************************************************************************/ |
364 |
|
9 |
static VOID _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
365 |
|
|
{ |
366 |
|
|
INT skipcount; |
367 |
|
|
INT xval; |
368 |
|
|
INT yval; |
369 |
|
|
USHORT *getrow; |
370 |
|
|
GX_CONST USHORT *get; |
371 |
|
|
UCHAR falpha; |
372 |
|
|
GX_UBYTE combined_alpha; |
373 |
|
|
ULONG pixel; |
374 |
|
|
|
375 |
|
9 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
376 |
|
|
|
377 |
|
|
/* calculate how many pixels to skip */ |
378 |
|
9 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
379 |
|
9 |
skipcount += (clip -> gx_rectangle_left - xpos); |
380 |
|
9 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
381 |
|
9 |
getrow += skipcount; |
382 |
|
|
|
383 |
✓✓ |
779 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
384 |
|
|
{ |
385 |
|
770 |
get = getrow; |
386 |
|
|
|
387 |
✓✓ |
100787 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
388 |
|
|
{ |
389 |
|
|
/* 0x000f- -> b , 0x00f0- -> g , 0x0f00- -> r , 0xf000- -> a */ |
390 |
|
|
/*4444bgra - -> 565rgb*/ |
391 |
|
100017 |
falpha = (UCHAR)(((*get) & 0xf000) >> 8); |
392 |
✓✓ |
100017 |
if (falpha) |
393 |
|
|
{ |
394 |
|
90580 |
falpha = (GX_UBYTE)(falpha | (falpha >> 4)); |
395 |
|
90580 |
pixel = (GX_COLOR)((((*get) & 0x0f00) << 12) | (((*get) & 0x00f0) << 8) | (((*get) & 0x000f) << 4)); |
396 |
|
90580 |
combined_alpha = (GX_UBYTE)(falpha * alpha / 255); |
397 |
|
90580 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, combined_alpha); |
398 |
|
|
} |
399 |
|
100017 |
get++; |
400 |
|
|
} |
401 |
|
770 |
getrow += pixelmap -> gx_pixelmap_width; |
402 |
|
|
} |
403 |
|
9 |
} |
404 |
|
|
|
405 |
|
|
/**************************************************************************/ |
406 |
|
|
/* */ |
407 |
|
|
/* FUNCTION RELEASE */ |
408 |
|
|
/* */ |
409 |
|
|
/* _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend */ |
410 |
|
|
/* PORTABLE C */ |
411 |
|
|
/* 6.1 */ |
412 |
|
|
/* AUTHOR */ |
413 |
|
|
/* */ |
414 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
415 |
|
|
/* */ |
416 |
|
|
/* DESCRIPTION */ |
417 |
|
|
/* */ |
418 |
|
|
/* Internal helper function that handles writing of non_compressed */ |
419 |
|
|
/* but with alpha channel pixelmap data of 565rgb format with 32bpp */ |
420 |
|
|
/* driver. */ |
421 |
|
|
/* */ |
422 |
|
|
/* INPUT */ |
423 |
|
|
/* */ |
424 |
|
|
/* context Drawing context */ |
425 |
|
|
/* xpos x-coord of top-left draw point*/ |
426 |
|
|
/* ypos y-coord of top-left draw point*/ |
427 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
428 |
|
|
/* alpha blending value 0 to 255 */ |
429 |
|
|
/* */ |
430 |
|
|
/* OUTPUT */ |
431 |
|
|
/* */ |
432 |
|
|
/* None */ |
433 |
|
|
/* */ |
434 |
|
|
/* CALLS */ |
435 |
|
|
/* */ |
436 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
437 |
|
|
/* */ |
438 |
|
|
/* CALLED BY */ |
439 |
|
|
/* */ |
440 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
441 |
|
|
/* */ |
442 |
|
|
/**************************************************************************/ |
443 |
|
4 |
static VOID _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, |
444 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
445 |
|
|
{ |
446 |
|
|
INT skipcount; |
447 |
|
|
INT xval; |
448 |
|
|
INT yval; |
449 |
|
|
GX_CONST GX_UBYTE *getalpha; |
450 |
|
|
GX_CONST USHORT *get; |
451 |
|
|
USHORT *getrow; |
452 |
|
|
GX_UBYTE *getrowalpha; |
453 |
|
|
GX_UBYTE r; |
454 |
|
|
GX_UBYTE g; |
455 |
|
|
GX_UBYTE b; |
456 |
|
|
GX_COLOR pixel; |
457 |
|
|
GX_UBYTE falpha; |
458 |
|
|
GX_UBYTE combined_alpha; |
459 |
|
|
|
460 |
|
4 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
461 |
|
|
|
462 |
|
4 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
463 |
|
4 |
skipcount += (clip -> gx_rectangle_left - xpos); |
464 |
|
4 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
465 |
|
4 |
getrow += skipcount; |
466 |
|
|
|
467 |
|
4 |
getrowalpha = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data); |
468 |
|
4 |
getrowalpha += skipcount; |
469 |
|
|
|
470 |
✓✓ |
642 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
471 |
|
|
{ |
472 |
|
638 |
get = getrow; |
473 |
|
638 |
getalpha = getrowalpha; |
474 |
|
|
|
475 |
✓✓ |
90134 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
476 |
|
|
{ |
477 |
|
89496 |
falpha = *getalpha++; |
478 |
✓✓ |
89496 |
if (falpha) |
479 |
|
|
{ |
480 |
|
64682 |
combined_alpha = (GX_UBYTE)(falpha * alpha / 255); |
481 |
|
64682 |
pixel = *get; |
482 |
|
64682 |
r = (GX_UBYTE)(((USHORT)pixel & 0xf800) >> 8); |
483 |
|
64682 |
g = (GX_UBYTE)(((USHORT)pixel & 0x07e0) >> 3); |
484 |
|
64682 |
b = (GX_UBYTE)(((USHORT)pixel & 0x001f) << 3); |
485 |
|
64682 |
pixel = (GX_COLOR)ASSEMBLECOLOR_32BPP(r, g, b); |
486 |
|
64682 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, combined_alpha); |
487 |
|
|
} |
488 |
|
89496 |
get++; |
489 |
|
|
} |
490 |
|
638 |
getrow += pixelmap -> gx_pixelmap_width; |
491 |
|
638 |
getrowalpha += pixelmap -> gx_pixelmap_width; |
492 |
|
|
} |
493 |
|
4 |
} |
494 |
|
|
|
495 |
|
|
/**************************************************************************/ |
496 |
|
|
/* */ |
497 |
|
|
/* FUNCTION RELEASE */ |
498 |
|
|
/* */ |
499 |
|
|
/* _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend PORTABLE C */ |
500 |
|
|
/* 6.1 */ |
501 |
|
|
/* AUTHOR */ |
502 |
|
|
/* */ |
503 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
504 |
|
|
/* */ |
505 |
|
|
/* DESCRIPTION */ |
506 |
|
|
/* */ |
507 |
|
|
/* Internal helper function that handles writing of 565rgb format */ |
508 |
|
|
/* uncompressed pixlemap file without alpha channel. */ |
509 |
|
|
/* */ |
510 |
|
|
/* INPUT */ |
511 |
|
|
/* */ |
512 |
|
|
/* context Drawing context */ |
513 |
|
|
/* xpos x-coord of top-left draw point*/ |
514 |
|
|
/* ypos y-coord of top-left draw point*/ |
515 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
516 |
|
|
/* alpha blending value 0 to 255 */ |
517 |
|
|
/* */ |
518 |
|
|
/* OUTPUT */ |
519 |
|
|
/* */ |
520 |
|
|
/* None */ |
521 |
|
|
/* */ |
522 |
|
|
/* CALLS */ |
523 |
|
|
/* */ |
524 |
|
|
/* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */ |
525 |
|
|
/* */ |
526 |
|
|
/* CALLED BY */ |
527 |
|
|
/* */ |
528 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend */ |
529 |
|
|
/* */ |
530 |
|
|
/**************************************************************************/ |
531 |
|
3 |
static VOID _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
532 |
|
|
{ |
533 |
|
|
INT xval; |
534 |
|
|
INT yval; |
535 |
|
|
USHORT *getrow; |
536 |
|
|
GX_CONST USHORT *get; |
537 |
|
|
GX_COLOR pixel; |
538 |
|
|
|
539 |
|
3 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
540 |
|
|
|
541 |
|
3 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
542 |
|
3 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
543 |
|
3 |
getrow += (clip -> gx_rectangle_left - xpos); |
544 |
|
|
|
545 |
✓✓ |
502 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
546 |
|
|
{ |
547 |
|
499 |
get = getrow; |
548 |
|
|
|
549 |
✓✓ |
86442 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
550 |
|
|
{ |
551 |
|
85943 |
pixel = (GX_COLOR)ASSEMBLECOLOR_32BPP(REDVAL_16BPP(*get) << 3, |
552 |
|
|
GREENVAL_16BPP(*get) << 2, |
553 |
|
|
BLUEVAL_16BPP(*get) << 3); |
554 |
|
85943 |
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, alpha); |
555 |
|
85943 |
get++; |
556 |
|
|
} |
557 |
|
499 |
getrow += pixelmap -> gx_pixelmap_width; |
558 |
|
|
} |
559 |
|
3 |
} |
560 |
|
|
|
561 |
|
|
/**************************************************************************/ |
562 |
|
|
/* */ |
563 |
|
|
/* FUNCTION RELEASE */ |
564 |
|
|
/* */ |
565 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_blend PORTABLE C */ |
566 |
|
|
/* 6.1 */ |
567 |
|
|
/* AUTHOR */ |
568 |
|
|
/* */ |
569 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
570 |
|
|
/* */ |
571 |
|
|
/* DESCRIPTION */ |
572 |
|
|
/* */ |
573 |
|
|
/* 32xrgb format screen driver pixelmap blending function that */ |
574 |
|
|
/* handles compressed or uncompress, with or without alpha channel. */ |
575 |
|
|
/* */ |
576 |
|
|
/* INPUT */ |
577 |
|
|
/* */ |
578 |
|
|
/* context Drawing context */ |
579 |
|
|
/* xpos x-coord of top-left draw point*/ |
580 |
|
|
/* ypos y-coord of top-left draw point*/ |
581 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
582 |
|
|
/* alpha blending value 0 to 255 */ |
583 |
|
|
/* */ |
584 |
|
|
/* OUTPUT */ |
585 |
|
|
/* */ |
586 |
|
|
/* None */ |
587 |
|
|
/* */ |
588 |
|
|
/* CALLS */ |
589 |
|
|
/* */ |
590 |
|
|
/* _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend */ |
591 |
|
|
/* Real pixelmap draw function. */ |
592 |
|
|
/* _gx_display_driver_24xrgb_palette_pixelmap_blend */ |
593 |
|
|
/* Real pixelmap draw function. */ |
594 |
|
|
/* _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend */ |
595 |
|
|
/* Real pixelmap draw function. */ |
596 |
|
|
/* _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend */ |
597 |
|
|
/* Real pixelmap draw function. */ |
598 |
|
|
/* _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend */ |
599 |
|
|
/* Real pixelmap draw function. */ |
600 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_alpha_blend */ |
601 |
|
|
/* Real pixelmap draw function. */ |
602 |
|
|
/* _gx_display_driver_24xrgb_pixelmap_raw_blend */ |
603 |
|
|
/* Real pixelmap draw function. */ |
604 |
|
|
/* */ |
605 |
|
|
/* CALLED BY */ |
606 |
|
|
/* */ |
607 |
|
|
/* GUIX Internal Code */ |
608 |
|
|
/* */ |
609 |
|
|
/**************************************************************************/ |
610 |
|
10964 |
VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
611 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
612 |
|
|
{ |
613 |
✓✓ |
10964 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
614 |
|
|
{ |
615 |
|
1 |
return; |
616 |
|
|
} |
617 |
|
|
|
618 |
✓✓✓✓ ✓ |
10963 |
switch (pixelmap -> gx_pixelmap_format) |
619 |
|
|
{ |
620 |
|
9 |
case GX_COLOR_FORMAT_8BIT_PALETTE: |
621 |
✓✓ |
9 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
622 |
|
|
{ |
623 |
|
2 |
_gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha); |
624 |
|
|
} |
625 |
|
|
else |
626 |
|
|
{ |
627 |
|
7 |
_gx_display_driver_24xrgb_palette_pixelmap_blend(context, xpos, ypos, pixelmap, alpha); |
628 |
|
|
} |
629 |
|
9 |
break; |
630 |
|
|
|
631 |
|
9 |
case GX_COLOR_FORMAT_4444ARGB: |
632 |
|
9 |
_gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
633 |
|
9 |
break; |
634 |
|
|
|
635 |
|
7 |
case GX_COLOR_FORMAT_565RGB: |
636 |
✓✓ |
7 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
637 |
|
|
{ |
638 |
|
4 |
_gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
639 |
|
|
} |
640 |
|
|
else |
641 |
|
|
{ |
642 |
|
3 |
_gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
643 |
|
|
} |
644 |
|
7 |
break; |
645 |
|
|
|
646 |
|
10937 |
case GX_COLOR_FORMAT_24XRGB: |
647 |
|
|
case GX_COLOR_FORMAT_32ARGB: |
648 |
✓✓ |
10937 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
649 |
|
|
{ |
650 |
|
9972 |
_gx_display_driver_24xrgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
651 |
|
|
|
652 |
|
|
} |
653 |
|
|
else |
654 |
|
|
{ |
655 |
|
965 |
_gx_display_driver_24xrgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
656 |
|
|
} |
657 |
|
10937 |
break; |
658 |
|
|
} |
659 |
|
|
|
660 |
|
10963 |
return; |
661 |
|
|
} |