GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_horizontal_pixelmap_line_draw.c Lines: 338 338 100.0 %
Date: 2026-03-06 19:21:09 Branches: 226 226 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Display Management (Display)                                        */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_display.h"
29
#include "gx_context.h"
30
31
#if defined(GX_BRUSH_ALPHA_SUPPORT)
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend          */
38
/*                                                        PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    Internal helper function that handles blending of uncompressed      */
47
/*    pixlemap file without alpha channel with brush alpha.               */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    context                               Drawing context               */
52
/*    xstart                                x-coord of line left          */
53
/*    xend                                  x-coord of line right         */
54
/*    y                                     y-coord of line top           */
55
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
56
/*    alpha                                 Alpha value                   */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    None                                                                */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
65
/*                                            blend function              */
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
70
/*                                                                        */
71
/**************************************************************************/
72
10522
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend(GX_DRAW_CONTEXT *context,
73
                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
74
{
75
INT                xval;
76
INT                offset;
77
INT                pic_width;
78
GX_CONST GX_UBYTE *get;
79
GX_PIXELMAP       *pixelmap;
80
VOID               (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
81
82
10522
    pixelmap = info -> pixelmap;
83
84
10522
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
85
10522
    if (blend_func == GX_NULL)
86
    {
87
629
        return;
88
    }
89
90
9893
    pic_width = pixelmap -> gx_pixelmap_width;
91
92

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

9893
    if ((info -> draw) && (xstart <= xend))
173
    {
174
        /* This means it's the draw operation. */
175
        /* Skip the invisible pixels.*/
176
9813
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
177
178
        /*Repeat the draw operation to fill the whole dirty area.*/
179
33642
        while (start_pos <= xend)
180
        {
181
23829
            xval = start_pos;
182
183
            /*Start from where we need to repeat.*/
184
23829
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
185
186
386986
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
187
            {
188
363157
                count = *get++;
189
363157
                if (count & 0x80)
190
                {
191
239639
                    count = (GX_UBYTE)((count & 0x7f) + 1);
192
239639
                    pixel = *get++;
193
3452260
                    while (count--)
194
                    {
195

3212621
                        if (xval >= xstart && xval <= xend)
196
                        {
197
2203776
                            blend_func(context, xval, y, pixel, alpha);
198
                        }
199
3212621
                        xval++;
200
                    }
201
                }
202
                else
203
                {
204
123518
                    count++;
205
531483
                    while (count--)
206
                    {
207
407965
                        pixel = *get++;
208

407965
                        if (xval >= xstart && xval <= xend)
209
                        {
210
294992
                            blend_func(context, xval, y, pixel, alpha);
211
                        }
212
407965
                        xval++;
213
                    }
214
                }
215
            }
216
23829
            start_pos += pixelmap -> gx_pixelmap_width;
217
        }
218
    }
219
    else
220
    {
221
80
        xval = 0;
222
80
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
223
325
        while (xval < pixelmap -> gx_pixelmap_width)
224
        {
225
245
            count = *get++;
226
245
            if (count & 0x80)
227
            {
228
113
                count = (GX_UBYTE)((count & 0x7f) + 1);
229
113
                get++;
230
            }
231
            else
232
            {
233
132
                count++;
234
132
                get += count;
235
            }
236
245
            xval += count;
237
        }
238
    }
239
240
    /* This line is drawn. cache the pointer for next line draw. */
241
9893
    info -> current_pixel_ptr = (GX_UBYTE *)get;
242
}
243
244
/**************************************************************************/
245
/*                                                                        */
246
/*  FUNCTION                                               RELEASE        */
247
/*                                                                        */
248
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend        */
249
/*                                                        PORTABLE C      */
250
/*                                                           6.1          */
251
/*  AUTHOR                                                                */
252
/*                                                                        */
253
/*    Kenneth Maxwell, Microsoft Corporation                              */
254
/*                                                                        */
255
/*  DESCRIPTION                                                           */
256
/*                                                                        */
257
/*    Internal helper function that handles blending of uncompressed      */
258
/*    pixlemap file with alpha channel with brush alpha.                  */
259
/*                                                                        */
260
/*  INPUT                                                                 */
261
/*                                                                        */
262
/*    context                               Drawing context               */
263
/*    xstart                                x-coord of line left          */
264
/*    xend                                  x-coord of line end           */
265
/*    y                                     y-coord of line top           */
266
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
267
/*    alpha                                 Alpha value                   */
268
/*                                                                        */
269
/*  OUTPUT                                                                */
270
/*                                                                        */
271
/*    None                                                                */
272
/*                                                                        */
273
/*  CALLS                                                                 */
274
/*                                                                        */
275
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
276
/*                                            blend function              */
277
/*                                                                        */
278
/*  CALLED BY                                                             */
279
/*                                                                        */
280
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
281
/*                                                                        */
282
/**************************************************************************/
283
10960
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend(GX_DRAW_CONTEXT *context,
284
                                                                         INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
285
{
286
INT                xval;
287
GX_CONST GX_UBYTE *get;
288
GX_CONST GX_UBYTE *get_alpha;
289
GX_UBYTE           falpha;
290
GX_UBYTE           pixel;
291
GX_PIXELMAP       *pixelmap;
292
INT                pic_width;
293
INT                offset;
294
GX_UBYTE           combined_alpha;
295
VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
296
297
10960
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
298
10960
    pixelmap = info -> pixelmap;
299
300
10960
    if (blend_func == GX_NULL)
301
    {
302
848
        return;
303
    }
304
305
10112
    pic_width = pixelmap -> gx_pixelmap_width;
306

10112
    if ((info -> draw) && (xstart <= xend))
307
    {
308
9813
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
309
9813
        get_alpha = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
310
311
        /*calculate the offset.*/
312
9813
        offset = (info -> x_offset % pic_width);
313
314
2508581
        for (xval = xstart; xval <= xend; xval++)
315
        {
316
            /*get points to the start postion of this row. So we need to calculate its position.*/
317
2498768
            pixel = *(get + offset);
318
2498768
            falpha = *(get_alpha + offset);
319
2498768
            if (falpha)
320
            {
321
997447
                combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
322
997447
                blend_func(context, xval, y, pixel, combined_alpha);
323
            }
324
325
2498768
            offset++;
326
2498768
            if (offset >= pic_width)
327
            {
328
63007
                offset -= pic_width;
329
            }
330
        }
331
    }
332
333
10112
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
334
10112
    info -> current_aux_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
335
}
336
337
338
/**************************************************************************/
339
/*                                                                        */
340
/*  FUNCTION                                               RELEASE        */
341
/*                                                                        */
342
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha   */
343
/*        _blend                                                          */
344
/*                                                        PORTABLE C      */
345
/*                                                           6.1          */
346
/*  AUTHOR                                                                */
347
/*                                                                        */
348
/*    Kenneth Maxwell, Microsoft Corporation                              */
349
/*                                                                        */
350
/*  DESCRIPTION                                                           */
351
/*                                                                        */
352
/*    Internal helper function that handles blending of compressed        */
353
/*    pixlemap file with alpha channel.                                   */
354
/*                                                                        */
355
/*  INPUT                                                                 */
356
/*                                                                        */
357
/*    context                               Drawing context               */
358
/*    xstart                                x-coord of line left          */
359
/*    xend                                  x-coord of line end           */
360
/*    y                                     y-coord of line top           */
361
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
362
/*    alpha                                 Alpha value                   */
363
/*                                                                        */
364
/*  OUTPUT                                                                */
365
/*                                                                        */
366
/*    None                                                                */
367
/*                                                                        */
368
/*  CALLS                                                                 */
369
/*                                                                        */
370
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
371
/*                                            blend function              */
372
/*                                                                        */
373
/*  CALLED BY                                                             */
374
/*                                                                        */
375
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
376
/*                                                                        */
377
/**************************************************************************/
378
10494
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_blend(GX_DRAW_CONTEXT *context,
379
                                                                                    INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
380
{
381
INT              xval;
382
USHORT           count;
383
INT              start_pos;
384
GX_UBYTE         falpha;
385
GX_UBYTE         combined_alpha;
386
USHORT           pixel;
387
10494
GX_CONST USHORT *get = GX_NULL;
388
GX_PIXELMAP     *pixelmap;
389
VOID             (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
390
391
10494
    pixelmap = info -> pixelmap;
392
10494
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
393
394
10494
    if (blend_func == GX_NULL)
395
    {
396
615
        return;
397
    }
398
399

9879
    if ((info -> draw) && (xstart <= xend))
400
    {
401
        /* Calcualte draw start position. */
402
9813
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
403
404
        /*Repeat the draw operation to fill the whole dirty area.*/
405
35341
        while (start_pos <= xend)
406
        {
407
25528
            xval = start_pos;
408
25528
            get = (GX_CONST USHORT *)info -> current_pixel_ptr;
409
203278
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
410
            {
411
177750
                count = *get++;
412
413
177750
                if (count & 0x8000)
414
                {
415
                    /* repeated value */
416
109686
                    count = (USHORT)((count & 0x7fff) + 1u);
417
109686
                    pixel = *get++;
418
109686
                    falpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
419
109686
                    combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
420
109686
                    if (combined_alpha)
421
                    {
422
1398137
                        while (count--)
423
                        {
424

1360248
                            if (xval >= xstart && xval <= xend)
425
                            {
426
921150
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), combined_alpha);
427
                            }
428
1360248
                            xval++;
429
                        }
430
                    }
431
                    else
432
                    {
433
71797
                        xval += count;
434
                    }
435
                }
436
                else
437
                {
438
                    /* string of non-repeated values */
439
68064
                    count++;
440
308409
                    while (count--)
441
                    {
442

240345
                        if (xval >= xstart && xval <= xend)
443
                        {
444
166755
                            pixel = *get;
445
166755
                            falpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
446
166755
                            combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
447
166755
                            blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), combined_alpha);
448
                        }
449
240345
                        get++;
450
240345
                        xval++;
451
                    }
452
                }
453
            }
454
25528
            start_pos += pixelmap -> gx_pixelmap_width;
455
        }
456
    }
457
    else
458
    {
459
66
        xval = 0;
460
66
        get = (GX_CONST USHORT *)info -> current_pixel_ptr;
461
462
355
        while (xval < pixelmap -> gx_pixelmap_width)
463
        {
464
289
            count = *get++;
465
289
            if (count & 0x8000)
466
            {
467
157
                count = (USHORT)((count & 0x7fff) + 1);
468
157
                get++;
469
            }
470
            else
471
            {
472
132
                count++;
473
132
                get += count;
474
            }
475
289
            xval += count;
476
        }
477
    }
478
479
    /* This line is drawn. cache the pointer for next line draw. */
480
9879
    info -> current_pixel_ptr = (GX_UBYTE *)get;
481
}
482
483
#endif /* GX_BRUSH_ALPHA_SUPPORT */
484
485
/**************************************************************************/
486
/*                                                                        */
487
/*  FUNCTION                                               RELEASE        */
488
/*                                                                        */
489
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write          */
490
/*                                                        PORTABLE C      */
491
/*                                                           6.1          */
492
/*  AUTHOR                                                                */
493
/*                                                                        */
494
/*    Kenneth Maxwell, Microsoft Corporation                              */
495
/*                                                                        */
496
/*  DESCRIPTION                                                           */
497
/*                                                                        */
498
/*    Internal helper function that handles writing of uncompressed       */
499
/*    pixlemap file without alpha channel.                                */
500
/*                                                                        */
501
/*  INPUT                                                                 */
502
/*                                                                        */
503
/*    context                               Drawing context               */
504
/*    xstart                                x-coord of line left          */
505
/*    xend                                  x-coord of line right         */
506
/*    y                                     y-coord of line top           */
507
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
508
/*                                                                        */
509
/*  OUTPUT                                                                */
510
/*                                                                        */
511
/*    None                                                                */
512
/*                                                                        */
513
/*  CALLED BY                                                             */
514
/*                                                                        */
515
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
516
/*                                                                        */
517
/**************************************************************************/
518
39034
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(GX_DRAW_CONTEXT *context,
519
                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
520
{
521
INT                xval;
522
INT                offset;
523
INT                pic_width;
524
GX_CONST GX_UBYTE *get;
525
GX_UBYTE          *put;
526
GX_PIXELMAP       *pixelmap;
527
528
39034
    pixelmap = info -> pixelmap;
529
530
39034
    pic_width = pixelmap -> gx_pixelmap_width;
531
532

39034
    if ((info -> draw) && (xstart <= xend))
533
    {
534
38554
        get = info -> current_pixel_ptr;
535
38554
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
536
38554
        put += y * context -> gx_draw_context_pitch + xstart;
537
538
        /* Calculate the map offset in x-axis. */
539
38554
        offset = (info -> x_offset % pic_width);
540
541
5946346
        for (xval = xstart; xval <= xend; xval++)
542
        {
543
            /* get points to the start postion of this row. So we need to calculate its position. */
544
5907792
            *put++ = *(get + offset);
545
5907792
            offset++;
546
5907792
            if (offset >= pic_width)
547
            {
548
35142
                offset -= pic_width;
549
            }
550
        }
551
    }
552
553
    /* This line is drawn. Update the pointer position for next row. */
554
39034
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
555
39034
}
556
557
/**************************************************************************/
558
/*                                                                        */
559
/*  FUNCTION                                               RELEASE        */
560
/*                                                                        */
561
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write   */
562
/*                                                        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 compressed         */
571
/*    pixlemap file.                                                      */
572
/*                                                                        */
573
/*  INPUT                                                                 */
574
/*                                                                        */
575
/*    context                               Drawing context               */
576
/*    xstart                                x-coord of line left          */
577
/*    xend                                  x-coord of line right         */
578
/*    y                                     y-coord of line top           */
579
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
580
/*                                                                        */
581
/*  OUTPUT                                                                */
582
/*                                                                        */
583
/*    None                                                                */
584
/*                                                                        */
585
/*  CALLS                                                                 */
586
/*                                                                        */
587
/*    None                                                                */
588
/*                                                                        */
589
/*  CALLED BY                                                             */
590
/*                                                                        */
591
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
592
/*                                                                        */
593
/**************************************************************************/
594
63834
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(GX_DRAW_CONTEXT *context,
595
                                                                              INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
596
{
597
INT                start_pos;
598
INT                xval;
599
GX_UBYTE           count;
600
63834
GX_CONST GX_UBYTE *get = GX_NULL;
601
GX_UBYTE           pixel;
602
GX_UBYTE          *put;
603
GX_PIXELMAP       *pixelmap;
604
605
63834
    pixelmap = info -> pixelmap;
606
607

63834
    if ((info -> draw) && (xstart <= xend))
608
    {
609
        /* Calculate draw start position. */
610
58594
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
611
612
58594
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
613
58594
        put += y * context -> gx_draw_context_pitch + start_pos;
614
615
        /*Repeat the draw operation to fill the whole dirty area.*/
616
231980
        while (start_pos <= xend)
617
        {
618
173386
            xval = start_pos;
619
620
            /*Start from where we need to repeat.*/
621
173386
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
622
623
1389460
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
624
            {
625
1216074
                count = *get++;
626
1216074
                if (count & 0x80)
627
                {
628
735446
                    count = (GX_UBYTE)((count & 0x7f) + 1);
629
735446
                    pixel = *get++;
630
9798968
                    while (count--)
631
                    {
632

9063522
                        if (xval >= xstart && xval <= xend)
633
                        {
634
5255792
                            *put = pixel;
635
                        }
636
9063522
                        xval++;
637
9063522
                        put++;
638
                    }
639
                }
640
                else
641
                {
642
480628
                    count++;
643
3090006
                    while (count--)
644
                    {
645
2609378
                        pixel = *get++;
646

2609378
                        if (xval >= xstart && xval <= xend)
647
                        {
648
1850000
                            *put = pixel;
649
                        }
650
2609378
                        xval++;
651
2609378
                        put++;
652
                    }
653
                }
654
            }
655
173386
            start_pos += pixelmap -> gx_pixelmap_width;
656
        }
657
    }
658
    else
659
    {
660
5240
        xval = 0;
661
5240
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
662
14714
        while (xval < pixelmap -> gx_pixelmap_width)
663
        {
664
9474
            count = *get++;
665
9474
            if (count & 0x80)
666
            {
667
3378
                count = (GX_UBYTE)((count & 0x7f) + 1);
668
3378
                get++;
669
            }
670
            else
671
            {
672
6096
                count++;
673
6096
                get += count;
674
            }
675
9474
            xval += count;
676
        }
677
    }
678
679
    /*This line is drawn. cache the pointer for next line draw.*/
680
63834
    info -> current_pixel_ptr = (GX_UBYTE *)get;
681
63834
}
682
683
/**************************************************************************/
684
/*                                                                        */
685
/*  FUNCTION                                               RELEASE        */
686
/*                                                                        */
687
/*    _gx_display_driver_8bpp_horizontal_line_pixelmap_transparent_write  */
688
/*                                                        PORTABLE C      */
689
/*                                                           6.1          */
690
/*  AUTHOR                                                                */
691
/*                                                                        */
692
/*    Kenneth Maxwell, Microsoft Corporation                              */
693
/*                                                                        */
694
/*  DESCRIPTION                                                           */
695
/*                                                                        */
696
/*    Internal helper function that handles writing of uncompressed       */
697
/*    pixlemap file with alpha channel.                                   */
698
/*                                                                        */
699
/*  INPUT                                                                 */
700
/*                                                                        */
701
/*    context                               Drawing context               */
702
/*    xstart                                x-coord of line left          */
703
/*    xend                                  x-coord of line right         */
704
/*    y                                     y-coord of line top           */
705
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
706
/*                                                                        */
707
/*  OUTPUT                                                                */
708
/*                                                                        */
709
/*    None                                                                */
710
/*                                                                        */
711
/*  CALLS                                                                 */
712
/*                                                                        */
713
/*    None                                                                */
714
/*                                                                        */
715
/*  CALLED BY                                                             */
716
/*                                                                        */
717
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
718
/*                                                                        */
719
/**************************************************************************/
720
97320
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write(GX_DRAW_CONTEXT *context,
721
                                                                               INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
722
{
723
INT                xval;
724
INT                offset;
725
INT                pic_width;
726
GX_CONST GX_UBYTE *get;
727
GX_UBYTE          *put;
728
GX_PIXELMAP       *pixelmap;
729
GX_UBYTE           pixel;
730
731
97320
    pixelmap = info -> pixelmap;
732
97320
    pic_width = pixelmap -> gx_pixelmap_width;
733
734

97320
    if ((info -> draw) && (xstart <= xend))
735
    {
736
78928
        get = info -> current_pixel_ptr;
737
78928
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
738
78928
        put += y * context -> gx_draw_context_pitch + xstart;
739
740
        /* Calculate the map offset in x-axis. */
741
78928
        offset = (info -> x_offset % pic_width);
742
743
10908616
        for (xval = xstart; xval <= xend; xval++)
744
        {
745
            /* get points to the start postion of this row. So we need to calculate its position. */
746
10829688
            pixel = *(get + offset);
747
10829688
            offset++;
748
10829688
            if (offset >= pic_width)
749
            {
750
674896
                offset -= pic_width;
751
            }
752
753
10829688
            if (pixel != pixelmap -> gx_pixelmap_transparent_color)
754
            {
755
8847352
                *put = pixel;
756
            }
757
10829688
            put++;
758
        }
759
    }
760
761
    /* This line is drawn. Update the pointer position for next row. */
762
97320
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
763
97320
}
764
765
/**************************************************************************/
766
/*                                                                        */
767
/*  FUNCTION                                               RELEASE        */
768
/*                                                                        */
769
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_        */
770
/*    transparent_write                                                   */
771
/*                                                        PORTABLE C      */
772
/*                                                           6.1          */
773
/*  AUTHOR                                                                */
774
/*                                                                        */
775
/*    Kenneth Maxwell, Microsoft Corporation                              */
776
/*                                                                        */
777
/*  DESCRIPTION                                                           */
778
/*                                                                        */
779
/*    Internal helper function that handles writing of compressed         */
780
/*    pixlemap file with alpha channel.                                   */
781
/*                                                                        */
782
/*  INPUT                                                                 */
783
/*                                                                        */
784
/*    context                               Drawing context               */
785
/*    xstart                                x-coord of line left          */
786
/*    xend                                  x-coord of line right         */
787
/*    y                                     y-coord of line top           */
788
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
789
/*                                                                        */
790
/*  OUTPUT                                                                */
791
/*                                                                        */
792
/*    None                                                                */
793
/*                                                                        */
794
/*  CALLS                                                                 */
795
/*                                                                        */
796
/*    None                                                                */
797
/*                                                                        */
798
/*  CALLED BY                                                             */
799
/*                                                                        */
800
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
801
/*                                                                        */
802
/**************************************************************************/
803
6670
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_transparent_write(GX_DRAW_CONTEXT *context,
804
                                                                                          INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
805
{
806
INT                start_pos;
807
INT                xval;
808
GX_UBYTE           count;
809
6670
GX_CONST GX_UBYTE *get = GX_NULL;
810
GX_UBYTE           pixel;
811
GX_UBYTE          *put;
812
GX_PIXELMAP       *pixelmap;
813
814
6670
    pixelmap = info -> pixelmap;
815
816

6670
    if ((info -> draw) && (xstart <= xend))
817
    {
818
        /* Calcualte draw start position. */
819
6446
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
820
821
6446
        put = (GX_UBYTE *)context -> gx_draw_context_memory;
822
6446
        put += y * context -> gx_draw_context_pitch + start_pos;
823
824
825
        /*Repeat the draw operation to fill the whole dirty area.*/
826
31580
        while (start_pos <= xend)
827
        {
828
25134
            xval = start_pos;
829
830
            /*Start from where we need to repeat.*/
831
25134
            get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
832
833
94246
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
834
            {
835
69112
                count = *get++;
836
69112
                if (count & 0x80)
837
                {
838
28020
                    count = (GX_UBYTE)((count & 0x7f) + 1);
839
28020
                    pixel = *get++;
840
28020
                    if (pixel != pixelmap -> gx_pixelmap_transparent_color)
841
                    {
842
163198
                        while (count--)
843
                        {
844

147240
                            if (xval >= xstart && xval <= xend)
845
                            {
846
128067
                                *put = pixel;
847
                            }
848
147240
                            xval++;
849
147240
                            put++;
850
                        }
851
                    }
852
                    else
853
                    {
854
12062
                        xval += count;
855
12062
                        put += count;
856
                    }
857
                }
858
                else
859
                {
860
41092
                    count++;
861
247913
                    while (count--)
862
                    {
863
206821
                        pixel = *get++;
864
865

206821
                        if (xval >= xstart && xval <= xend)
866
                        {
867
171375
                            if (pixel != pixelmap -> gx_pixelmap_transparent_color)
868
                            {
869
149643
                                *put = pixel;
870
                            }
871
                        }
872
206821
                        xval++;
873
206821
                        put++;
874
                    }
875
                }
876
            }
877
25134
            start_pos += pixelmap -> gx_pixelmap_width;
878
        }
879
    }
880
    else
881
    {
882
224
        xval = 0;
883
224
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
884
866
        while (xval < pixelmap -> gx_pixelmap_width)
885
        {
886
642
            count = *get++;
887
642
            if (count & 0x80)
888
            {
889
305
                count = (GX_UBYTE)((count & 0x7f) + 1);
890
305
                get++;
891
            }
892
            else
893
            {
894
337
                count++;
895
337
                get += count;
896
            }
897
642
            xval += count;
898
        }
899
    }
900
901
    /* This line is drawn. cache the pointer for next line draw.*/
902
6670
    info -> current_pixel_ptr = (GX_UBYTE *)get;
903
6670
}
904
905
/**************************************************************************/
906
/*                                                                        */
907
/*  FUNCTION                                               RELEASE        */
908
/*                                                                        */
909
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write        */
910
/*                                                        PORTABLE C      */
911
/*                                                           6.1          */
912
/*  AUTHOR                                                                */
913
/*                                                                        */
914
/*    Kenneth Maxwell, Microsoft Corporation                              */
915
/*                                                                        */
916
/*  DESCRIPTION                                                           */
917
/*                                                                        */
918
/*    Internal helper function that handles writing of uncompressed       */
919
/*    pixlemap file with alpha channel.                                   */
920
/*                                                                        */
921
/*  INPUT                                                                 */
922
/*                                                                        */
923
/*    context                               Drawing context               */
924
/*    xstart                                x-coord of line left          */
925
/*    xend                                  x-coord of line end           */
926
/*    y                                     y-coord of line top           */
927
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
928
/*    alpha                                 Alpha value                   */
929
/*                                                                        */
930
/*  OUTPUT                                                                */
931
/*                                                                        */
932
/*    None                                                                */
933
/*                                                                        */
934
/*  CALLS                                                                 */
935
/*                                                                        */
936
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
937
/*                                            blend function              */
938
/*    [gx_display_driver_pixel_write]       Basic display driver pixel    */
939
/*                                            write function              */
940
/*                                                                        */
941
/*  CALLED BY                                                             */
942
/*                                                                        */
943
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
944
/*                                                                        */
945
/**************************************************************************/
946
33472
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write(GX_DRAW_CONTEXT *context,
947
                                                                         INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
948
{
949
INT                xval;
950
GX_CONST GX_UBYTE *get;
951
GX_CONST GX_UBYTE *get_alpha;
952
GX_UBYTE           alpha;
953
GX_UBYTE           pixel;
954
GX_PIXELMAP       *pixelmap;
955
INT                pic_width;
956
INT                offset;
957
VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
958
959
33472
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
960
33472
    pixelmap = info -> pixelmap;
961
962
33472
    if (blend_func == GX_NULL)
963
    {
964
848
        return;
965
    }
966
967
32624
    pic_width = pixelmap -> gx_pixelmap_width;
968

32624
    if ((info -> draw) && (xstart <= xend))
969
    {
970
32101
        get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
971
32101
        get_alpha = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
972
973
        /*calculate the offset.*/
974
32101
        offset = (info -> x_offset % pic_width);
975
976
5600581
        for (xval = xstart; xval <= xend; xval++)
977
        {
978
            /*get points to the start postion of this row. So we need to calculate its position.*/
979
5568480
            pixel = *(get + offset);
980
5568480
            alpha = *(get_alpha + offset);
981
982
5568480
            blend_func(context, xval, y, pixel, alpha);
983
984
5568480
            offset++;
985
5568480
            if (offset >= pic_width)
986
            {
987
139919
                offset -= pic_width;
988
            }
989
        }
990
    }
991
992
32624
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
993
32624
    info -> current_aux_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
994
}
995
996
/**************************************************************************/
997
/*                                                                        */
998
/*  FUNCTION                                               RELEASE        */
999
/*                                                                        */
1000
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha   */
1001
/*        _write                                                          */
1002
/*                                                        PORTABLE C      */
1003
/*                                                           6.1          */
1004
/*  AUTHOR                                                                */
1005
/*                                                                        */
1006
/*    Kenneth Maxwell, Microsoft Corporation                              */
1007
/*                                                                        */
1008
/*  DESCRIPTION                                                           */
1009
/*                                                                        */
1010
/*    Internal helper function that handles writing of compressed         */
1011
/*    pixlemap file with alpha channel.                                   */
1012
/*                                                                        */
1013
/*  INPUT                                                                 */
1014
/*                                                                        */
1015
/*    context                               Drawing context               */
1016
/*    xstart                                x-coord of line left          */
1017
/*    xend                                  x-coord of line end           */
1018
/*    y                                     y-coord of line top           */
1019
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1020
/*                                                                        */
1021
/*  OUTPUT                                                                */
1022
/*                                                                        */
1023
/*    None                                                                */
1024
/*                                                                        */
1025
/*  CALLS                                                                 */
1026
/*                                                                        */
1027
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
1028
/*                                            blend function              */
1029
/*                                                                        */
1030
/*  CALLED BY                                                             */
1031
/*                                                                        */
1032
/*    _gx_display_driver_8bpp_horizontal_pixelmap_line_draw               */
1033
/*                                                                        */
1034
/**************************************************************************/
1035
33006
static VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_write(GX_DRAW_CONTEXT *context,
1036
                                                                                    INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1037
{
1038
INT              xval;
1039
USHORT           count;
1040
INT              start_pos;
1041
GX_UBYTE         alpha;
1042
USHORT           pixel;
1043
33006
GX_CONST USHORT *get = GX_NULL;
1044
GX_PIXELMAP     *pixelmap;
1045
VOID             (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
1046
1047
33006
    pixelmap = info -> pixelmap;
1048
33006
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
1049
1050
33006
    if (blend_func == GX_NULL)
1051
    {
1052
615
        return;
1053
    }
1054
1055

32391
    if ((info -> draw) && (xstart <= xend))
1056
    {
1057
        /* This means it's the draw operation. */
1058
        /* Skip the invisible pixels.*/
1059
32101
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_width);
1060
1061
        /*Repeat the draw operation to fill the whole dirty area.*/
1062
91997
        while (start_pos <= xend)
1063
        {
1064
59896
            xval = start_pos;
1065
59896
            get = (GX_CONST USHORT *)info -> current_pixel_ptr;
1066
501134
            while (xval < start_pos + pixelmap -> gx_pixelmap_width)
1067
            {
1068
441238
                count = *get++;
1069
1070
441238
                if (count & 0x8000)
1071
                {
1072
                    /* repeated value */
1073
275158
                    count = (USHORT)((count & 0x7fff) + 1u);
1074
275158
                    pixel = *get++;
1075
275158
                    alpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
1076
1077
275158
                    if (alpha)
1078
                    {
1079
3511321
                        while (count--)
1080
                        {
1081

3427208
                            if (xval >= xstart && xval <= xend)
1082
                            {
1083
1991230
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), alpha);
1084
                            }
1085
3427208
                            xval++;
1086
                        }
1087
                    }
1088
                    else
1089
                    {
1090
191045
                        xval += count;
1091
                    }
1092
                }
1093
                else
1094
                {
1095
                    /* string of non-repeated values */
1096
166080
                    count++;
1097
736153
                    while (count--)
1098
                    {
1099

570073
                        if (xval >= xstart && xval <= xend)
1100
                        {
1101
323363
                            pixel = *get;
1102
323363
                            alpha = (GX_UBYTE)((pixel & 0xff00) >> 8);
1103
323363
                            if (alpha)
1104
                            {
1105
306601
                                blend_func(context, xval, y, (GX_COLOR)(pixel & 0xff), alpha);
1106
                            }
1107
                        }
1108
570073
                        get++;
1109
570073
                        xval++;
1110
                    }
1111
                }
1112
            }
1113
59896
            start_pos += pixelmap -> gx_pixelmap_width;
1114
        }
1115
    }
1116
    else
1117
    {
1118
290
        xval = 0;
1119
290
        get = (GX_CONST USHORT *)info -> current_pixel_ptr;
1120
1121
2147
        while (xval < pixelmap -> gx_pixelmap_width)
1122
        {
1123
1857
            count = *get++;
1124
1857
            if (count & 0x8000)
1125
            {
1126
1277
                count = (USHORT)((count & 0x7fff) + 1);
1127
1277
                get++;
1128
            }
1129
            else
1130
            {
1131
580
                count++;
1132
580
                get += count;
1133
            }
1134
1857
            xval += count;
1135
        }
1136
    }
1137
1138
    /*This line is drawn. cache the pointer for next line draw.*/
1139
32391
    info -> current_pixel_ptr = (GX_UBYTE *)get;
1140
}
1141
1142
/**************************************************************************/
1143
/*                                                                        */
1144
/*  FUNCTION                                               RELEASE        */
1145
/*                                                                        */
1146
/*    _gx_display_driver_8bpp_pixelmap_draw               PORTABLE C      */
1147
/*                                                           6.1          */
1148
/*  AUTHOR                                                                */
1149
/*                                                                        */
1150
/*    Kenneth Maxwell, Microsoft Corporation                              */
1151
/*                                                                        */
1152
/*  DESCRIPTION                                                           */
1153
/*                                                                        */
1154
/*    8bit screen driver pixelmap drawing function that handles           */
1155
/*    compressed or uncompress, with or without alpha channel.            */
1156
/*                                                                        */
1157
/*  INPUT                                                                 */
1158
/*                                                                        */
1159
/*    context                               Drawing context               */
1160
/*    xstart                                x-coord of line left          */
1161
/*    xend                                  x-coord of line end           */
1162
/*    y                                     y-coord of line top           */
1163
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1164
/*                                                                        */
1165
/*  OUTPUT                                                                */
1166
/*                                                                        */
1167
/*    None                                                                */
1168
/*                                                                        */
1169
/*  CALLS                                                                 */
1170
/*                                                                        */
1171
/*     _gx_display_driver_8bit_horizontal_pixelmap_line_raw_write         */
1172
/*                                          Draw raw pixelmap             */
1173
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write  */
1174
/*                                          Draw pixelmap with            */
1175
/*                                            compression                 */
1176
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write */
1177
/*                                          Draw pixelmap with            */
1178
/*                                            transparency                */
1179
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1180
/*     transparent_write                                                  */
1181
/*                                          Draw pixelmap with            */
1182
/*                                            transparency and compression*/
1183
/*                                                                        */
1184
/*  CALLED BY                                                             */
1185
/*                                                                        */
1186
/*    GUIX Internal Code                                                  */
1187
/*                                                                        */
1188
/**************************************************************************/
1189
140791
VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
1190
                                                           INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1191
{
1192
1193
140791
    if (info -> pixelmap == GX_NULL)
1194
    {
1195
1
        return;
1196
    }
1197
1198
140790
    if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
1199
    {
1200
103990
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1201
        {
1202
            /* has both compression and transparent */
1203
6670
            _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_transparent_write(context, xstart, xend, y, info);
1204
        }
1205
        else
1206
        {
1207
            /* transparent, no compression */
1208
97320
            _gx_display_driver_8bpp_horizontal_pixelmap_line_transparent_write(context, xstart, xend, y, info);
1209
        }
1210
    }
1211
    else
1212
    {
1213
36800
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1214
        {
1215
            /* compressed with no transparency */
1216
30800
            _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
1217
        }
1218
        else
1219
        {
1220
            /* no compression or transaprency */
1221
6000
            _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
1222
        }
1223
    }
1224
1225
1226
    /*Current pixelmap has gone over, so the offset pointer should be reset.*/
1227
140790
    if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1228
    {
1229
8233
        info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
1230
8233
        info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
1231
    }
1232
1233
140790
    return;
1234
}
1235
1236
/**************************************************************************/
1237
/*                                                                        */
1238
/*  FUNCTION                                               RELEASE        */
1239
/*                                                                        */
1240
/*    _gx_display_driver_8bpp_pixelmap_draw               PORTABLE C      */
1241
/*                                                           6.1          */
1242
/*  AUTHOR                                                                */
1243
/*                                                                        */
1244
/*    Kenneth Maxwell, Microsoft Corporation                              */
1245
/*                                                                        */
1246
/*  DESCRIPTION                                                           */
1247
/*                                                                        */
1248
/*    8bit screen driver pixelmap drawing function that handles           */
1249
/*    compressed or uncompress, with or without alpha channel.            */
1250
/*                                                                        */
1251
/*  INPUT                                                                 */
1252
/*                                                                        */
1253
/*    context                               Drawing context               */
1254
/*    xstart                                x-coord of line left          */
1255
/*    xend                                  x-coord of line end           */
1256
/*    y                                     y-coord of line top           */
1257
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
1258
/*                                                                        */
1259
/*  OUTPUT                                                                */
1260
/*                                                                        */
1261
/*    None                                                                */
1262
/*                                                                        */
1263
/*  CALLS                                                                 */
1264
/*                                                                        */
1265
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1266
/*     alpha_blend                                                        */
1267
/*                                          Blend pixelmap with           */
1268
/*                                            compression and alpha       */
1269
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend       */
1270
/*                                          Blend pixelmap with alpha     */
1271
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend  */
1272
/*                                          Blend pixelmap with           */
1273
/*                                            compression                 */
1274
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend         */
1275
/*                                          Blend raw pixelmap            */
1276
/*     _gx_display_driver_8bit_horizontal_pixelmap_line_raw_write         */
1277
/*                                          Draw draw pixelmap            */
1278
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write       */
1279
/*                                          Draw pixelmap with alpha      */
1280
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write  */
1281
/*                                          Draw pixelmap with            */
1282
/*                                            compression                 */
1283
/*     _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_       */
1284
/*     alpha_write                                                        */
1285
/*                                          DRaw pxielmap with            */
1286
/*                                            compression and alpha       */
1287
/*                                                                        */
1288
/*  CALLED BY                                                             */
1289
/*                                                                        */
1290
/*    GUIX Internal Code                                                  */
1291
/*                                                                        */
1292
/**************************************************************************/
1293
212101
VOID _gx_display_driver_332rgb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
1294
                                                             INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
1295
{
1296
#if defined GX_BRUSH_ALPHA_SUPPORT
1297
GX_UBYTE alpha;
1298
1299
212101
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
1300
212101
    if (alpha == 0)
1301
    {
1302
        /* Nothing to drawn. Just return. */
1303
37056
        return;
1304
    }
1305
1306
175045
    if (info -> pixelmap == GX_NULL)
1307
    {
1308
        /* No pixelmap info here.So just return. */
1309
1
        return;
1310
    }
1311
1312
175044
    if (alpha != 0xff)
1313
    {
1314
42498
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1315
        {
1316
21454
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1317
            {
1318
10494
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_blend(context, xstart, xend, y, info, alpha);
1319
            }
1320
            else
1321
            {
1322
                /* alpha, no compression */
1323
10960
                _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_blend(context, xstart, xend, y, info, alpha);
1324
            }
1325
        }
1326
        else
1327
        {
1328
21044
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1329
            {
1330
10522
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_blend(context, xstart, xend, y, info, alpha);
1331
            }
1332
            else
1333
            {
1334
10522
                _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_blend(context, xstart, xend, y, info, alpha);
1335
            }
1336
        }
1337
    }
1338
    else
1339
    {
1340
#endif
1341
132546
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1342
        {
1343
66478
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1344
            {
1345
33006
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_alpha_write(context, xstart, xend, y, info);
1346
            }
1347
            else
1348
            {
1349
                /* alpha, no compression */
1350
33472
                _gx_display_driver_8bpp_horizontal_pixelmap_line_alpha_write(context, xstart, xend, y, info);
1351
            }
1352
        }
1353
        else
1354
        {
1355
66068
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1356
            {
1357
33034
                _gx_display_driver_8bpp_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
1358
            }
1359
            else
1360
            {
1361
33034
                _gx_display_driver_8bpp_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
1362
            }
1363
        }
1364
#if defined GX_BRUSH_ALPHA_SUPPORT
1365
    }
1366
#endif
1367
1368
    /*Current pixelmap has gone over, so the offset pointer should be reset.*/
1369
175044
    if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1370
    {
1371
1778
        info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
1372
1778
        info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
1373
    }
1374
1375
175044
    return;
1376
}
1377