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