GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_24xrgb_pixelmap_blend.c Lines: 142 142 100.0 %
Date: 2024-12-05 08:52:37 Branches: 51 51 100.0 %

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

10963
    switch (pixelmap -> gx_pixelmap_format)
698
    {
699
9
    case GX_COLOR_FORMAT_8BIT_PALETTE:
700
9
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
701
        {
702
2
            _gx_display_driver_24xrgb_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha);
703
        }
704
        else
705
        {
706
7
            _gx_display_driver_24xrgb_palette_pixelmap_blend(context, xpos, ypos, pixelmap, alpha);
707
        }
708
9
        break;
709
710
9
    case GX_COLOR_FORMAT_4444ARGB:
711
9
        _gx_display_driver_24xrgb_4444argb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
712
9
        break;
713
714
7
    case GX_COLOR_FORMAT_565RGB:
715
7
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
716
        {
717
4
            _gx_display_driver_24xrgb_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
718
        }
719
        else
720
        {
721
3
            _gx_display_driver_24xrgb_565rgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
722
        }
723
7
        break;
724
725
10937
    case GX_COLOR_FORMAT_24XRGB:
726
    case GX_COLOR_FORMAT_32ARGB:
727
10937
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
728
        {
729
9972
            _gx_display_driver_24xrgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
730
731
        }
732
        else
733
        {
734
965
            _gx_display_driver_24xrgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
735
        }
736
10937
        break;
737
    }
738
739
10963
    return;
740
}