GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_horizontal_pixelmap_line_draw.c Lines: 338 338 100.0 %
Date: 2024-12-05 08:52:37 Branches: 226 226 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
#include "gx_context.h"
29
30
#if defined(GX_BRUSH_ALPHA_SUPPORT)
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend          */
37
/*                                                        PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    Internal helper function that handles blending of uncompressed      */
46
/*    pixlemap file without alpha channel with brush alpha.               */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    context                               Drawing context               */
51
/*    xstart                                x-coord of line left          */
52
/*    xend                                  x-coord of line right         */
53
/*    y                                     y-coord of line top           */
54
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
55
/*    alpha                                 Alpha value                   */
56
/*                                                                        */
57
/*  OUTPUT                                                                */
58
/*                                                                        */
59
/*    None                                                                */
60
/*                                                                        */
61
/*  CALLS                                                                 */
62
/*                                                                        */
63
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
64
/*                                            blend function              */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
69
/*                                                                        */
70
/*  RELEASE HISTORY                                                       */
71
/*                                                                        */
72
/*    DATE              NAME                      DESCRIPTION             */
73
/*                                                                        */
74
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76
/*                                            resulting in version 6.1    */
77
/*                                                                        */
78
/**************************************************************************/
79
10522
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend(GX_DRAW_CONTEXT *context,
80
                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
81
{
82
INT                xval;
83
INT                offset;
84
INT                pic_width;
85
GX_CONST GX_UBYTE *get;
86
GX_PIXELMAP       *pixelmap;
87
VOID               (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
88
89
10522
    pixelmap = info -> pixelmap;
90
91
10522
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
92
10522
    if (blend_func == GX_NULL)
93
    {
94
629
        return;
95
    }
96
97
9893
    pic_width = pixelmap -> gx_pixelmap_width;
98
99

9893
    if ((info -> draw) && (xstart <= xend))
100
    {
101
9813
        get = info -> current_pixel_ptr;
102
103
        /* Calculate the map offset in x-axis. */
104
9813
        offset = (info -> x_offset % pic_width);
105
106
2508581
        for (xval = xstart; xval <= xend; xval++)
107
        {
108
            /* get points to the start postion of this row. So we need to calculate its position. */
109
2498768
            blend_func(context, xval, y, *(get + offset), alpha);
110
2498768
            offset++;
111
2498768
            if (offset >= pic_width)
112
            {
113
10987
                offset -= pic_width;
114
            }
115
        }
116
    }
117
118
    /* This line is drawn. Update the pointer position for next row. */
119
9893
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
120
}
121
122
/**************************************************************************/
123
/*                                                                        */
124
/*  FUNCTION                                               RELEASE        */
125
/*                                                                        */
126
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend   */
127
/*                                                        PORTABLE C      */
128
/*                                                           6.1          */
129
/*  AUTHOR                                                                */
130
/*                                                                        */
131
/*    Kenneth Maxwell, Microsoft Corporation                              */
132
/*                                                                        */
133
/*  DESCRIPTION                                                           */
134
/*                                                                        */
135
/*    Internal helper function that handles blending of compressed        */
136
/*    pixlemap file with brush alpha.                                     */
137
/*                                                                        */
138
/*  INPUT                                                                 */
139
/*                                                                        */
140
/*    context                               Drawing context               */
141
/*    xstart                                x-coord of line left          */
142
/*    xend                                  x-coord of line right         */
143
/*    y                                     y-coord of line top           */
144
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
145
/*    alpha                                 Alpha value                   */
146
/*                                                                        */
147
/*  OUTPUT                                                                */
148
/*                                                                        */
149
/*    None                                                                */
150
/*                                                                        */
151
/*  CALLS                                                                 */
152
/*                                                                        */
153
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
154
/*                                            blend function              */
155
/*                                                                        */
156
/*  CALLED BY                                                             */
157
/*                                                                        */
158
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
159
/*                                                                        */
160
/*  RELEASE HISTORY                                                       */
161
/*                                                                        */
162
/*    DATE              NAME                      DESCRIPTION             */
163
/*                                                                        */
164
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
165
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
166
/*                                            resulting in version 6.1    */
167
/*                                                                        */
168
/**************************************************************************/
169
10522
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend(GX_DRAW_CONTEXT *context,
170
                                                                              INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
171
{
172
INT                start_pos;
173
INT                xval;
174
GX_UBYTE           count;
175
10522
GX_CONST GX_UBYTE *get = GX_NULL;
176
GX_UBYTE           pixel;
177
GX_PIXELMAP       *pixelmap;
178
VOID               (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
179
180
10522
    pixelmap = info -> pixelmap;
181
10522
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
182
10522
    if (blend_func == GX_NULL)
183
    {
184
629
        return;
185
    }
186
187

9893
    if ((info -> draw) && (xstart <= xend))
188
    {
189
        /* This means it's the draw operation. */
190
        /* Skip the invisible pixels.*/
191
9813
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
192
193
        /*Repeat the draw operation to fill the whole dirty area.*/
194
33642
        while (start_pos <= xend)
195
        {
196
23829
            xval = start_pos;
197
198
            /*Start from where we need to repeat.*/
199
23829
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
200
201
386986
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
202
            {
203
363157
                count = *get++;
204
363157
                if (count & 0x80)
205
                {
206
239639
                    count = (GX_UBYTE)((count & 0x7f) + 1);
207
239639
                    pixel = *get++;
208
3452260
                    while (count--)
209
                    {
210

3212621
                        if (xval >= xstart && xval <= xend)
211
                        {
212
2203776
                            blend_func(context, xval, y, pixel, alpha);
213
                        }
214
3212621
                        xval++;
215
                    }
216
                }
217
                else
218
                {
219
123518
                    count++;
220
531483
                    while (count--)
221
                    {
222
407965
                        pixel = *get++;
223

407965
                        if (xval >= xstart && xval <= xend)
224
                        {
225
294992
                            blend_func(context, xval, y, pixel, alpha);
226
                        }
227
407965
                        xval++;
228
                    }
229
                }
230
            }
231
23829
            start_pos += pixelmap -> gx_pixelmap_width;
232
        }
233
    }
234
    else
235
    {
236
80
        xval = 0;
237
80
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
238
325
        while (xval < pixelmap -> gx_pixelmap_width)
239
        {
240
245
            count = *get++;
241
245
            if (count & 0x80)
242
            {
243
113
                count = (GX_UBYTE)((count & 0x7f) + 1);
244
113
                get++;
245
            }
246
            else
247
            {
248
132
                count++;
249
132
                get += count;
250
            }
251
245
            xval += count;
252
        }
253
    }
254
255
    /* This line is drawn. cache the pointer for next line draw. */
256
9893
    info -> current_pixel_ptr = (GX_UBYTE *)get;
257
}
258
259
/**************************************************************************/
260
/*                                                                        */
261
/*  FUNCTION                                               RELEASE        */
262
/*                                                                        */
263
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend        */
264
/*                                                        PORTABLE C      */
265
/*                                                           6.1          */
266
/*  AUTHOR                                                                */
267
/*                                                                        */
268
/*    Kenneth Maxwell, Microsoft Corporation                              */
269
/*                                                                        */
270
/*  DESCRIPTION                                                           */
271
/*                                                                        */
272
/*    Internal helper function that handles blending of uncompressed      */
273
/*    pixlemap file with alpha channel with brush alpha.                  */
274
/*                                                                        */
275
/*  INPUT                                                                 */
276
/*                                                                        */
277
/*    context                               Drawing context               */
278
/*    xstart                                x-coord of line left          */
279
/*    xend                                  x-coord of line end           */
280
/*    y                                     y-coord of line top           */
281
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
282
/*    alpha                                 Alpha value                   */
283
/*                                                                        */
284
/*  OUTPUT                                                                */
285
/*                                                                        */
286
/*    None                                                                */
287
/*                                                                        */
288
/*  CALLS                                                                 */
289
/*                                                                        */
290
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
291
/*                                            blend function              */
292
/*                                                                        */
293
/*  CALLED BY                                                             */
294
/*                                                                        */
295
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
296
/*                                                                        */
297
/*  RELEASE HISTORY                                                       */
298
/*                                                                        */
299
/*    DATE              NAME                      DESCRIPTION             */
300
/*                                                                        */
301
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
302
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
303
/*                                            resulting in version 6.1    */
304
/*                                                                        */
305
/**************************************************************************/
306
10960
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend(GX_DRAW_CONTEXT *context,
307
                                                                         INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
308
{
309
INT                xval;
310
GX_CONST GX_UBYTE *get;
311
GX_CONST GX_UBYTE *get_alpha;
312
GX_UBYTE           falpha;
313
GX_UBYTE           pixel;
314
GX_PIXELMAP       *pixelmap;
315
INT                pic_width;
316
INT                offset;
317
GX_UBYTE           combined_alpha;
318
VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
319
320
10960
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
321
10960
    pixelmap = info -> pixelmap;
322
323
10960
    if (blend_func == GX_NULL)
324
    {
325
848
        return;
326
    }
327
328
10112
    pic_width = pixelmap -> gx_pixelmap_width;
329

10112
    if ((info -> draw) && (xstart <= xend))
330
    {
331
9813
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
332
9813
        get_alpha = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
333
334
        /*calculate the offset.*/
335
9813
        offset = (info -> x_offset % pic_width);
336
337
2508581
        for (xval = xstart; xval <= xend; xval++)
338
        {
339
            /*get points to the start postion of this row. So we need to calculate its position.*/
340
2498768
            pixel = *(get + offset);
341
2498768
            falpha = *(get_alpha + offset);
342
2498768
            if (falpha)
343
            {
344
997447
                combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
345
997447
                blend_func(context, xval, y, pixel, combined_alpha);
346
            }
347
348
2498768
            offset++;
349
2498768
            if (offset >= pic_width)
350
            {
351
63007
                offset -= pic_width;
352
            }
353
        }
354
    }
355
356
10112
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
357
10112
    info -> current_aux_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
358
}
359
360
361
/**************************************************************************/
362
/*                                                                        */
363
/*  FUNCTION                                               RELEASE        */
364
/*                                                                        */
365
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha   */
366
/*        _blend                                                          */
367
/*                                                        PORTABLE C      */
368
/*                                                           6.1          */
369
/*  AUTHOR                                                                */
370
/*                                                                        */
371
/*    Kenneth Maxwell, Microsoft Corporation                              */
372
/*                                                                        */
373
/*  DESCRIPTION                                                           */
374
/*                                                                        */
375
/*    Internal helper function that handles blending of compressed        */
376
/*    pixlemap file with alpha channel.                                   */
377
/*                                                                        */
378
/*  INPUT                                                                 */
379
/*                                                                        */
380
/*    context                               Drawing context               */
381
/*    xstart                                x-coord of line left          */
382
/*    xend                                  x-coord of line end           */
383
/*    y                                     y-coord of line top           */
384
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
385
/*    alpha                                 Alpha value                   */
386
/*                                                                        */
387
/*  OUTPUT                                                                */
388
/*                                                                        */
389
/*    None                                                                */
390
/*                                                                        */
391
/*  CALLS                                                                 */
392
/*                                                                        */
393
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
394
/*                                            blend function              */
395
/*                                                                        */
396
/*  CALLED BY                                                             */
397
/*                                                                        */
398
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
399
/*                                                                        */
400
/*  RELEASE HISTORY                                                       */
401
/*                                                                        */
402
/*    DATE              NAME                      DESCRIPTION             */
403
/*                                                                        */
404
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
405
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
406
/*                                            resulting in version 6.1    */
407
/*                                                                        */
408
/**************************************************************************/
409
10494
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_blend(GX_DRAW_CONTEXT *context,
410
                                                                                    INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
411
{
412
INT              xval;
413
USHORT           count;
414
INT              start_pos;
415
GX_UBYTE         falpha;
416
GX_UBYTE         combined_alpha;
417
USHORT           pixel;
418
10494
GX_CONST USHORT *get = GX_NULL;
419
GX_PIXELMAP     *pixelmap;
420
VOID             (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
421
422
10494
    pixelmap = info -> pixelmap;
423
10494
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
424
425
10494
    if (blend_func == GX_NULL)
426
    {
427
615
        return;
428
    }
429
430

9879
    if ((info -> draw) && (xstart <= xend))
431
    {
432
        /* Calcualte draw start position. */
433
9813
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
434
435
        /*Repeat the draw operation to fill the whole dirty area.*/
436
35341
        while (start_pos <= xend)
437
        {
438
25528
            xval = start_pos;
439
25528
            get = (GX_CONST USHORT *)info -> current_pixel_ptr;
440
203278
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
441
            {
442
177750
                count = *get++;
443
444
177750
                if (count & 0x8000)
445
                {
446
                    /* repeated value */
447
109686
                    count = (USHORT)((count & 0x7fff) + 1u);
448
109686
                    pixel = *get++;
449
109686
                    falpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
450
109686
                    combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
451
109686
                    if (combined_alpha)
452
                    {
453
1398137
                        while (count--)
454
                        {
455

1360248
                            if (xval >= xstart && xval <= xend)
456
                            {
457
921150
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), combined_alpha);
458
                            }
459
1360248
                            xval++;
460
                        }
461
                    }
462
                    else
463
                    {
464
71797
                        xval += count;
465
                    }
466
                }
467
                else
468
                {
469
                    /* string of non-repeated values */
470
68064
                    count++;
471
308409
                    while (count--)
472
                    {
473

240345
                        if (xval >= xstart && xval <= xend)
474
                        {
475
166755
                            pixel = *get;
476
166755
                            falpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
477
166755
                            combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
478
166755
                            blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), combined_alpha);
479
                        }
480
240345
                        get++;
481
240345
                        xval++;
482
                    }
483
                }
484
            }
485
25528
            start_pos += pixelmap -> gx_pixelmap_width;
486
        }
487
    }
488
    else
489
    {
490
66
        xval = 0;
491
66
        get = (GX_CONST USHORT *)info -> current_pixel_ptr;
492
493
355
        while (xval < pixelmap -> gx_pixelmap_width)
494
        {
495
289
            count = *get++;
496
289
            if (count & 0x8000)
497
            {
498
157
                count = (USHORT)((count & 0x7fff) + 1);
499
157
                get++;
500
            }
501
            else
502
            {
503
132
                count++;
504
132
                get += count;
505
            }
506
289
            xval += count;
507
        }
508
    }
509
510
    /* This line is drawn. cache the pointer for next line draw. */
511
9879
    info -> current_pixel_ptr = (GX_UBYTE *)get;
512
}
513
514
#endif /* GX_BRUSH_ALPHA_SUPPORT */
515
516
/**************************************************************************/
517
/*                                                                        */
518
/*  FUNCTION                                               RELEASE        */
519
/*                                                                        */
520
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write          */
521
/*                                                        PORTABLE C      */
522
/*                                                           6.1          */
523
/*  AUTHOR                                                                */
524
/*                                                                        */
525
/*    Kenneth Maxwell, Microsoft Corporation                              */
526
/*                                                                        */
527
/*  DESCRIPTION                                                           */
528
/*                                                                        */
529
/*    Internal helper function that handles writing of uncompressed       */
530
/*    pixlemap file without alpha channel.                                */
531
/*                                                                        */
532
/*  INPUT                                                                 */
533
/*                                                                        */
534
/*    context                               Drawing context               */
535
/*    xstart                                x-coord of line left          */
536
/*    xend                                  x-coord of line right         */
537
/*    y                                     y-coord of line top           */
538
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
539
/*                                                                        */
540
/*  OUTPUT                                                                */
541
/*                                                                        */
542
/*    None                                                                */
543
/*                                                                        */
544
/*  CALLED BY                                                             */
545
/*                                                                        */
546
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
547
/*                                                                        */
548
/*  RELEASE HISTORY                                                       */
549
/*                                                                        */
550
/*    DATE              NAME                      DESCRIPTION             */
551
/*                                                                        */
552
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
553
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
554
/*                                            resulting in version 6.1    */
555
/*                                                                        */
556
/**************************************************************************/
557
39034
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(GX_DRAW_CONTEXT *context,
558
                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
559
{
560
INT                xval;
561
INT                offset;
562
INT                pic_width;
563
GX_CONST GX_UBYTE *get;
564
GX_UBYTE          *put;
565
GX_PIXELMAP       *pixelmap;
566
567
39034
    pixelmap = info -> pixelmap;
568
569
39034
    pic_width = pixelmap -> gx_pixelmap_width;
570
571

39034
    if ((info -> draw) && (xstart <= xend))
572
    {
573
38554
        get = info -> current_pixel_ptr;
574
38554
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
575
38554
        put += y * context -> gx_draw_context_pitch + xstart;
576
577
        /* Calculate the map offset in x-axis. */
578
38554
        offset = (info -> x_offset % pic_width);
579
580
5946346
        for (xval = xstart; xval <= xend; xval++)
581
        {
582
            /* get points to the start postion of this row. So we need to calculate its position. */
583
5907792
            *put++ = *(get + offset);
584
5907792
            offset++;
585
5907792
            if (offset >= pic_width)
586
            {
587
35142
                offset -= pic_width;
588
            }
589
        }
590
    }
591
592
    /* This line is drawn. Update the pointer position for next row. */
593
39034
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
594
39034
}
595
596
/**************************************************************************/
597
/*                                                                        */
598
/*  FUNCTION                                               RELEASE        */
599
/*                                                                        */
600
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write   */
601
/*                                                        PORTABLE C      */
602
/*                                                           6.1          */
603
/*  AUTHOR                                                                */
604
/*                                                                        */
605
/*    Kenneth Maxwell, Microsoft Corporation                              */
606
/*                                                                        */
607
/*  DESCRIPTION                                                           */
608
/*                                                                        */
609
/*    Internal helper function that handles writing of compressed         */
610
/*    pixlemap file.                                                      */
611
/*                                                                        */
612
/*  INPUT                                                                 */
613
/*                                                                        */
614
/*    context                               Drawing context               */
615
/*    xstart                                x-coord of line left          */
616
/*    xend                                  x-coord of line right         */
617
/*    y                                     y-coord of line top           */
618
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
619
/*                                                                        */
620
/*  OUTPUT                                                                */
621
/*                                                                        */
622
/*    None                                                                */
623
/*                                                                        */
624
/*  CALLS                                                                 */
625
/*                                                                        */
626
/*    None                                                                */
627
/*                                                                        */
628
/*  CALLED BY                                                             */
629
/*                                                                        */
630
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
631
/*                                                                        */
632
/*  RELEASE HISTORY                                                       */
633
/*                                                                        */
634
/*    DATE              NAME                      DESCRIPTION             */
635
/*                                                                        */
636
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
637
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
638
/*                                            resulting in version 6.1    */
639
/*                                                                        */
640
/**************************************************************************/
641
63834
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(GX_DRAW_CONTEXT *context,
642
                                                                              INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
643
{
644
INT                start_pos;
645
INT                xval;
646
GX_UBYTE           count;
647
63834
GX_CONST GX_UBYTE *get = GX_NULL;
648
GX_UBYTE           pixel;
649
GX_UBYTE          *put;
650
GX_PIXELMAP       *pixelmap;
651
652
63834
    pixelmap = info -> pixelmap;
653
654

63834
    if ((info -> draw) && (xstart <= xend))
655
    {
656
        /* Calculate draw start position. */
657
58594
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
658
659
58594
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
660
58594
        put += y * context -> gx_draw_context_pitch + start_pos;
661
662
        /*Repeat the draw operation to fill the whole dirty area.*/
663
231980
        while (start_pos <= xend)
664
        {
665
173386
            xval = start_pos;
666
667
            /*Start from where we need to repeat.*/
668
173386
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
669
670
1389460
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
671
            {
672
1216074
                count = *get++;
673
1216074
                if (count & 0x80)
674
                {
675
735446
                    count = (GX_UBYTE)((count & 0x7f) + 1);
676
735446
                    pixel = *get++;
677
9798968
                    while (count--)
678
                    {
679

9063522
                        if (xval >= xstart && xval <= xend)
680
                        {
681
5255792
                            *put = pixel;
682
                        }
683
9063522
                        xval++;
684
9063522
                        put++;
685
                    }
686
                }
687
                else
688
                {
689
480628
                    count++;
690
3090006
                    while (count--)
691
                    {
692
2609378
                        pixel = *get++;
693

2609378
                        if (xval >= xstart && xval <= xend)
694
                        {
695
1850000
                            *put = pixel;
696
                        }
697
2609378
                        xval++;
698
2609378
                        put++;
699
                    }
700
                }
701
            }
702
173386
            start_pos += pixelmap -> gx_pixelmap_width;
703
        }
704
    }
705
    else
706
    {
707
5240
        xval = 0;
708
5240
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
709
14714
        while (xval < pixelmap -> gx_pixelmap_width)
710
        {
711
9474
            count = *get++;
712
9474
            if (count & 0x80)
713
            {
714
3378
                count = (GX_UBYTE)((count & 0x7f) + 1);
715
3378
                get++;
716
            }
717
            else
718
            {
719
6096
                count++;
720
6096
                get += count;
721
            }
722
9474
            xval += count;
723
        }
724
    }
725
726
    /*This line is drawn. cache the pointer for next line draw.*/
727
63834
    info -> current_pixel_ptr = (GX_UBYTE *)get;
728
63834
}
729
730
/**************************************************************************/
731
/*                                                                        */
732
/*  FUNCTION                                               RELEASE        */
733
/*                                                                        */
734
/*    _gx_display_driver_8bpp_horizontal_line_pixelmap_transparent_write  */
735
/*                                                        PORTABLE C      */
736
/*                                                           6.1          */
737
/*  AUTHOR                                                                */
738
/*                                                                        */
739
/*    Kenneth Maxwell, Microsoft Corporation                              */
740
/*                                                                        */
741
/*  DESCRIPTION                                                           */
742
/*                                                                        */
743
/*    Internal helper function that handles writing of uncompressed       */
744
/*    pixlemap file with alpha channel.                                   */
745
/*                                                                        */
746
/*  INPUT                                                                 */
747
/*                                                                        */
748
/*    context                               Drawing context               */
749
/*    xstart                                x-coord of line left          */
750
/*    xend                                  x-coord of line right         */
751
/*    y                                     y-coord of line top           */
752
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
753
/*                                                                        */
754
/*  OUTPUT                                                                */
755
/*                                                                        */
756
/*    None                                                                */
757
/*                                                                        */
758
/*  CALLS                                                                 */
759
/*                                                                        */
760
/*    None                                                                */
761
/*                                                                        */
762
/*  CALLED BY                                                             */
763
/*                                                                        */
764
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
765
/*                                                                        */
766
/*  RELEASE HISTORY                                                       */
767
/*                                                                        */
768
/*    DATE              NAME                      DESCRIPTION             */
769
/*                                                                        */
770
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
771
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
772
/*                                            resulting in version 6.1    */
773
/*                                                                        */
774
/**************************************************************************/
775
97320
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write(GX_DRAW_CONTEXT *context,
776
                                                                               INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
777
{
778
INT                xval;
779
INT                offset;
780
INT                pic_width;
781
GX_CONST GX_UBYTE *get;
782
GX_UBYTE          *put;
783
GX_PIXELMAP       *pixelmap;
784
GX_UBYTE           pixel;
785
786
97320
    pixelmap = info -> pixelmap;
787
97320
    pic_width = pixelmap -> gx_pixelmap_width;
788
789

97320
    if ((info -> draw) && (xstart <= xend))
790
    {
791
78928
        get = info -> current_pixel_ptr;
792
78928
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
793
78928
        put += y * context -> gx_draw_context_pitch + xstart;
794
795
        /* Calculate the map offset in x-axis. */
796
78928
        offset = (info -> x_offset % pic_width);
797
798
10908616
        for (xval = xstart; xval <= xend; xval++)
799
        {
800
            /* get points to the start postion of this row. So we need to calculate its position. */
801
10829688
            pixel = *(get + offset);
802
10829688
            offset++;
803
10829688
            if (offset >= pic_width)
804
            {
805
674896
                offset -= pic_width;
806
            }
807
808
10829688
            if (pixel != pixelmap -> gx_pixelmap_transparent_color)
809
            {
810
8847352
                *put = pixel;
811
            }
812
10829688
            put++;
813
        }
814
    }
815
816
    /* This line is drawn. Update the pointer position for next row. */
817
97320
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
818
97320
}
819
820
/**************************************************************************/
821
/*                                                                        */
822
/*  FUNCTION                                               RELEASE        */
823
/*                                                                        */
824
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_        */
825
/*    transparent_write                                                   */
826
/*                                                        PORTABLE C      */
827
/*                                                           6.1          */
828
/*  AUTHOR                                                                */
829
/*                                                                        */
830
/*    Kenneth Maxwell, Microsoft Corporation                              */
831
/*                                                                        */
832
/*  DESCRIPTION                                                           */
833
/*                                                                        */
834
/*    Internal helper function that handles writing of compressed         */
835
/*    pixlemap file with alpha channel.                                   */
836
/*                                                                        */
837
/*  INPUT                                                                 */
838
/*                                                                        */
839
/*    context                               Drawing context               */
840
/*    xstart                                x-coord of line left          */
841
/*    xend                                  x-coord of line right         */
842
/*    y                                     y-coord of line top           */
843
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
844
/*                                                                        */
845
/*  OUTPUT                                                                */
846
/*                                                                        */
847
/*    None                                                                */
848
/*                                                                        */
849
/*  CALLS                                                                 */
850
/*                                                                        */
851
/*    None                                                                */
852
/*                                                                        */
853
/*  CALLED BY                                                             */
854
/*                                                                        */
855
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
856
/*                                                                        */
857
/*  RELEASE HISTORY                                                       */
858
/*                                                                        */
859
/*    DATE              NAME                      DESCRIPTION             */
860
/*                                                                        */
861
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
862
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
863
/*                                            resulting in version 6.1    */
864
/*                                                                        */
865
/**************************************************************************/
866
6670
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_transparent_write(GX_DRAW_CONTEXT *context,
867
                                                                                          INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
868
{
869
INT                start_pos;
870
INT                xval;
871
GX_UBYTE           count;
872
6670
GX_CONST GX_UBYTE *get = GX_NULL;
873
GX_UBYTE           pixel;
874
GX_UBYTE          *put;
875
GX_PIXELMAP       *pixelmap;
876
877
6670
    pixelmap = info -> pixelmap;
878
879

6670
    if ((info -> draw) && (xstart <= xend))
880
    {
881
        /* Calcualte draw start position. */
882
6446
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
883
884
6446
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
885
6446
        put += y * context -> gx_draw_context_pitch + start_pos;
886
887
888
        /*Repeat the draw operation to fill the whole dirty area.*/
889
31580
        while (start_pos <= xend)
890
        {
891
25134
            xval = start_pos;
892
893
            /*Start from where we need to repeat.*/
894
25134
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
895
896
94246
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
897
            {
898
69112
                count = *get++;
899
69112
                if (count & 0x80)
900
                {
901
28020
                    count = (GX_UBYTE)((count & 0x7f) + 1);
902
28020
                    pixel = *get++;
903
28020
                    if (pixel != pixelmap -> gx_pixelmap_transparent_color)
904
                    {
905
163198
                        while (count--)
906
                        {
907

147240
                            if (xval >= xstart && xval <= xend)
908
                            {
909
128067
                                *put = pixel;
910
                            }
911
147240
                            xval++;
912
147240
                            put++;
913
                        }
914
                    }
915
                    else
916
                    {
917
12062
                        xval += count;
918
12062
                        put += count;
919
                    }
920
                }
921
                else
922
                {
923
41092
                    count++;
924
247913
                    while (count--)
925
                    {
926
206821
                        pixel = *get++;
927
928

206821
                        if (xval >= xstart && xval <= xend)
929
                        {
930
171375
                            if (pixel != pixelmap -> gx_pixelmap_transparent_color)
931
                            {
932
149643
                                *put = pixel;
933
                            }
934
                        }
935
206821
                        xval++;
936
206821
                        put++;
937
                    }
938
                }
939
            }
940
25134
            start_pos += pixelmap -> gx_pixelmap_width;
941
        }
942
    }
943
    else
944
    {
945
224
        xval = 0;
946
224
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
947
866
        while (xval < pixelmap -> gx_pixelmap_width)
948
        {
949
642
            count = *get++;
950
642
            if (count & 0x80)
951
            {
952
305
                count = (GX_UBYTE)((count & 0x7f) + 1);
953
305
                get++;
954
            }
955
            else
956
            {
957
337
                count++;
958
337
                get += count;
959
            }
960
642
            xval += count;
961
        }
962
    }
963
964
    /* This line is drawn. cache the pointer for next line draw.*/
965
6670
    info -> current_pixel_ptr = (GX_UBYTE *)get;
966
6670
}
967
968
/**************************************************************************/
969
/*                                                                        */
970
/*  FUNCTION                                               RELEASE        */
971
/*                                                                        */
972
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write        */
973
/*                                                        PORTABLE C      */
974
/*                                                           6.1          */
975
/*  AUTHOR                                                                */
976
/*                                                                        */
977
/*    Kenneth Maxwell, Microsoft Corporation                              */
978
/*                                                                        */
979
/*  DESCRIPTION                                                           */
980
/*                                                                        */
981
/*    Internal helper function that handles writing of uncompressed       */
982
/*    pixlemap file with alpha channel.                                   */
983
/*                                                                        */
984
/*  INPUT                                                                 */
985
/*                                                                        */
986
/*    context                               Drawing context               */
987
/*    xstart                                x-coord of line left          */
988
/*    xend                                  x-coord of line end           */
989
/*    y                                     y-coord of line top           */
990
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
991
/*    alpha                                 Alpha value                   */
992
/*                                                                        */
993
/*  OUTPUT                                                                */
994
/*                                                                        */
995
/*    None                                                                */
996
/*                                                                        */
997
/*  CALLS                                                                 */
998
/*                                                                        */
999
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
1000
/*                                            blend function              */
1001
/*    [gx_display_driver_pixel_write]       Basic display driver pixel    */
1002
/*                                            write function              */
1003
/*                                                                        */
1004
/*  CALLED BY                                                             */
1005
/*                                                                        */
1006
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
1007
/*                                                                        */
1008
/*  RELEASE HISTORY                                                       */
1009
/*                                                                        */
1010
/*    DATE              NAME                      DESCRIPTION             */
1011
/*                                                                        */
1012
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
1013
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
1014
/*                                            resulting in version 6.1    */
1015
/*                                                                        */
1016
/**************************************************************************/
1017
33472
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write(GX_DRAW_CONTEXT *context,
1018
                                                                         INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1019
{
1020
INT                xval;
1021
GX_CONST GX_UBYTE *get;
1022
GX_CONST GX_UBYTE *get_alpha;
1023
GX_UBYTE           alpha;
1024
GX_UBYTE           pixel;
1025
GX_PIXELMAP       *pixelmap;
1026
INT                pic_width;
1027
INT                offset;
1028
VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
1029
1030
33472
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
1031
33472
    pixelmap = info -> pixelmap;
1032
1033
33472
    if (blend_func == GX_NULL)
1034
    {
1035
848
        return;
1036
    }
1037
1038
32624
    pic_width = pixelmap -> gx_pixelmap_width;
1039

32624
    if ((info -> draw) && (xstart <= xend))
1040
    {
1041
32101
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
1042
32101
        get_alpha = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
1043
1044
        /*calculate the offset.*/
1045
32101
        offset = (info -> x_offset % pic_width);
1046
1047
5600581
        for (xval = xstart; xval <= xend; xval++)
1048
        {
1049
            /*get points to the start postion of this row. So we need to calculate its position.*/
1050
5568480
            pixel = *(get + offset);
1051
5568480
            alpha = *(get_alpha + offset);
1052
1053
5568480
            blend_func(context, xval, y, pixel, alpha);
1054
1055
5568480
            offset++;
1056
5568480
            if (offset >= pic_width)
1057
            {
1058
139919
                offset -= pic_width;
1059
            }
1060
        }
1061
    }
1062
1063
32624
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
1064
32624
    info -> current_aux_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
1065
}
1066
1067
/**************************************************************************/
1068
/*                                                                        */
1069
/*  FUNCTION                                               RELEASE        */
1070
/*                                                                        */
1071
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha   */
1072
/*        _write                                                          */
1073
/*                                                        PORTABLE C      */
1074
/*                                                           6.1          */
1075
/*  AUTHOR                                                                */
1076
/*                                                                        */
1077
/*    Kenneth Maxwell, Microsoft Corporation                              */
1078
/*                                                                        */
1079
/*  DESCRIPTION                                                           */
1080
/*                                                                        */
1081
/*    Internal helper function that handles writing of compressed         */
1082
/*    pixlemap file with alpha channel.                                   */
1083
/*                                                                        */
1084
/*  INPUT                                                                 */
1085
/*                                                                        */
1086
/*    context                               Drawing context               */
1087
/*    xstart                                x-coord of line left          */
1088
/*    xend                                  x-coord of line end           */
1089
/*    y                                     y-coord of line top           */
1090
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1091
/*                                                                        */
1092
/*  OUTPUT                                                                */
1093
/*                                                                        */
1094
/*    None                                                                */
1095
/*                                                                        */
1096
/*  CALLS                                                                 */
1097
/*                                                                        */
1098
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
1099
/*                                            blend function              */
1100
/*                                                                        */
1101
/*  CALLED BY                                                             */
1102
/*                                                                        */
1103
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
1104
/*                                                                        */
1105
/*  RELEASE HISTORY                                                       */
1106
/*                                                                        */
1107
/*    DATE              NAME                      DESCRIPTION             */
1108
/*                                                                        */
1109
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
1110
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
1111
/*                                            resulting in version 6.1    */
1112
/*                                                                        */
1113
/**************************************************************************/
1114
33006
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_write(GX_DRAW_CONTEXT *context,
1115
                                                                                    INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1116
{
1117
INT              xval;
1118
USHORT           count;
1119
INT              start_pos;
1120
GX_UBYTE         alpha;
1121
USHORT           pixel;
1122
33006
GX_CONST USHORT *get = GX_NULL;
1123
GX_PIXELMAP     *pixelmap;
1124
VOID             (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
1125
1126
33006
    pixelmap = info -> pixelmap;
1127
33006
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
1128
1129
33006
    if (blend_func == GX_NULL)
1130
    {
1131
615
        return;
1132
    }
1133
1134

32391
    if ((info -> draw) && (xstart <= xend))
1135
    {
1136
        /* This means it's the draw operation. */
1137
        /* Skip the invisible pixels.*/
1138
32101
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
1139
1140
        /*Repeat the draw operation to fill the whole dirty area.*/
1141
91997
        while (start_pos <= xend)
1142
        {
1143
59896
            xval = start_pos;
1144
59896
            get = (GX_CONST USHORT *)info -> current_pixel_ptr;
1145
501134
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
1146
            {
1147
441238
                count = *get++;
1148
1149
441238
                if (count & 0x8000)
1150
                {
1151
                    /* repeated value */
1152
275158
                    count = (USHORT)((count & 0x7fff) + 1u);
1153
275158
                    pixel = *get++;
1154
275158
                    alpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
1155
1156
275158
                    if (alpha)
1157
                    {
1158
3511321
                        while (count--)
1159
                        {
1160

3427208
                            if (xval >= xstart && xval <= xend)
1161
                            {
1162
1991230
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), alpha);
1163
                            }
1164
3427208
                            xval++;
1165
                        }
1166
                    }
1167
                    else
1168
                    {
1169
191045
                        xval += count;
1170
                    }
1171
                }
1172
                else
1173
                {
1174
                    /* string of non-repeated values */
1175
166080
                    count++;
1176
736153
                    while (count--)
1177
                    {
1178

570073
                        if (xval >= xstart && xval <= xend)
1179
                        {
1180
323363
                            pixel = *get;
1181
323363
                            alpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
1182
323363
                            if (alpha)
1183
                            {
1184
306601
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), alpha);
1185
                            }
1186
                        }
1187
570073
                        get++;
1188
570073
                        xval++;
1189
                    }
1190
                }
1191
            }
1192
59896
            start_pos += pixelmap -> gx_pixelmap_width;
1193
        }
1194
    }
1195
    else
1196
    {
1197
290
        xval = 0;
1198
290
        get = (GX_CONST USHORT *)info -> current_pixel_ptr;
1199
1200
2147
        while (xval < pixelmap -> gx_pixelmap_width)
1201
        {
1202
1857
            count = *get++;
1203
1857
            if (count & 0x8000)
1204
            {
1205
1277
                count = (USHORT)((count & 0x7fff) + 1);
1206
1277
                get++;
1207
            }
1208
            else
1209
            {
1210
580
                count++;
1211
580
                get += count;
1212
            }
1213
1857
            xval += count;
1214
        }
1215
    }
1216
1217
    /*This line is drawn. cache the pointer for next line draw.*/
1218
32391
    info -> current_pixel_ptr = (GX_UBYTE *)get;
1219
}
1220
1221
/**************************************************************************/
1222
/*                                                                        */
1223
/*  FUNCTION                                               RELEASE        */
1224
/*                                                                        */
1225
/*    _gx_display_driver_8bpp_pixelmap_draw               PORTABLE C      */
1226
/*                                                           6.1          */
1227
/*  AUTHOR                                                                */
1228
/*                                                                        */
1229
/*    Kenneth Maxwell, Microsoft Corporation                              */
1230
/*                                                                        */
1231
/*  DESCRIPTION                                                           */
1232
/*                                                                        */
1233
/*    8bit screen driver pixelmap drawing function that handles           */
1234
/*    compressed or uncompress, with or without alpha channel.            */
1235
/*                                                                        */
1236
/*  INPUT                                                                 */
1237
/*                                                                        */
1238
/*    context                               Drawing context               */
1239
/*    xstart                                x-coord of line left          */
1240
/*    xend                                  x-coord of line end           */
1241
/*    y                                     y-coord of line top           */
1242
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1243
/*                                                                        */
1244
/*  OUTPUT                                                                */
1245
/*                                                                        */
1246
/*    None                                                                */
1247
/*                                                                        */
1248
/*  CALLS                                                                 */
1249
/*                                                                        */
1250
/*     _gx_display_driver_8bit_horizontal_pixelmap_line_raw_write         */
1251
/*                                          Draw raw pixelmap             */
1252
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write  */
1253
/*                                          Draw pixelmap with            */
1254
/*                                            compression                 */
1255
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write */
1256
/*                                          Draw pixelmap with            */
1257
/*                                            transparency                */
1258
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1259
/*     transparent_write                                                  */
1260
/*                                          Draw pixelmap with            */
1261
/*                                            transparency and compression*/
1262
/*                                                                        */
1263
/*  CALLED BY                                                             */
1264
/*                                                                        */
1265
/*    GUIX Internal Code                                                  */
1266
/*                                                                        */
1267
/*  RELEASE HISTORY                                                       */
1268
/*                                                                        */
1269
/*    DATE              NAME                      DESCRIPTION             */
1270
/*                                                                        */
1271
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
1272
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
1273
/*                                            resulting in version 6.1    */
1274
/*                                                                        */
1275
/**************************************************************************/
1276
140791
VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
1277
                                                           INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1278
{
1279
1280
140791
    if (info -> pixelmap == GX_NULL)
1281
    {
1282
1
        return;
1283
    }
1284
1285
140790
    if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
1286
    {
1287
103990
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1288
        {
1289
            /* has both compression and transparent */
1290
6670
            _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_transparent_write(context, xstart, xend, y, info);
1291
        }
1292
        else
1293
        {
1294
            /* transparent, no compression */
1295
97320
            _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write(context, xstart, xend, y, info);
1296
        }
1297
    }
1298
    else
1299
    {
1300
36800
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1301
        {
1302
            /* compressed with no transparency */
1303
30800
            _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
1304
        }
1305
        else
1306
        {
1307
            /* no compression or transaprency */
1308
6000
            _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
1309
        }
1310
    }
1311
1312
1313
    /*Current pixelmap has gone over, so the offset pointer should be reset.*/
1314
140790
    if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1315
    {
1316
8233
        info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
1317
8233
        info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
1318
    }
1319
1320
140790
    return;
1321
}
1322
1323
/**************************************************************************/
1324
/*                                                                        */
1325
/*  FUNCTION                                               RELEASE        */
1326
/*                                                                        */
1327
/*    _gx_display_driver_8bpp_pixelmap_draw               PORTABLE C      */
1328
/*                                                           6.1          */
1329
/*  AUTHOR                                                                */
1330
/*                                                                        */
1331
/*    Kenneth Maxwell, Microsoft Corporation                              */
1332
/*                                                                        */
1333
/*  DESCRIPTION                                                           */
1334
/*                                                                        */
1335
/*    8bit screen driver pixelmap drawing function that handles           */
1336
/*    compressed or uncompress, with or without alpha channel.            */
1337
/*                                                                        */
1338
/*  INPUT                                                                 */
1339
/*                                                                        */
1340
/*    context                               Drawing context               */
1341
/*    xstart                                x-coord of line left          */
1342
/*    xend                                  x-coord of line end           */
1343
/*    y                                     y-coord of line top           */
1344
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1345
/*                                                                        */
1346
/*  OUTPUT                                                                */
1347
/*                                                                        */
1348
/*    None                                                                */
1349
/*                                                                        */
1350
/*  CALLS                                                                 */
1351
/*                                                                        */
1352
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1353
/*     alpha_blend                                                        */
1354
/*                                          Blend pixelmap with           */
1355
/*                                            compression and alpha       */
1356
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend       */
1357
/*                                          Blend pixelmap with alpha     */
1358
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend  */
1359
/*                                          Blend pixelmap with           */
1360
/*                                            compression                 */
1361
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend         */
1362
/*                                          Blend raw pixelmap            */
1363
/*     _gx_display_driver_8bit_horizontal_pixelmap_line_raw_write         */
1364
/*                                          Draw draw pixelmap            */
1365
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write       */
1366
/*                                          Draw pixelmap with alpha      */
1367
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write  */
1368
/*                                          Draw pixelmap with            */
1369
/*                                            compression                 */
1370
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1371
/*     alpha_write                                                        */
1372
/*                                          DRaw pxielmap with            */
1373
/*                                            compression and alpha       */
1374
/*                                                                        */
1375
/*  CALLED BY                                                             */
1376
/*                                                                        */
1377
/*    GUIX Internal Code                                                  */
1378
/*                                                                        */
1379
/*  RELEASE HISTORY                                                       */
1380
/*                                                                        */
1381
/*    DATE              NAME                      DESCRIPTION             */
1382
/*                                                                        */
1383
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
1384
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
1385
/*                                            resulting in version 6.1    */
1386
/*                                                                        */
1387
/**************************************************************************/
1388
212101
VOID _gx_display_driver_332rgb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
1389
                                                             INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1390
{
1391
#if defined GX_BRUSH_ALPHA_SUPPORT
1392
GX_UBYTE alpha;
1393
1394
212101
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
1395
212101
    if (alpha == 0)
1396
    {
1397
        /* Nothing to drawn. Just return. */
1398
37056
        return;
1399
    }
1400
1401
175045
    if (info -> pixelmap == GX_NULL)
1402
    {
1403
        /* No pixelmap info here.So just return. */
1404
1
        return;
1405
    }
1406
1407
175044
    if (alpha != 0xff)
1408
    {
1409
42498
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1410
        {
1411
21454
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1412
            {
1413
10494
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_blend(context, xstart, xend, y, info, alpha);
1414
            }
1415
            else
1416
            {
1417
                /* alpha, no compression */
1418
10960
                _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend(context, xstart, xend, y, info, alpha);
1419
            }
1420
        }
1421
        else
1422
        {
1423
21044
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1424
            {
1425
10522
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend(context, xstart, xend, y, info, alpha);
1426
            }
1427
            else
1428
            {
1429
10522
                _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend(context, xstart, xend, y, info, alpha);
1430
            }
1431
        }
1432
    }
1433
    else
1434
    {
1435
#endif
1436
132546
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1437
        {
1438
66478
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1439
            {
1440
33006
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_write(context, xstart, xend, y, info);
1441
            }
1442
            else
1443
            {
1444
                /* alpha, no compression */
1445
33472
                _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write(context, xstart, xend, y, info);
1446
            }
1447
        }
1448
        else
1449
        {
1450
66068
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1451
            {
1452
33034
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
1453
            }
1454
            else
1455
            {
1456
33034
                _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
1457
            }
1458
        }
1459
#if defined GX_BRUSH_ALPHA_SUPPORT
1460
    }
1461
#endif
1462
1463
    /*Current pixelmap has gone over, so the offset pointer should be reset.*/
1464
175044
    if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1465
    {
1466
1778
        info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
1467
1778
        info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
1468
    }
1469
1470
175044
    return;
1471
}
1472