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 |
|
|
#include "gx_context.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend PORTABLE C */ |
36 |
|
|
/* 6.1 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
44 |
|
|
/* pixlemap file */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* context Drawing context */ |
49 |
|
|
/* xpos x-coord of top-left draw point*/ |
50 |
|
|
/* ypos y-coord of top-left draw point*/ |
51 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
52 |
|
|
/* alpha blending value 0 to 255 */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* None */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* [gx_display_driver_pixel_blend] Display driver basic pixel */ |
61 |
|
|
/* blend function */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* GUIX Internal Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
6 |
static VOID _gx_display_driver_16bpp_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
69 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
70 |
|
|
{ |
71 |
|
|
int xval; |
72 |
|
|
int yval; |
73 |
|
|
USHORT *get; |
74 |
|
|
USHORT *getrow; |
75 |
|
|
USHORT pixel; |
76 |
|
|
|
77 |
|
6 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
78 |
|
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
79 |
|
|
|
80 |
|
6 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
81 |
✓✓ |
6 |
if (!blend_func) |
82 |
|
|
{ |
83 |
|
1 |
return; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
5 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data + (INT)sizeof(USHORT) * pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos)); |
87 |
|
5 |
getrow += (clip -> gx_rectangle_left - xpos); |
88 |
✓✓ |
1011 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
89 |
|
|
{ |
90 |
|
1006 |
get = getrow; |
91 |
✓✓ |
163640 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
92 |
|
|
{ |
93 |
|
162634 |
pixel = *get++; |
94 |
|
162634 |
blend_func(context, xval, yval, pixel, alpha); |
95 |
|
|
} |
96 |
|
1006 |
getrow += pixelmap -> gx_pixelmap_width; |
97 |
|
|
} |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
/**************************************************************************/ |
101 |
|
|
/* */ |
102 |
|
|
/* FUNCTION RELEASE */ |
103 |
|
|
/* */ |
104 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend PORTABLE C */ |
105 |
|
|
/* 6.1 */ |
106 |
|
|
/* AUTHOR */ |
107 |
|
|
/* */ |
108 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
109 |
|
|
/* */ |
110 |
|
|
/* DESCRIPTION */ |
111 |
|
|
/* */ |
112 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
113 |
|
|
/* pixelmap file with alpha channel. */ |
114 |
|
|
/* */ |
115 |
|
|
/* INPUT */ |
116 |
|
|
/* */ |
117 |
|
|
/* context Drawing context */ |
118 |
|
|
/* xpos x-coord of top-left draw point*/ |
119 |
|
|
/* ypos y-coord of top-left draw point*/ |
120 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
121 |
|
|
/* alpha blending value 0 to 255 */ |
122 |
|
|
/* */ |
123 |
|
|
/* OUTPUT */ |
124 |
|
|
/* */ |
125 |
|
|
/* None */ |
126 |
|
|
/* */ |
127 |
|
|
/* CALLS */ |
128 |
|
|
/* */ |
129 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
130 |
|
|
/* blend function */ |
131 |
|
|
/* CALLED BY */ |
132 |
|
|
/* */ |
133 |
|
|
/* GUIX Internal Code */ |
134 |
|
|
/* */ |
135 |
|
|
/**************************************************************************/ |
136 |
|
257 |
static VOID _gx_display_driver_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, |
137 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
138 |
|
|
{ |
139 |
|
|
INT skipcount; |
140 |
|
|
INT xval; |
141 |
|
|
INT yval; |
142 |
|
|
USHORT *getrow; |
143 |
|
|
GX_UBYTE *getrowalpha; |
144 |
|
|
USHORT *get; |
145 |
|
|
USHORT pixel; |
146 |
|
|
GX_UBYTE *getalpha; |
147 |
|
|
INT combined_alpha; |
148 |
|
|
GX_UBYTE internal_alpha; |
149 |
|
|
|
150 |
|
257 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
151 |
|
|
void (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
152 |
|
|
|
153 |
|
257 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
154 |
✓✓ |
257 |
if (blend_func == GX_NULL) |
155 |
|
|
{ |
156 |
|
1 |
return; |
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
|
160 |
|
|
/* calculate how many pixels to skip */ |
161 |
|
256 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
162 |
|
256 |
skipcount += (clip -> gx_rectangle_left - xpos); |
163 |
|
256 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
164 |
|
256 |
getrow += skipcount; |
165 |
|
|
|
166 |
|
256 |
getrowalpha = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data); |
167 |
|
256 |
getrowalpha += skipcount; |
168 |
|
|
|
169 |
✓✓ |
34043 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
170 |
|
|
{ |
171 |
|
33787 |
get = getrow; |
172 |
|
33787 |
getalpha = getrowalpha; |
173 |
|
|
|
174 |
✓✓ |
4379524 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
175 |
|
|
{ |
176 |
|
4345737 |
internal_alpha = *getalpha++; |
177 |
✓✓ |
4345737 |
if (internal_alpha) |
178 |
|
|
{ |
179 |
|
3114153 |
combined_alpha = internal_alpha * alpha; |
180 |
|
3114153 |
combined_alpha /= 255; |
181 |
|
3114153 |
pixel = *get; |
182 |
|
3114153 |
blend_func(context, xval, yval, pixel, (GX_UBYTE)combined_alpha); |
183 |
|
|
} |
184 |
|
4345737 |
get++; |
185 |
|
|
} |
186 |
|
33787 |
getrow += pixelmap -> gx_pixelmap_width; |
187 |
|
33787 |
getrowalpha += pixelmap -> gx_pixelmap_width; |
188 |
|
|
} |
189 |
|
|
} |
190 |
|
|
|
191 |
|
|
/**************************************************************************/ |
192 |
|
|
/* */ |
193 |
|
|
/* FUNCTION RELEASE */ |
194 |
|
|
/* */ |
195 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
196 |
|
|
/* PORTABLE C */ |
197 |
|
|
/* 6.1 */ |
198 |
|
|
/* AUTHOR */ |
199 |
|
|
/* */ |
200 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
201 |
|
|
/* */ |
202 |
|
|
/* DESCRIPTION */ |
203 |
|
|
/* */ |
204 |
|
|
/* Internal helper function that handles blending of compressed */ |
205 |
|
|
/* pixlemap file . */ |
206 |
|
|
/* */ |
207 |
|
|
/* INPUT */ |
208 |
|
|
/* */ |
209 |
|
|
/* context Drawing context */ |
210 |
|
|
/* xpos x-coord of top-left draw point*/ |
211 |
|
|
/* ypos y-coord of top-left draw point*/ |
212 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
213 |
|
|
/* alpha blending value 0 to 255 */ |
214 |
|
|
/* */ |
215 |
|
|
/* OUTPUT */ |
216 |
|
|
/* */ |
217 |
|
|
/* None */ |
218 |
|
|
/* */ |
219 |
|
|
/* CALLS */ |
220 |
|
|
/* */ |
221 |
|
|
/* [gx_display_driver_pixel_blend] Display driver basic pixel */ |
222 |
|
|
/* blend function */ |
223 |
|
|
/* */ |
224 |
|
|
/* CALLED BY */ |
225 |
|
|
/* */ |
226 |
|
|
/* GUIX Internal Code */ |
227 |
|
|
/* */ |
228 |
|
|
/**************************************************************************/ |
229 |
|
6 |
static VOID _gx_display_driver_16bpp_pixelmap_compressed_blend(GX_DRAW_CONTEXT *context, |
230 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
231 |
|
|
{ |
232 |
|
|
int yval; |
233 |
|
|
int xval; |
234 |
|
|
GX_CONST USHORT *get; |
235 |
|
|
USHORT count; |
236 |
|
|
USHORT pixel; |
237 |
|
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
238 |
|
6 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
239 |
|
|
|
240 |
|
6 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
241 |
|
|
|
242 |
✓✓ |
6 |
if (!blend_func) |
243 |
|
|
{ |
244 |
|
1 |
return; |
245 |
|
|
} |
246 |
|
|
|
247 |
|
5 |
get = (GX_CONST USHORT *)pixelmap -> gx_pixelmap_data; |
248 |
|
|
|
249 |
|
|
/* compressed with no alpha is a two-byte count and two-byte pixel value */ |
250 |
|
|
|
251 |
|
|
/* first, skip to the starting row */ |
252 |
✓✓ |
83 |
for (yval = ypos; yval < clip -> gx_rectangle_top; yval++) |
253 |
|
|
{ |
254 |
|
78 |
xval = 0; |
255 |
✓✓ |
6846 |
while (xval < pixelmap -> gx_pixelmap_width) |
256 |
|
|
{ |
257 |
|
6768 |
count = *get++; |
258 |
|
|
|
259 |
✓✓ |
6768 |
if (count & 0x8000) |
260 |
|
|
{ |
261 |
|
3656 |
count = (USHORT)((count & 0x7fff) + 1); |
262 |
|
3656 |
get++; /* skip repeated pixel value */ |
263 |
|
|
} |
264 |
|
|
else |
265 |
|
|
{ |
266 |
|
3112 |
count++; |
267 |
|
3112 |
get += count; /* skip raw pixel values */ |
268 |
|
|
} |
269 |
|
6768 |
xval += count; |
270 |
|
|
} |
271 |
|
|
} |
272 |
|
|
|
273 |
|
|
|
274 |
✓✓ |
1390 |
while (yval <= clip -> gx_rectangle_bottom) |
275 |
|
|
{ |
276 |
|
1385 |
xval = xpos; |
277 |
|
|
|
278 |
✓✓ |
121659 |
while (xval < xpos + pixelmap -> gx_pixelmap_width) |
279 |
|
|
{ |
280 |
|
120274 |
count = *get++; |
281 |
|
|
|
282 |
✓✓ |
120274 |
if (count & 0x8000) |
283 |
|
|
{ |
284 |
|
|
/* repeated value */ |
285 |
|
65864 |
count = (USHORT)((count & 0x7fff) + 1); |
286 |
|
65864 |
pixel = *get++; |
287 |
|
|
|
288 |
✓✓ |
387114 |
while (count--) |
289 |
|
|
{ |
290 |
✓✓ |
321250 |
if (xval >= clip -> gx_rectangle_left && |
291 |
✓✓ |
309322 |
xval <= clip -> gx_rectangle_right) |
292 |
|
|
{ |
293 |
|
78355 |
blend_func(context, xval, yval, pixel, alpha); |
294 |
|
|
} |
295 |
|
321250 |
xval++; |
296 |
|
|
} |
297 |
|
|
} |
298 |
|
|
else |
299 |
|
|
{ |
300 |
|
|
/* string of non-repeated values */ |
301 |
|
54410 |
count++; |
302 |
✓✓ |
956115 |
while (count--) |
303 |
|
|
{ |
304 |
✓✓ |
901705 |
if (xval >= clip -> gx_rectangle_left && |
305 |
✓✓ |
878497 |
xval <= clip -> gx_rectangle_right) |
306 |
|
|
{ |
307 |
|
263924 |
pixel = *get; |
308 |
|
263924 |
blend_func(context, xval, yval, pixel, alpha); |
309 |
|
|
} |
310 |
|
901705 |
get++; |
311 |
|
901705 |
xval++; |
312 |
|
|
} |
313 |
|
|
} |
314 |
|
|
} |
315 |
|
1385 |
yval++; |
316 |
|
|
} |
317 |
|
|
} |
318 |
|
|
|
319 |
|
|
/**************************************************************************/ |
320 |
|
|
/* */ |
321 |
|
|
/* FUNCTION RELEASE */ |
322 |
|
|
/* */ |
323 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_raw_blend PORTABLE C */ |
324 |
|
|
/* 6.1 */ |
325 |
|
|
/* AUTHOR */ |
326 |
|
|
/* */ |
327 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
328 |
|
|
/* */ |
329 |
|
|
/* DESCRIPTION */ |
330 |
|
|
/* */ |
331 |
|
|
/* Internal helper function that handles blending of raw pixlemap */ |
332 |
|
|
/* file without transparent for palette pixelmap. */ |
333 |
|
|
/* */ |
334 |
|
|
/* INPUT */ |
335 |
|
|
/* */ |
336 |
|
|
/* context Drawing context */ |
337 |
|
|
/* xpos x-coord of top-left draw point*/ |
338 |
|
|
/* ypos y-coord of top-left draw point*/ |
339 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
340 |
|
|
/* alpha blending value 0 to 255 */ |
341 |
|
|
/* */ |
342 |
|
|
/* OUTPUT */ |
343 |
|
|
/* */ |
344 |
|
|
/* None */ |
345 |
|
|
/* */ |
346 |
|
|
/* CALLS */ |
347 |
|
|
/* */ |
348 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
349 |
|
|
/* blend function */ |
350 |
|
|
/* */ |
351 |
|
|
/* CALLED BY */ |
352 |
|
|
/* */ |
353 |
|
|
/* GUIX Internal Code */ |
354 |
|
|
/* */ |
355 |
|
|
/**************************************************************************/ |
356 |
|
2 |
static VOID _gx_display_driver_565rgb_palette_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
357 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
358 |
|
|
{ |
359 |
|
|
INT xval; |
360 |
|
|
INT yval; |
361 |
|
|
GX_UBYTE *getrow; |
362 |
|
|
GX_CONST GX_UBYTE *get; |
363 |
|
|
GX_COLOR *palette; |
364 |
|
|
USHORT pixel; |
365 |
|
|
GX_UBYTE r; |
366 |
|
|
GX_UBYTE g; |
367 |
|
|
GX_UBYTE b; |
368 |
|
|
|
369 |
|
2 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
370 |
|
|
|
371 |
|
2 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
372 |
|
2 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
373 |
|
2 |
getrow += (clip -> gx_rectangle_left - xpos); |
374 |
|
|
|
375 |
|
2 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
376 |
|
|
|
377 |
✓✓ |
530 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
378 |
|
|
{ |
379 |
|
528 |
get = getrow; |
380 |
|
|
|
381 |
✓✓ |
127776 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
382 |
|
|
{ |
383 |
|
127248 |
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3); |
384 |
|
127248 |
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2); |
385 |
|
127248 |
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get++]) >> 3); |
386 |
|
127248 |
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b); |
387 |
|
127248 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha); |
388 |
|
|
} |
389 |
|
528 |
getrow += pixelmap -> gx_pixelmap_width; |
390 |
|
|
} |
391 |
|
2 |
} |
392 |
|
|
|
393 |
|
|
/**************************************************************************/ |
394 |
|
|
/* */ |
395 |
|
|
/* FUNCTION RELEASE */ |
396 |
|
|
/* */ |
397 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_transparent_blend */ |
398 |
|
|
/* PORTABLE C */ |
399 |
|
|
/* 6.1 */ |
400 |
|
|
/* AUTHOR */ |
401 |
|
|
/* */ |
402 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
403 |
|
|
/* */ |
404 |
|
|
/* DESCRIPTION */ |
405 |
|
|
/* */ |
406 |
|
|
/* Internal helper function that handles blending of raw pixlemap */ |
407 |
|
|
/* file with transparent for palette pixelmap. */ |
408 |
|
|
/* */ |
409 |
|
|
/* INPUT */ |
410 |
|
|
/* */ |
411 |
|
|
/* context Drawing context */ |
412 |
|
|
/* xpos x-coord of top-left draw point*/ |
413 |
|
|
/* ypos y-coord of top-left draw point*/ |
414 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
415 |
|
|
/* alpha blending value 0 to 255 */ |
416 |
|
|
/* */ |
417 |
|
|
/* OUTPUT */ |
418 |
|
|
/* */ |
419 |
|
|
/* None */ |
420 |
|
|
/* */ |
421 |
|
|
/* CALLS */ |
422 |
|
|
/* */ |
423 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
424 |
|
|
/* blend function */ |
425 |
|
|
/* */ |
426 |
|
|
/* CALLED BY */ |
427 |
|
|
/* */ |
428 |
|
|
/* GUIX Internal Code */ |
429 |
|
|
/* */ |
430 |
|
|
/**************************************************************************/ |
431 |
|
2 |
static VOID _gx_display_driver_565rgb_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT *context, |
432 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
433 |
|
|
{ |
434 |
|
|
INT xval; |
435 |
|
|
INT yval; |
436 |
|
|
GX_UBYTE *getrow; |
437 |
|
|
GX_CONST GX_UBYTE *get; |
438 |
|
|
GX_COLOR *palette; |
439 |
|
|
USHORT pixel; |
440 |
|
|
GX_UBYTE r; |
441 |
|
|
GX_UBYTE g; |
442 |
|
|
GX_UBYTE b; |
443 |
|
|
|
444 |
|
2 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
445 |
|
|
|
446 |
|
2 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
447 |
|
2 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
448 |
|
2 |
getrow += (clip -> gx_rectangle_left - xpos); |
449 |
|
|
|
450 |
|
2 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
451 |
|
|
|
452 |
|
|
|
453 |
✓✓ |
498 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
454 |
|
|
{ |
455 |
|
496 |
get = getrow; |
456 |
|
|
|
457 |
✓✓ |
86304 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
458 |
|
|
{ |
459 |
✓✓ |
85808 |
if ((*get) != pixelmap -> gx_pixelmap_transparent_color) |
460 |
|
|
{ |
461 |
|
66228 |
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3); |
462 |
|
66228 |
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2); |
463 |
|
66228 |
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get]) >> 3); |
464 |
|
66228 |
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b); |
465 |
|
66228 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha); |
466 |
|
|
} |
467 |
|
85808 |
get++; |
468 |
|
|
} |
469 |
|
496 |
getrow += pixelmap -> gx_pixelmap_width; |
470 |
|
|
} |
471 |
|
2 |
} |
472 |
|
|
|
473 |
|
|
/**************************************************************************/ |
474 |
|
|
/* */ |
475 |
|
|
/* FUNCTION RELEASE */ |
476 |
|
|
/* */ |
477 |
|
|
/* _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend */ |
478 |
|
|
/* PORTABLE C */ |
479 |
|
|
/* 6.1 */ |
480 |
|
|
/* AUTHOR */ |
481 |
|
|
/* */ |
482 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
483 |
|
|
/* */ |
484 |
|
|
/* DESCRIPTION */ |
485 |
|
|
/* */ |
486 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
487 |
|
|
/* pixlemap file with alpha channel of 4444argb format. */ |
488 |
|
|
/* */ |
489 |
|
|
/* INPUT */ |
490 |
|
|
/* */ |
491 |
|
|
/* context Drawing context */ |
492 |
|
|
/* xpos x-coord of top-left draw point*/ |
493 |
|
|
/* ypos y-coord of top-left draw point*/ |
494 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
495 |
|
|
/* alpha blending value 0 to 255 */ |
496 |
|
|
/* */ |
497 |
|
|
/* OUTPUT */ |
498 |
|
|
/* */ |
499 |
|
|
/* None */ |
500 |
|
|
/* */ |
501 |
|
|
/* CALLS */ |
502 |
|
|
/* */ |
503 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
504 |
|
|
/* blend function */ |
505 |
|
|
/* */ |
506 |
|
|
/* CALLED BY */ |
507 |
|
|
/* */ |
508 |
|
|
/* GUIX Internal Code */ |
509 |
|
|
/* */ |
510 |
|
|
/**************************************************************************/ |
511 |
|
4 |
static VOID _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
512 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
513 |
|
|
{ |
514 |
|
|
INT skipcount; |
515 |
|
|
INT xval; |
516 |
|
|
INT yval; |
517 |
|
|
USHORT *getrow; |
518 |
|
|
GX_CONST USHORT *get; |
519 |
|
|
UCHAR alpha_value; |
520 |
|
|
GX_UBYTE combined_alpha; |
521 |
|
|
USHORT pixel; |
522 |
|
|
|
523 |
|
4 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
524 |
|
|
|
525 |
|
|
/* calculate how many pixels to skip */ |
526 |
|
4 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
527 |
|
4 |
skipcount += (clip -> gx_rectangle_left - xpos); |
528 |
|
4 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
529 |
|
4 |
getrow += skipcount; |
530 |
|
|
|
531 |
✓✓ |
622 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
532 |
|
|
{ |
533 |
|
618 |
get = getrow; |
534 |
|
|
|
535 |
✓✓ |
95942 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
536 |
|
|
{ |
537 |
|
|
/* 0x000f- -> b , 0x00f0- -> g , 0x0f00- -> r , 0xf000- -> a */ |
538 |
|
|
/*4444bgra - -> 565rgb*/ |
539 |
|
95324 |
alpha_value = (UCHAR)(((*get) & 0xf000) >> 8); |
540 |
✓✓ |
95324 |
if (alpha_value) |
541 |
|
|
{ |
542 |
|
88410 |
alpha_value = alpha_value | (alpha_value >> 4); |
543 |
|
88410 |
pixel = (USHORT)((((*get) & 0x0f00) << 4) | (((*get) & 0x00f0) << 3) | (((*get) & 0x000f) << 1)); |
544 |
|
88410 |
combined_alpha = (GX_UBYTE)(alpha * alpha_value / 255); |
545 |
|
88410 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, combined_alpha); |
546 |
|
|
} |
547 |
|
95324 |
get++; |
548 |
|
|
} |
549 |
|
618 |
getrow += pixelmap -> gx_pixelmap_width; |
550 |
|
|
} |
551 |
|
4 |
} |
552 |
|
|
|
553 |
|
|
/**************************************************************************/ |
554 |
|
|
/* */ |
555 |
|
|
/* FUNCTION RELEASE */ |
556 |
|
|
/* */ |
557 |
|
|
/* _gx_display_driver_565rgb_pixelmap_blend PORTABLE C */ |
558 |
|
|
/* 6.1 */ |
559 |
|
|
/* AUTHOR */ |
560 |
|
|
/* */ |
561 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
562 |
|
|
/* */ |
563 |
|
|
/* DESCRIPTION */ |
564 |
|
|
/* */ |
565 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
566 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
567 |
|
|
/* */ |
568 |
|
|
/* INPUT */ |
569 |
|
|
/* */ |
570 |
|
|
/* context Drawing context */ |
571 |
|
|
/* xpos x-coord of top-left draw point*/ |
572 |
|
|
/* ypos y-coord of top-left draw point*/ |
573 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
574 |
|
|
/* alpha blending value 0 to 255 */ |
575 |
|
|
/* */ |
576 |
|
|
/* OUTPUT */ |
577 |
|
|
/* */ |
578 |
|
|
/* None */ |
579 |
|
|
/* */ |
580 |
|
|
/* CALLS */ |
581 |
|
|
/* */ |
582 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_transparent_blend */ |
583 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_raw_blend */ |
584 |
|
|
/* _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend */ |
585 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend */ |
586 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
587 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
588 |
|
|
/* */ |
589 |
|
|
/* CALLED BY */ |
590 |
|
|
/* */ |
591 |
|
|
/* GUIX Internal Code */ |
592 |
|
|
/* */ |
593 |
|
|
/**************************************************************************/ |
594 |
|
271 |
VOID _gx_display_driver_565rgb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
595 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
596 |
|
|
{ |
597 |
✓✓ |
271 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
598 |
|
|
{ |
599 |
✓✓ |
3 |
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_565RGB) |
600 |
|
|
{ |
601 |
|
1 |
return; |
602 |
|
|
} |
603 |
|
|
} |
604 |
|
|
|
605 |
✓✓✓✓
|
270 |
switch (pixelmap -> gx_pixelmap_format) |
606 |
|
|
{ |
607 |
|
5 |
case GX_COLOR_FORMAT_8BIT_PALETTE: |
608 |
✓✓ |
5 |
if (pixelmap -> gx_pixelmap_aux_data == GX_NULL) |
609 |
|
|
{ |
610 |
|
1 |
break; |
611 |
|
|
} |
612 |
|
|
|
613 |
✓✓ |
4 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
614 |
|
|
{ |
615 |
|
2 |
_gx_display_driver_565rgb_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha); |
616 |
|
|
} |
617 |
|
|
else |
618 |
|
|
{ |
619 |
|
2 |
_gx_display_driver_565rgb_palette_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
620 |
|
|
} |
621 |
|
4 |
break; |
622 |
|
|
|
623 |
|
4 |
case GX_COLOR_FORMAT_4444ARGB: |
624 |
|
4 |
_gx_display_driver_565rgb_4444argb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
625 |
|
4 |
break; |
626 |
|
|
|
627 |
|
260 |
case GX_COLOR_FORMAT_565RGB: |
628 |
✓✓ |
260 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
629 |
|
|
{ |
630 |
|
256 |
_gx_display_driver_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
631 |
|
|
} |
632 |
|
|
else |
633 |
|
|
{ |
634 |
✓✓ |
4 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
635 |
|
|
{ |
636 |
|
2 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
637 |
|
|
} |
638 |
|
|
else |
639 |
|
|
{ |
640 |
|
2 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
641 |
|
|
} |
642 |
|
|
} |
643 |
|
260 |
break; |
644 |
|
|
|
645 |
|
1 |
default: |
646 |
|
1 |
return; |
647 |
|
|
} |
648 |
|
|
} |
649 |
|
|
|
650 |
|
|
/**************************************************************************/ |
651 |
|
|
/* */ |
652 |
|
|
/* FUNCTION RELEASE */ |
653 |
|
|
/* */ |
654 |
|
|
/* _gx_display_driver_1555xrgb_pixelmap_blend PORTABLE C */ |
655 |
|
|
/* 6.1 */ |
656 |
|
|
/* AUTHOR */ |
657 |
|
|
/* */ |
658 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
659 |
|
|
/* */ |
660 |
|
|
/* DESCRIPTION */ |
661 |
|
|
/* */ |
662 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
663 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
664 |
|
|
/* */ |
665 |
|
|
/* INPUT */ |
666 |
|
|
/* */ |
667 |
|
|
/* context Drawing context */ |
668 |
|
|
/* xpos x-coord of top-left draw point*/ |
669 |
|
|
/* ypos y-coord of top-left draw point*/ |
670 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
671 |
|
|
/* alpha blending value 0 to 255 */ |
672 |
|
|
/* */ |
673 |
|
|
/* OUTPUT */ |
674 |
|
|
/* */ |
675 |
|
|
/* None */ |
676 |
|
|
/* */ |
677 |
|
|
/* CALLS */ |
678 |
|
|
/* */ |
679 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend */ |
680 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
681 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
682 |
|
|
/* */ |
683 |
|
|
/* CALLED BY */ |
684 |
|
|
/* */ |
685 |
|
|
/* GUIX Internal Code */ |
686 |
|
|
/* */ |
687 |
|
|
/**************************************************************************/ |
688 |
|
4 |
VOID _gx_display_driver_1555xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
689 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
690 |
|
|
{ |
691 |
✓✓ |
4 |
switch (pixelmap -> gx_pixelmap_format) |
692 |
|
|
{ |
693 |
|
3 |
case GX_COLOR_FORMAT_1555XRGB: |
694 |
✓✓ |
3 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
695 |
|
|
{ |
696 |
|
1 |
_gx_display_driver_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
697 |
|
|
} |
698 |
|
|
else |
699 |
|
|
{ |
700 |
✓✓ |
2 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
701 |
|
|
{ |
702 |
|
1 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
703 |
|
|
} |
704 |
|
|
else |
705 |
|
|
{ |
706 |
|
1 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
707 |
|
|
} |
708 |
|
|
} |
709 |
|
3 |
break; |
710 |
|
|
|
711 |
|
1 |
default: |
712 |
|
1 |
return; |
713 |
|
|
} |
714 |
|
|
} |
715 |
|
|
|
716 |
|
|
/**************************************************************************/ |
717 |
|
|
/* */ |
718 |
|
|
/* FUNCTION RELEASE */ |
719 |
|
|
/* */ |
720 |
|
|
/* _gx_display_driver_4444argb_pixelmap_blend PORTABLE C */ |
721 |
|
|
/* 6.1 */ |
722 |
|
|
/* AUTHOR */ |
723 |
|
|
/* */ |
724 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
725 |
|
|
/* */ |
726 |
|
|
/* DESCRIPTION */ |
727 |
|
|
/* */ |
728 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
729 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
730 |
|
|
/* */ |
731 |
|
|
/* INPUT */ |
732 |
|
|
/* */ |
733 |
|
|
/* context Drawing context */ |
734 |
|
|
/* xpos x-coord of top-left draw point*/ |
735 |
|
|
/* ypos y-coord of top-left draw point*/ |
736 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
737 |
|
|
/* alpha blending value 0 to 255 */ |
738 |
|
|
/* */ |
739 |
|
|
/* OUTPUT */ |
740 |
|
|
/* */ |
741 |
|
|
/* None */ |
742 |
|
|
/* */ |
743 |
|
|
/* CALLS */ |
744 |
|
|
/* */ |
745 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
746 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
747 |
|
|
/* */ |
748 |
|
|
/* CALLED BY */ |
749 |
|
|
/* */ |
750 |
|
|
/* GUIX Internal Code */ |
751 |
|
|
/* */ |
752 |
|
|
/**************************************************************************/ |
753 |
|
8 |
VOID _gx_display_driver_4444argb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
754 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
755 |
|
|
{ |
756 |
✓✓ |
8 |
switch (pixelmap -> gx_pixelmap_format) |
757 |
|
|
{ |
758 |
|
7 |
case GX_COLOR_FORMAT_4444ARGB: |
759 |
✓✓ |
7 |
if (!(pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)) |
760 |
|
|
{ |
761 |
✓✓ |
6 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
762 |
|
|
{ |
763 |
|
3 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
764 |
|
|
} |
765 |
|
|
else |
766 |
|
|
{ |
767 |
|
3 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
768 |
|
|
} |
769 |
|
|
} |
770 |
|
7 |
break; |
771 |
|
|
|
772 |
|
1 |
default: |
773 |
|
1 |
return; |
774 |
|
|
} |
775 |
|
|
} |
776 |
|
|
|