GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_4bpp_pixelmap_draw.c Lines: 226 226 100.0 %
Date: 2026-03-06 19:21:09 Branches: 116 116 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
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_display_driver_4bpp_pixelmap_raw_write          PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    Internal helper function that handles writing of uncompressed       */
45
/*    pixlemap file without transparent.                                  */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    context                               Drawing context               */
50
/*    xpos                                  x-coord of top-left draw point*/
51
/*    ypos                                  y-coord of top-left draw point*/
52
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    _gx_display_driver_4bpp_pixelmap_draw                               */
61
/*                                                                        */
62
/**************************************************************************/
63
138
static VOID _gx_display_driver_4bpp_pixelmap_raw_write(GX_DRAW_CONTEXT *context,
64
                                                       INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
65
{
66
INT                       xval;
67
INT                       yval;
68
INT                       width;
69
GX_UBYTE                 *putrow;
70
GX_CONST GX_UBYTE        *getrow;
71
GX_UBYTE                 *put;
72
GX_UBYTE                  putmask;
73
INT                       putstride;
74
INT                       getstride;
75
INT                       offset;
76
INT                       offset_row;
77
GX_UBYTE                  pixel;
78
138
GX_RECTANGLE             *clip = context -> gx_draw_context_clip;
79
80
138
    putstride = (context -> gx_draw_context_pitch + 1) >> 1;
81
138
    getstride = (pixelmap -> gx_pixelmap_width + 1) >> 1;
82
83
138
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
84
138
    putrow += clip -> gx_rectangle_top * putstride;
85
138
    putrow += clip -> gx_rectangle_left >> 1;
86
87
138
    offset_row = clip->gx_rectangle_left - xpos;
88
138
    getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data);
89
138
    getrow += getstride * (clip -> gx_rectangle_top - ypos);
90
138
    getrow += offset_row >> 1;
91
92
138
    width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1;
93
94
18980
    for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
95
    {
96
18842
        put = putrow;
97
18842
        offset = offset_row;
98
99
18842
        if (clip -> gx_rectangle_left & 0x01)
100
        {
101
4826
            putmask = 0x0f;
102
        }
103
        else
104
        {
105
14016
            putmask = 0xf0;
106
        }
107
108
3911312
        for (xval = 0; xval < width; xval++)
109
        {
110
3892470
            pixel = *(getrow + (offset >> 1));
111
3892470
            if (offset & 1)
112
            {
113
1945248
                pixel &= 0x0f;
114
            }
115
            else
116
            {
117
1947222
                pixel >>= 4;
118
            }
119
3892470
            pixel |= (GX_UBYTE)(pixel << 4);
120
121
3892470
            *put &= (GX_UBYTE)(~putmask);
122
3892470
            *put |= pixel & putmask;
123
124
3892470
            offset++;
125
3892470
            putmask >>= 4;
126
3892470
            if (putmask == 0)
127
            {
128
1946688
                putmask = 0xf0;
129
1946688
                put++;
130
            }
131
132
        }
133
18842
        putrow += putstride;
134
18842
        getrow += getstride;
135
    }
136
138
}
137
/**************************************************************************/
138
/*                                                                        */
139
/*  FUNCTION                                               RELEASE        */
140
/*                                                                        */
141
/*    _gx_display_driver_4bpp_pixelmap_transparent_write  PORTABLE C      */
142
/*                                                           6.1          */
143
/*  AUTHOR                                                                */
144
/*                                                                        */
145
/*    Kenneth Maxwell, Microsoft Corporation                              */
146
/*                                                                        */
147
/*  DESCRIPTION                                                           */
148
/*                                                                        */
149
/*    Internal helper function that handles writing of uncompressed       */
150
/*    pixlemap file with transparency.                                    */
151
/*                                                                        */
152
/*  INPUT                                                                 */
153
/*                                                                        */
154
/*    context                               Drawing context               */
155
/*    xpos                                  x-coord of top-left draw point*/
156
/*    ypos                                  y-coord of top-left draw point*/
157
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
158
/*                                                                        */
159
/*  OUTPUT                                                                */
160
/*                                                                        */
161
/*    None                                                                */
162
/*                                                                        */
163
/*  CALLED BY                                                             */
164
/*                                                                        */
165
/*    _gx_display_driver_4bpp_pixelmap_draw                               */
166
/*                                                                        */
167
/**************************************************************************/
168
11622
static VOID _gx_display_driver_4bpp_pixelmap_transparent_write(GX_DRAW_CONTEXT *context,
169
                                                               INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
170
{
171
INT             yval;
172
INT             xval;
173
const GX_UBYTE *getrow;
174
const GX_UBYTE *getauxrow;
175
GX_UBYTE       *put;
176
GX_UBYTE       *putrow;
177
GX_UBYTE        putmask;
178
GX_UBYTE        transmask;
179
INT             putstride;
180
INT             getstride;
181
INT             getauxstride;
182
GX_VALUE        offset;
183
GX_VALUE        offset_row;
184
GX_UBYTE        pixel;
185
11622
GX_RECTANGLE   *clip = context -> gx_draw_context_clip;
186
187
188
11622
    offset_row = (GX_VALUE)(clip -> gx_rectangle_left - xpos);
189
11622
    getstride = (pixelmap -> gx_pixelmap_width + 1) >> 1;
190
11622
    getrow = (const GX_UBYTE *)pixelmap -> gx_pixelmap_data;
191
11622
    getrow += getstride * (clip -> gx_rectangle_top - ypos);
192
193
11622
    getauxstride = (pixelmap -> gx_pixelmap_width + 7) >> 3;
194
11622
    getauxrow = (const GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
195
11622
    getauxrow += getauxstride * (clip -> gx_rectangle_top - ypos);
196
197
11622
    putstride = (context -> gx_draw_context_pitch + 1) >> 1;
198
11622
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
199
11622
    putrow += (clip -> gx_rectangle_top * putstride);
200
11622
    putrow += (clip -> gx_rectangle_left >> 1);
201
202
396217
    for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++)
203
    {
204
384595
        offset = offset_row;
205
384595
        put = putrow;
206
384595
        if (clip->gx_rectangle_left & 0x01)
207
        {
208
182669
            putmask = 0x0f;
209
        }
210
        else
211
        {
212
201926
            putmask = 0xf0;
213
        }
214
59698081
        for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++)
215
        {
216
59313486
            transmask = (GX_UBYTE)(0x80 >> (offset & 0x07));
217
59313486
            if ((*(getauxrow + (offset >> 3)) & transmask) == 0)
218
            {
219
28595334
                pixel = *(getrow + (offset >> 1));
220
28595334
                if (offset & 1)
221
                {
222
14286054
                    pixel &= 0x0f;
223
14286054
                    pixel |= (GX_UBYTE)(pixel << 4);
224
                }
225
                else
226
                {
227
14309280
                    pixel &= 0xf0;
228
14309280
                    pixel |= pixel >> 4;
229
                }
230
28595334
                *put &= (GX_UBYTE)(~putmask);
231
28595334
                *put |= pixel & putmask;
232
            }
233
59313486
            offset++;
234
235
59313486
            putmask >>= 4;
236
59313486
            if (putmask == 0)
237
            {
238
29656351
                putmask = 0xf0;
239
29656351
                put++;
240
            }
241
        }
242
243
384595
        getrow += getstride;
244
384595
        putrow += putstride;
245
384595
        getauxrow += getauxstride;
246
    }
247
248
249
11622
}
250
/**************************************************************************/
251
/*                                                                        */
252
/*  FUNCTION                                               RELEASE        */
253
/*                                                                        */
254
/*    _gx_display_driver_4bpp_pixelmap_compressed_write   PORTABLE C      */
255
/*                                                           6.1          */
256
/*  AUTHOR                                                                */
257
/*                                                                        */
258
/*    Kenneth Maxwell, Microsoft Corporation                              */
259
/*                                                                        */
260
/*  DESCRIPTION                                                           */
261
/*                                                                        */
262
/*    Internal helper function that handles writing of compressed         */
263
/*    pixlemap file.                                                      */
264
/*                                                                        */
265
/*  INPUT                                                                 */
266
/*                                                                        */
267
/*    context                               Drawing context               */
268
/*    xpos                                  x-coord of top-left draw point*/
269
/*    ypos                                  y-coord of top-left draw point*/
270
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
271
/*                                                                        */
272
/*  OUTPUT                                                                */
273
/*                                                                        */
274
/*    None                                                                */
275
/*                                                                        */
276
/*  CALLS                                                                 */
277
/*                                                                        */
278
/*    None                                                                */
279
/*                                                                        */
280
/*  CALLED BY                                                             */
281
/*                                                                        */
282
/*    _gx_display_driver_4bpp_pixelmap_draw                               */
283
/*                                                                        */
284
/**************************************************************************/
285
4558
static VOID _gx_display_driver_4bpp_pixelmap_compressed_write(GX_DRAW_CONTEXT *context,
286
                                                              INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
287
{
288
INT             yval;
289
INT             xval;
290
const GX_UBYTE *get;
291
const GX_UBYTE *get_count;
292
GX_UBYTE       *put;
293
GX_UBYTE       *putrow;
294
GX_UBYTE        count;
295
GX_UBYTE        color;
296
GX_UBYTE        putmask;
297
GX_UBYTE        getmask;
298
INT             putstride;
299
4558
GX_RECTANGLE   *clip = context -> gx_draw_context_clip;
300
301
4558
    get = (const GX_UBYTE *)pixelmap -> gx_pixelmap_data;
302
4558
    get_count = (const GX_UBYTE*)pixelmap -> gx_pixelmap_aux_data;
303
4558
    putstride = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution + 1) >> 1;
304
4558
    getmask = 0xf0;
305
306
    /* first, skip to the starting row */
307
4938
    for (yval = ypos; yval < clip -> gx_rectangle_top; yval++)
308
    {
309
380
        xval = 0;
310
65304
        while (xval < pixelmap -> gx_pixelmap_width)
311
        {
312
64924
            count = *get_count++;
313
64924
            if (count & 0x80)
314
            {
315
39368
                count = (GX_UBYTE)((count & 0x7f) + 1);
316
39368
                getmask >>= 4;      /* skip repeated pixel value */
317
39368
                if (getmask == 0)
318
                {
319
19677
                    get++;
320
19677
                    getmask = 0xf0;
321
                }
322
            }
323
            else
324
            {
325
25556
                count++;
326
25556
                get += count >> 1;
327

25556
                if ((getmask == 0x0f) && (count & 1))
328
                {
329
6772
                    get++;
330
                }
331
332
25556
                getmask = (GX_UBYTE)( getmask >> (GX_UBYTE)((count & 1) << 2));
333
25556
                if (getmask == 0)
334
                {
335
6772
                    getmask = 0xf0;
336
                }
337
                /* skip raw pixel values */
338
            }
339
64924
            xval += count;
340
        }
341
    }
342
343
    /* now we are on the first visible row, copy pixels until we get
344
       to the end of the last visible row*/
345
4558
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
346
4558
    putrow += yval * putstride;
347
4558
    putrow += clip -> gx_rectangle_left >> 1;
348
4558
    count = 0;
349
350
80422
    while (yval <= clip -> gx_rectangle_bottom)
351
    {
352
75864
        if (clip -> gx_rectangle_left & 0x01)
353
        {
354
65121
            putmask = 0x0f;
355
        }
356
        else
357
        {
358
10743
            putmask = 0xf0;
359
        }
360
75864
        put = putrow;
361
75864
        xval = xpos;
362
363
699429
        while (xval < (xpos + pixelmap -> gx_pixelmap_width))
364
        {
365
623565
            count = *get_count++;
366
623565
            if (count & 0x80)
367
            {
368
339612
                count = (GX_UBYTE)((count & 0x7f) + 1);
369
339612
                color = (GX_UBYTE)(*get & getmask);
370
339612
                if (getmask == 0xf0)
371
                {
372
169899
                    color |= color >> 4;
373
                }
374
                else
375
                {
376
169713
                    color |= (GX_UBYTE)(color << 4);
377
                }
378
2470439
                while (count--)
379
                {
380
2130827
                    if (xval >= clip -> gx_rectangle_left &&
381
2066890
                        xval <= clip -> gx_rectangle_right)
382
                    {
383
1098946
                        *put &= (GX_UBYTE)(~putmask);
384
1098946
                        *put |= (color & putmask);
385
386
1098946
                        putmask >>= 4;
387
1098946
                        if (putmask == 0)
388
                        {
389
548242
                            putmask = 0xf0;
390
548242
                            put++;
391
                        }
392
                    }
393
2130827
                    xval++;
394
                }
395
339612
                getmask >>= 4;
396
339612
                if (getmask == 0)
397
                {
398
169713
                    getmask = 0xf0;
399
169713
                    get++;
400
                }
401
            }
402
            else
403
            {
404
283953
                count++;
405
1493834
                while (count--)
406
                {
407
1209881
                    if (xval >= clip -> gx_rectangle_left &&
408
1180761
                        xval <= clip -> gx_rectangle_right)
409
                    {
410
642245
                        color = (GX_UBYTE)(*get & getmask);
411
642245
                        if (getmask == 0xf0)
412
                        {
413
320617
                            color |= color >> 4;
414
                        }
415
                        else
416
                        {
417
321628
                            color |= (GX_UBYTE)(color << 4);
418
                        }
419
642245
                        *put &= (GX_UBYTE)(~putmask);
420
642245
                        *put |= (color & putmask);
421
422
642245
                        putmask >>= 4;
423
642245
                        if (putmask == 0)
424
                        {
425
322708
                            putmask = 0xf0;
426
322708
                            put++;
427
                        }
428
                    }
429
430
1209881
                    xval++;
431
1209881
                    getmask >>= 4;
432
1209881
                    if (getmask == 0)
433
                    {
434
605030
                        getmask = 0xf0;
435
605030
                        get++;
436
                    }
437
                }
438
            }
439
        }
440
75864
        putrow += putstride;
441
75864
        yval++;
442
    }
443
4558
}
444
445
/**************************************************************************/
446
/*                                                                        */
447
/*  FUNCTION                                               RELEASE        */
448
/*                                                                        */
449
/*    _gx_display_driver_4bpp_pixelmap_compressed_alpha_write             */
450
/*                                                        PORTABLE C      */
451
/*                                                           6.1          */
452
/*  AUTHOR                                                                */
453
/*                                                                        */
454
/*    Kenneth Maxwell, Microsoft Corporation                              */
455
/*                                                                        */
456
/*  DESCRIPTION                                                           */
457
/*                                                                        */
458
/*    Internal helper function that handles writing of compressed         */
459
/*    pixlemap file with transparent.                                     */
460
/*                                                                        */
461
/*  INPUT                                                                 */
462
/*                                                                        */
463
/*    context                               Drawing context               */
464
/*    xpos                                  x-coord of top-left draw point*/
465
/*    ypos                                  y-coord of top-left draw point*/
466
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
467
/*                                                                        */
468
/*  OUTPUT                                                                */
469
/*                                                                        */
470
/*    None                                                                */
471
/*                                                                        */
472
/*  CALLS                                                                 */
473
/*                                                                        */
474
/*    None                                                                */
475
/*                                                                        */
476
/*  CALLED BY                                                             */
477
/*                                                                        */
478
/*    _gx_display_driver_4bpp_pixelmap_draw                               */
479
/*                                                                        */
480
/**************************************************************************/
481
4745
static VOID _gx_display_driver_4bpp_pixelmap_compressed_transparent_write(GX_DRAW_CONTEXT *context,
482
                                                                          INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
483
{
484
INT                 xval;
485
INT                 yval;
486
const GX_UBYTE     *get;
487
const GX_UBYTE     *get_count;
488
GX_UBYTE            color;
489
GX_UBYTE            count;
490
GX_UBYTE           *put;
491
GX_UBYTE           *putrow;
492
GX_UBYTE            putmask;
493
INT                 putstride;
494
4745
GX_RECTANGLE       *clip = context -> gx_draw_context_clip;
495
496
4745
    get = (const GX_UBYTE *)pixelmap -> gx_pixelmap_data;
497
4745
    get_count = (const GX_UBYTE*)pixelmap -> gx_pixelmap_aux_data;
498
    /* first, skip to the starting row */
499
4791
    for (yval = ypos; yval < clip -> gx_rectangle_top; yval++)
500
    {
501
46
        xval = 0;
502
294
        while (xval < pixelmap -> gx_pixelmap_width)
503
        {
504
248
            count = *get_count++;
505
506
248
            if (count & 0x80)
507
            {
508
204
                count = (GX_UBYTE)((count & 0x7f) + 1);
509
204
                get++;
510
            }
511
            else
512
            {
513
44
                count++;
514
44
                get += count;
515
            }
516
248
            xval += count;
517
        }
518
    }
519
520
4745
    putstride = (context -> gx_draw_context_pitch + 1) >> 1;
521
4745
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
522
4745
    putrow += (clip -> gx_rectangle_top * putstride);
523
4745
    putrow += (xpos >> 1);
524
525
102926
    while (yval <= clip -> gx_rectangle_bottom)
526
    {
527
98181
        xval = xpos;
528
98181
        put = putrow;
529
98181
        if (xpos & 0x01)
530
        {
531
73893
            putmask = 0x0f;
532
        }
533
        else
534
        {
535
24288
            putmask = 0xf0;
536
        }
537
327285
        while (xval < xpos + pixelmap -> gx_pixelmap_width)
538
        {
539
229104
            count = *get_count++;
540
229104
            if (count & 0x80)
541
            {
542
164946
                count = (GX_UBYTE)((count & 0x7f) + 1);
543
164946
                color = *get++;
544
                /* 0xff means transparent.*/
545
164946
                if (color == 0xff)
546
                {
547
75550
                    xval += count;
548
1543149
                    while (count --)
549
                    {
550
1467599
                        putmask >>= 4;
551
1467599
                        if (putmask == 0)
552
                        {
553
722961
                            putmask = 0xf0;
554
722961
                            put++;
555
                        }
556
                    }
557
                }
558
                else
559
                {
560
89396
                    color |= (GX_UBYTE)(color << 4);
561
892235
                    while (count--)
562
                    {
563
802839
                        if (xval >= clip -> gx_rectangle_left &&
564
797817
                            xval <= clip -> gx_rectangle_right)
565
                        {
566
785184
                            *put &= (GX_UBYTE)(~putmask);
567
785184
                            *put |= (GX_UBYTE)(color & putmask);
568
                        }
569
802839
                        xval++;
570
802839
                        putmask >>= 4;
571
572
802839
                        if (putmask == 0)
573
                        {
574
400997
                            putmask = 0xf0;
575
400997
                            put++;
576
                        }
577
                    }
578
                }
579
            }
580
            else
581
            {
582
64158
                count++;
583
266568
                while (count--)
584
                {
585
202410
                    color = *get++;
586
202410
                    if (xval >= clip -> gx_rectangle_left &&
587
200877
                        xval <= clip -> gx_rectangle_right)
588
                    {
589
                        /* 0xff means transparent color, so should skip */
590
200275
                        if (color != 0xff)
591
                        {
592
194281
                            color |= (GX_UBYTE)(color << 4);
593
194281
                            *put &= (GX_UBYTE)(~putmask);
594
194281
                            *put |= (GX_UBYTE)(color & putmask);
595
                        }
596
                    }
597
598
202410
                    xval++;
599
202410
                    putmask >>= 4;
600
202410
                    if (putmask == 0)
601
                    {
602
107220
                        putmask = 0xf0;
603
107220
                        put++;
604
                    }
605
                }
606
            }
607
        }
608
609
98181
        putrow += putstride;
610
98181
        yval++;
611
    }
612
4745
}
613
614
/**************************************************************************/
615
/*                                                                        */
616
/*  FUNCTION                                               RELEASE        */
617
/*                                                                        */
618
/*    _gx_display_driver_4bpp_pixelmap_draw               PORTABLE C      */
619
/*                                                           6.1          */
620
/*  AUTHOR                                                                */
621
/*                                                                        */
622
/*    Kenneth Maxwell, Microsoft Corporation                              */
623
/*                                                                        */
624
/*  DESCRIPTION                                                           */
625
/*                                                                        */
626
/*    4bit screen driver pixelmap drawing function that handles           */
627
/*    compressed or uncompress, with or without alpha channel.            */
628
/*                                                                        */
629
/*  INPUT                                                                 */
630
/*                                                                        */
631
/*    context                               Drawing context               */
632
/*    xpos                                  x-coord of top-left draw point*/
633
/*    ypos                                  y-coord of top-left draw point*/
634
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
635
/*                                                                        */
636
/*  OUTPUT                                                                */
637
/*                                                                        */
638
/*    None                                                                */
639
/*                                                                        */
640
/*  CALLS                                                                 */
641
/*                                                                        */
642
/*     _gx_display_driver_4bpp_pixelmap_compressed_write                  */
643
/*                                          Real pixelmap draw routine    */
644
/*     _gx_display_driver_4bpp_pixelmap_compressed_transparent_write      */
645
/*                                          Real pixelmap draw routine    */
646
/*     _gx_display_driver_4bpp_pixelmap_raw_write                         */
647
/*                                          Real pixelmap draw routine    */
648
/*     _gx_display_driver_4bpp_pixelmap_transparent_write                 */
649
/*                                          Real pixelmap draw routine    */
650
/*                                                                        */
651
/*  CALLED BY                                                             */
652
/*                                                                        */
653
/*    GUIX Internal Code                                                  */
654
/*                                                                        */
655
/**************************************************************************/
656
21065
VOID _gx_display_driver_4bpp_pixelmap_draw(GX_DRAW_CONTEXT *context,
657
                                           INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
658
{
659
660
21065
    if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_4BIT_GRAY ||
661
21064
        (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA))
662
    {
663
        /* wrong color format for this driver */
664
2
        return;
665
    }
666
667
21063
    if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
668
    {
669
        /* Pixelmap wtih transparent must be compressed. */
670
16367
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
671
        {
672
4745
            _gx_display_driver_4bpp_pixelmap_compressed_transparent_write(context, xpos, ypos, pixelmap);
673
        }
674
        else
675
        {
676
11622
            _gx_display_driver_4bpp_pixelmap_transparent_write(context, xpos, ypos, pixelmap);
677
        }
678
    }
679
    else
680
    {
681
4696
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
682
        {
683
            /* compressed with no transparency */
684
4558
            _gx_display_driver_4bpp_pixelmap_compressed_write(context, xpos, ypos, pixelmap);
685
        }
686
        else
687
        {
688
            /* no compression or transaprency */
689
138
            _gx_display_driver_4bpp_pixelmap_raw_write(context, xpos, ypos, pixelmap);
690
        }
691
    }
692
}
693