1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
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 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* 06-02-2021 Kenneth Maxwell Modified comment(s), */
73 /* removed unused variable */
74 /* assignment, */
75 /* resulting in version 6.1.7 */
76 /* */
77 /**************************************************************************/
_gx_display_driver_24xrgb_pixelmap_raw_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)78 static VOID _gx_display_driver_24xrgb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
79 {
80 INT yval;
81 INT xval;
82 INT draw_width;
83 GX_COLOR color;
84 ULONG *get;
85
86 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
87
88 get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
89 get += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos);
90 get += (clip -> gx_rectangle_left - xpos);
91
92 draw_width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1;
93
94 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
95 {
96 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
97 {
98 color = *get & 0x00ffffff;
99 get++;
100 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha);
101 }
102 get += pixelmap -> gx_pixelmap_width - draw_width;
103 }
104 }
105
106 /**************************************************************************/
107 /* */
108 /* FUNCTION RELEASE */
109 /* */
110 /* _gx_display_driver_24xrgb_pixelmap_alpha_blend PORTABLE C */
111 /* 6.1.7 */
112 /* AUTHOR */
113 /* */
114 /* Kenneth Maxwell, Microsoft Corporation */
115 /* */
116 /* DESCRIPTION */
117 /* */
118 /* Internal helper function that handles blending of uncompressed */
119 /* pixlemap file with alpha channel. */
120 /* */
121 /* INPUT */
122 /* */
123 /* context Drawing context */
124 /* xpos x-coord of top-left draw point*/
125 /* ypos y-coord of top-left draw point*/
126 /* pixelmap Pointer to GX_PIXELMAP struct */
127 /* alpha blending value 0 to 255 */
128 /* */
129 /* OUTPUT */
130 /* */
131 /* None */
132 /* */
133 /* CALLS */
134 /* */
135 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
136 /* */
137 /* CALLED BY */
138 /* */
139 /* _gx_display_driver_24xrgb_pixelmap_blend */
140 /* */
141 /* RELEASE HISTORY */
142 /* */
143 /* DATE NAME DESCRIPTION */
144 /* */
145 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
146 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
147 /* resulting in version 6.1 */
148 /* 06-02-2021 Kenneth Maxwell Modified comment(s), */
149 /* removed unused variable */
150 /* assignment, */
151 /* resulting in version 6.1.7 */
152 /* */
153 /**************************************************************************/
_gx_display_driver_24xrgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)154 static VOID _gx_display_driver_24xrgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context,
155 INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
156 {
157 int xval;
158 int yval;
159 int color;
160 int width;
161 ULONG *get;
162 UCHAR alpha_value;
163 ULONG combined_alpha;
164
165 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
166
167 get = (GX_COLOR *)(pixelmap -> gx_pixelmap_data + (INT)sizeof(GX_COLOR) * pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos));
168 get += (clip -> gx_rectangle_left - xpos);
169
170 width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1;
171
172 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
173 {
174 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
175 {
176 alpha_value = (UCHAR)(*get >> 24);
177
178 if (alpha_value)
179 {
180 combined_alpha = alpha_value;
181 combined_alpha *= alpha;
182 combined_alpha /= 255;
183
184 if (combined_alpha)
185 {
186 color = *get & 0x00ffffff;
187 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, (GX_COLOR)color, (GX_UBYTE)combined_alpha);
188 }
189 }
190 get++;
191 }
192 get += pixelmap -> gx_pixelmap_width - width;
193 }
194 }
195
196
197 /**************************************************************************/
198 /* */
199 /* FUNCTION RELEASE */
200 /* */
201 /* _gx_display_driver_24xrgb_palette_pixelmap_blend PORTABLE C */
202 /* 6.1.7 */
203 /* AUTHOR */
204 /* */
205 /* Kenneth Maxwell, Microsoft Corporation */
206 /* */
207 /* DESCRIPTION */
208 /* */
209 /* Internal helper function that handles writing of uncompressed */
210 /* pixlemap file without transparent of palette pixelmap. */
211 /* */
212 /* INPUT */
213 /* */
214 /* context Drawing context */
215 /* xpos x-coord of top-left draw point*/
216 /* ypos y-coord of top-left draw point*/
217 /* pixelmap Pointer to GX_PIXELMAP struct */
218 /* alpha blending value 0 to 255 */
219 /* */
220 /* OUTPUT */
221 /* */
222 /* None */
223 /* */
224 /* CALLS */
225 /* */
226 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
227 /* */
228 /* CALLED BY */
229 /* */
230 /* _gx_display_driver_24xrgb_pixelmap_blend */
231 /* */
232 /* RELEASE HISTORY */
233 /* */
234 /* DATE NAME DESCRIPTION */
235 /* */
236 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
237 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
238 /* resulting in version 6.1 */
239 /* 06-02-2021 Kenneth Maxwell Modified comment(s), */
240 /* removed unused variable */
241 /* assignment, */
242 /* resulting in version 6.1.7 */
243 /* */
244 /**************************************************************************/
_gx_display_driver_24xrgb_palette_pixelmap_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)245 static VOID _gx_display_driver_24xrgb_palette_pixelmap_blend(GX_DRAW_CONTEXT *context,
246 INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
247 {
248 INT xval;
249 INT yval;
250 GX_COLOR color;
251 INT width;
252 GX_UBYTE *get;
253 GX_COLOR *palette;
254 GX_UBYTE r;
255 GX_UBYTE g;
256 GX_UBYTE b;
257
258 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
259
260 get = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data + pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos));
261 get += (clip -> gx_rectangle_left - xpos);
262
263 palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data;
264
265 width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1;
266
267
268 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
269 {
270 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
271 {
272 r = (GX_UBYTE)REDVAL_32BPP(palette[*get]);
273 g = (GX_UBYTE)GREENVAL_32BPP(palette[*get]);
274 b = (GX_UBYTE)BLUEVAL_32BPP(palette[*get++]);
275
276 color = (GX_COLOR)ASSEMBLECOLOR_24BPP(r, g, b);
277
278 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha);
279 }
280
281 get += pixelmap -> gx_pixelmap_width - width;
282 }
283 }
284
285 /**************************************************************************/
286 /* */
287 /* FUNCTION RELEASE */
288 /* */
289 /* _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend */
290 /* PORTABLE C */
291 /* 6.1.7 */
292 /* AUTHOR */
293 /* */
294 /* Kenneth Maxwell, Microsoft Corporation */
295 /* */
296 /* DESCRIPTION */
297 /* */
298 /* Internal helper function that handles writing of uncompressed */
299 /* pixlemap file with transparent of palette pixelmap. */
300 /* */
301 /* INPUT */
302 /* */
303 /* context Drawing context */
304 /* xpos x-coord of top-left draw point*/
305 /* ypos y-coord of top-left draw point*/
306 /* pixelmap Pointer to GX_PIXELMAP struct */
307 /* alpha blending value 0 to 255 */
308 /* */
309 /* OUTPUT */
310 /* */
311 /* None */
312 /* */
313 /* CALLS */
314 /* */
315 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
316 /* */
317 /* CALLED BY */
318 /* */
319 /* _gx_display_driver_24xrgb_pixelmap_blend */
320 /* */
321 /* RELEASE HISTORY */
322 /* */
323 /* DATE NAME DESCRIPTION */
324 /* */
325 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
326 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
327 /* resulting in version 6.1 */
328 /* 06-02-2021 Kenneth Maxwell Modified comment(s), */
329 /* removed unused variable */
330 /* assignment, */
331 /* resulting in version 6.1.7 */
332 /* */
333 /**************************************************************************/
_gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)334 static VOID _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT *context,
335 INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
336 {
337 INT xval;
338 INT yval;
339 GX_COLOR color;
340 INT width;
341 GX_UBYTE *get;
342 GX_COLOR *palette;
343 GX_UBYTE r;
344 GX_UBYTE g;
345 GX_UBYTE b;
346
347 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
348
349 get = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data + pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos));
350 get += (clip -> gx_rectangle_left - xpos);
351
352 palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data;
353
354 width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1;
355
356 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
357 {
358 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
359 {
360 if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
361 {
362 r = (GX_UBYTE)REDVAL_32BPP(palette[*get]);
363 g = (GX_UBYTE)GREENVAL_32BPP(palette[*get]);
364 b = (GX_UBYTE)BLUEVAL_32BPP(palette[*get]);
365 color = (GX_COLOR)ASSEMBLECOLOR_24BPP(r, g, b);
366 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, color, alpha);
367 }
368 get++;
369 }
370
371 get += pixelmap -> gx_pixelmap_width - width;
372 }
373 }
374
375 /**************************************************************************/
376 /* */
377 /* FUNCTION RELEASE */
378 /* */
379 /* _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend */
380 /* PORTABLE C */
381 /* 6.1 */
382 /* AUTHOR */
383 /* */
384 /* Kenneth Maxwell, Microsoft Corporation */
385 /* */
386 /* DESCRIPTION */
387 /* */
388 /* Internal helper function that handles writing of uncompressed */
389 /* pixlemap file with alpha channel of 4444argb format. */
390 /* */
391 /* INPUT */
392 /* */
393 /* context Drawing context */
394 /* xpos x-coord of top-left draw point*/
395 /* ypos y-coord of top-left draw point*/
396 /* pixelmap Pointer to GX_PIXELMAP struct */
397 /* alpha blending value 0 to 255 */
398 /* */
399 /* OUTPUT */
400 /* */
401 /* None */
402 /* */
403 /* CALLS */
404 /* */
405 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
406 /* */
407 /* CALLED BY */
408 /* */
409 /* _gx_display_driver_24xrgb_pixelmap_blend */
410 /* */
411 /* RELEASE HISTORY */
412 /* */
413 /* DATE NAME DESCRIPTION */
414 /* */
415 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
416 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
417 /* resulting in version 6.1 */
418 /* */
419 /**************************************************************************/
_gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)420 static VOID _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
421 {
422 INT skipcount;
423 INT xval;
424 INT yval;
425 USHORT *getrow;
426 GX_CONST USHORT *get;
427 UCHAR falpha;
428 GX_UBYTE combined_alpha;
429 ULONG pixel;
430
431 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
432
433 /* calculate how many pixels to skip */
434 skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos);
435 skipcount += (clip -> gx_rectangle_left - xpos);
436 getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
437 getrow += skipcount;
438
439 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
440 {
441 get = getrow;
442
443 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
444 {
445 /* 0x000f- -> b , 0x00f0- -> g , 0x0f00- -> r , 0xf000- -> a */
446 /*4444bgra - -> 565rgb*/
447 falpha = (UCHAR)(((*get) & 0xf000) >> 8);
448 if (falpha)
449 {
450 falpha = (GX_UBYTE)(falpha | (falpha >> 4));
451 pixel = (GX_COLOR)((((*get) & 0x0f00) << 12) | (((*get) & 0x00f0) << 8) | (((*get) & 0x000f) << 4));
452 combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
453 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, combined_alpha);
454 }
455 get++;
456 }
457 getrow += pixelmap -> gx_pixelmap_width;
458 }
459 }
460
461 /**************************************************************************/
462 /* */
463 /* FUNCTION RELEASE */
464 /* */
465 /* _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend */
466 /* PORTABLE C */
467 /* 6.1 */
468 /* AUTHOR */
469 /* */
470 /* Kenneth Maxwell, Microsoft Corporation */
471 /* */
472 /* DESCRIPTION */
473 /* */
474 /* Internal helper function that handles writing of non_compressed */
475 /* but with alpha channel pixelmap data of 565rgb format with 32bpp */
476 /* driver. */
477 /* */
478 /* INPUT */
479 /* */
480 /* context Drawing context */
481 /* xpos x-coord of top-left draw point*/
482 /* ypos y-coord of top-left draw point*/
483 /* pixelmap Pointer to GX_PIXELMAP struct */
484 /* alpha blending value 0 to 255 */
485 /* */
486 /* OUTPUT */
487 /* */
488 /* None */
489 /* */
490 /* CALLS */
491 /* */
492 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
493 /* */
494 /* CALLED BY */
495 /* */
496 /* _gx_display_driver_24xrgb_pixelmap_blend */
497 /* */
498 /* RELEASE HISTORY */
499 /* */
500 /* DATE NAME DESCRIPTION */
501 /* */
502 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
503 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
504 /* resulting in version 6.1 */
505 /* */
506 /**************************************************************************/
_gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)507 static VOID _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context,
508 INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
509 {
510 INT skipcount;
511 INT xval;
512 INT yval;
513 GX_CONST GX_UBYTE *getalpha;
514 GX_CONST USHORT *get;
515 USHORT *getrow;
516 GX_UBYTE *getrowalpha;
517 GX_UBYTE r;
518 GX_UBYTE g;
519 GX_UBYTE b;
520 GX_COLOR pixel;
521 GX_UBYTE falpha;
522 GX_UBYTE combined_alpha;
523
524 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
525
526 skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos);
527 skipcount += (clip -> gx_rectangle_left - xpos);
528 getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
529 getrow += skipcount;
530
531 getrowalpha = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data);
532 getrowalpha += skipcount;
533
534 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
535 {
536 get = getrow;
537 getalpha = getrowalpha;
538
539 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
540 {
541 falpha = *getalpha++;
542 if (falpha)
543 {
544 combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
545 pixel = *get;
546 r = (GX_UBYTE)(((USHORT)pixel & 0xf800) >> 8);
547 g = (GX_UBYTE)(((USHORT)pixel & 0x07e0) >> 3);
548 b = (GX_UBYTE)(((USHORT)pixel & 0x001f) << 3);
549 pixel = (GX_COLOR)ASSEMBLECOLOR_32BPP(r, g, b);
550 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, combined_alpha);
551 }
552 get++;
553 }
554 getrow += pixelmap -> gx_pixelmap_width;
555 getrowalpha += pixelmap -> gx_pixelmap_width;
556 }
557 }
558
559 /**************************************************************************/
560 /* */
561 /* FUNCTION RELEASE */
562 /* */
563 /* _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend PORTABLE C */
564 /* 6.1 */
565 /* AUTHOR */
566 /* */
567 /* Kenneth Maxwell, Microsoft Corporation */
568 /* */
569 /* DESCRIPTION */
570 /* */
571 /* Internal helper function that handles writing of 565rgb format */
572 /* uncompressed pixlemap file without alpha channel. */
573 /* */
574 /* INPUT */
575 /* */
576 /* context Drawing context */
577 /* xpos x-coord of top-left draw point*/
578 /* ypos y-coord of top-left draw point*/
579 /* pixelmap Pointer to GX_PIXELMAP struct */
580 /* alpha blending value 0 to 255 */
581 /* */
582 /* OUTPUT */
583 /* */
584 /* None */
585 /* */
586 /* CALLS */
587 /* */
588 /* _gx_display_driver_24xrgb_pixel_blend Display driver basic function */
589 /* */
590 /* CALLED BY */
591 /* */
592 /* _gx_display_driver_24xrgb_pixelmap_blend */
593 /* */
594 /* RELEASE HISTORY */
595 /* */
596 /* DATE NAME DESCRIPTION */
597 /* */
598 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
599 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
600 /* resulting in version 6.1 */
601 /* */
602 /**************************************************************************/
_gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)603 static VOID _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
604 {
605 INT xval;
606 INT yval;
607 USHORT *getrow;
608 GX_CONST USHORT *get;
609 GX_COLOR pixel;
610
611 GX_RECTANGLE *clip = context -> gx_draw_context_clip;
612
613 getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
614 getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos);
615 getrow += (clip -> gx_rectangle_left - xpos);
616
617 for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
618 {
619 get = getrow;
620
621 for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
622 {
623 pixel = (GX_COLOR)ASSEMBLECOLOR_32BPP(REDVAL_16BPP(*get) << 3,
624 GREENVAL_16BPP(*get) << 2,
625 BLUEVAL_16BPP(*get) << 3);
626 _gx_display_driver_24xrgb_pixel_blend(context, xval, yval, pixel, alpha);
627 get++;
628 }
629 getrow += pixelmap -> gx_pixelmap_width;
630 }
631 }
632
633 /**************************************************************************/
634 /* */
635 /* FUNCTION RELEASE */
636 /* */
637 /* _gx_display_driver_24xrgb_pixelmap_blend PORTABLE C */
638 /* 6.1 */
639 /* AUTHOR */
640 /* */
641 /* Kenneth Maxwell, Microsoft Corporation */
642 /* */
643 /* DESCRIPTION */
644 /* */
645 /* 32xrgb format screen driver pixelmap blending function that */
646 /* handles compressed or uncompress, with or without alpha channel. */
647 /* */
648 /* INPUT */
649 /* */
650 /* context Drawing context */
651 /* xpos x-coord of top-left draw point*/
652 /* ypos y-coord of top-left draw point*/
653 /* pixelmap Pointer to GX_PIXELMAP struct */
654 /* alpha blending value 0 to 255 */
655 /* */
656 /* OUTPUT */
657 /* */
658 /* None */
659 /* */
660 /* CALLS */
661 /* */
662 /* _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend */
663 /* Real pixelmap draw function. */
664 /* _gx_display_driver_24xrgb_palette_pixelmap_blend */
665 /* Real pixelmap draw function. */
666 /* _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend */
667 /* Real pixelmap draw function. */
668 /* _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend */
669 /* Real pixelmap draw function. */
670 /* _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend */
671 /* Real pixelmap draw function. */
672 /* _gx_display_driver_24xrgb_pixelmap_alpha_blend */
673 /* Real pixelmap draw function. */
674 /* _gx_display_driver_24xrgb_pixelmap_raw_blend */
675 /* Real pixelmap draw function. */
676 /* */
677 /* CALLED BY */
678 /* */
679 /* GUIX Internal Code */
680 /* */
681 /* RELEASE HISTORY */
682 /* */
683 /* DATE NAME DESCRIPTION */
684 /* */
685 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
686 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
687 /* resulting in version 6.1 */
688 /* */
689 /**************************************************************************/
_gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap,GX_UBYTE alpha)690 VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context,
691 INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
692 {
693 if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
694 {
695 return;
696 }
697
698 switch (pixelmap -> gx_pixelmap_format)
699 {
700 case GX_COLOR_FORMAT_8BIT_PALETTE:
701 if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
702 {
703 _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha);
704 }
705 else
706 {
707 _gx_display_driver_24xrgb_palette_pixelmap_blend(context, xpos, ypos, pixelmap, alpha);
708 }
709 break;
710
711 case GX_COLOR_FORMAT_4444ARGB:
712 _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
713 break;
714
715 case GX_COLOR_FORMAT_565RGB:
716 if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
717 {
718 _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
719 }
720 else
721 {
722 _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
723 }
724 break;
725
726 case GX_COLOR_FORMAT_24XRGB:
727 case GX_COLOR_FORMAT_32ARGB:
728 if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
729 {
730 _gx_display_driver_24xrgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
731
732 }
733 else
734 {
735 _gx_display_driver_24xrgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
736 }
737 break;
738 }
739
740 return;
741 }
742