GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw.c Lines: 270 270 100.0 %
Date: 2026-03-06 19:21:09 Branches: 178 178 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
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_    */
37
/*                                                                  blend */
38
/*                                                                        */
39
/*                                                        PORTABLE C      */
40
/*                                                           6.1.4        */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    Internal helper function that handles blending of uncompressed      */
48
/*    pixelmap file with alpha channel by lines.                          */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    context                               Drawing context               */
53
/*    xstart                                x-coord of line left          */
54
/*    xend                                  x-coord of line right         */
55
/*    y                                     y-coord of line top           */
56
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
57
/*    alpha                                 Alpha value                   */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    None                                                                */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_display_driver_32argb_pixel_blend Basic display driver pixel    */
66
/*                                            blend function              */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
71
/*                                                                        */
72
/**************************************************************************/
73
7104
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_blend(GX_DRAW_CONTEXT *context,
74
                                                                                  INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
75
{
76
INT                xval;
77
GX_COLOR           color;
78
GX_CONST GX_COLOR *get;
79
GX_PIXELMAP       *pixelmap;
80
GX_VALUE           pic_width;
81
GX_VALUE           offset;
82
83
7104
    pixelmap = info -> pixelmap;
84
85
7104
    pic_width = pixelmap -> gx_pixelmap_height;
86
87

7104
    if ((info -> draw) && (xstart <= xend))
88
    {
89
5950
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
90
91
        /* Calculate the map offset in x-axis. */
92
5950
        offset = (GX_VALUE)(info -> x_offset % pic_width);
93
94
635353
        for (xval = xstart; xval <= xend; xval++)
95
        {
96
97
            /* Get points to the start postion of this row. So we need to calculate its position.  */
98
629403
            color = *(get + offset);
99
100
629403
            if (color & 0xff000000)
101
            {
102
245166
                _gx_display_driver_32argb_pixel_blend(context, xval, y, color, alpha);
103
            }
104
629403
            offset++;
105
629403
            if (offset >= pic_width)
106
            {
107
16291
                offset = (GX_VALUE)(offset - pic_width);
108
            }
109
        }
110
    }
111
112
    /* This line is drawn. Update the pointer position for next row.  */
113
7104
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_COLOR);
114
7104
}
115
116
/**************************************************************************/
117
/*                                                                        */
118
/*  FUNCTION                                               RELEASE        */
119
/*                                                                        */
120
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_blend */
121
/*                                                                        */
122
/*                                                        PORTABLE C      */
123
/*                                                           6.1.4        */
124
/*  AUTHOR                                                                */
125
/*                                                                        */
126
/*    Kenneth Maxwell, Microsoft Corporation                              */
127
/*                                                                        */
128
/*  DESCRIPTION                                                           */
129
/*                                                                        */
130
/*    Internal helper function that handles writing of raw pixlemap file  */
131
/*      with brush alpha by line.                                         */
132
/*                                                                        */
133
/*  INPUT                                                                 */
134
/*                                                                        */
135
/*    context                               Drawing context               */
136
/*    xstart                                x-coord of line left          */
137
/*    xend                                  x-coord of line right         */
138
/*    y                                     y-coord of line top           */
139
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
140
/*    alpha                                 Alpha value                   */
141
/*                                                                        */
142
/*  OUTPUT                                                                */
143
/*                                                                        */
144
/*    None                                                                */
145
/*                                                                        */
146
/*  CALLS                                                                 */
147
/*                                                                        */
148
/*    _gx_display_driver_32argb_pixel_blend Basic display driver pixel    */
149
/*                                            blend function              */
150
/*                                                                        */
151
/*  CALLED BY                                                             */
152
/*                                                                        */
153
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
154
/*                                                                        */
155
/**************************************************************************/
156
8684
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_blend(GX_DRAW_CONTEXT *context,
157
                                                                                INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
158
{
159
INT                xval;
160
INT                offset;
161
INT                pic_width;
162
GX_CONST GX_COLOR *get;
163
GX_COLOR           pixel;
164
GX_PIXELMAP       *pixelmap;
165
166
8684
    pixelmap = info -> pixelmap;
167
168
8684
    pic_width = pixelmap -> gx_pixelmap_height;
169
170

8684
    if ((info -> draw) && (xstart <= xend))
171
    {
172
5950
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
173
174
        /* Calculate map offset in x-axis. */
175
5950
        offset = (info -> x_offset % pic_width);
176
177
635353
        for (xval = xstart; xval <= xend; xval++)
178
        {
179
180
            /* Get points to the start postion of this row. So we need to calculate its position.  */
181
629403
            pixel = *(get + offset);
182
629403
            _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, alpha);
183
629403
            offset++;
184
629403
            if (offset >= pic_width)
185
            {
186
3998
                offset -= pic_width;
187
            }
188
        }
189
    }
190
191
    /* This line is drawn. Update the pointer position for next row. */
192
8684
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_COLOR);
193
8684
}
194
195
/**************************************************************************/
196
/*                                                                        */
197
/*  FUNCTION                                               RELEASE        */
198
/*                                                                        */
199
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_          */
200
/*                                                       compressed_blend */
201
/*                                                                        */
202
/*                                                        PORTABLE C      */
203
/*                                                           6.1.4        */
204
/*  AUTHOR                                                                */
205
/*                                                                        */
206
/*    Kenneth Maxwell, Microsoft Corporation                              */
207
/*                                                                        */
208
/*  DESCRIPTION                                                           */
209
/*                                                                        */
210
/*    Internal helper function that handles writing of compressed         */
211
/*    pixlemap file without alpha channel with brush alpha by line.       */
212
/*                                                                        */
213
/*  INPUT                                                                 */
214
/*                                                                        */
215
/*    context                               Drawing context               */
216
/*    xstart                                x-coord of line left          */
217
/*    xend                                  x-coord of line right         */
218
/*    y                                     y-coord of line top           */
219
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
220
/*    alpha                                 Alpha value                   */
221
/*                                                                        */
222
/*  OUTPUT                                                                */
223
/*                                                                        */
224
/*    None                                                                */
225
/*                                                                        */
226
/*  CALLS                                                                 */
227
/*                                                                        */
228
/*    _gx_display_driver_32argb_pixel_blend Basic display driver pixel    */
229
/*                                            blend function              */
230
/*                                                                        */
231
/*  CALLED BY                                                             */
232
/*                                                                        */
233
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
234
/*                                                                        */
235
/**************************************************************************/
236
8684
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_blend(GX_DRAW_CONTEXT *context,
237
                                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
238
{
239
INT                start_pos;
240
INT                xval;
241
GX_UBYTE           count;
242
GX_COLOR           pixel;
243
GX_PIXELMAP       *pixelmap;
244
8684
GX_CONST GX_COLOR *get = GX_NULL;
245
8684
GX_CONST GX_UBYTE *get_count = GX_NULL;
246
247
8684
    pixelmap = info -> pixelmap;
248
249

8684
    if ((info -> draw) && (xstart <= xend))
250
    {
251
        /* This means it's the draw operation. */
252
        /* Skip the invisible pixels.*/
253
5950
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
254
255
        /* Repeat the draw operation to fill the whole dirty area. */
256
15623
        while (start_pos <= xend)
257
        {
258
9673
            xval = start_pos;
259
260
            /* Start from where we need to repeat. */
261
9673
            get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
262
9673
            get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
263
264
23276
            while (xval < start_pos + pixelmap -> gx_pixelmap_height)
265
            {
266
13603
                count = *get_count++;
267
13603
                if (count & 0x80)
268
                {
269
2025
                    count = (GX_UBYTE)((count & 0x7f) + 1);
270
271
2025
                    pixel = *get++;
272
8805
                    while (count--)
273
                    {
274

6780
                        if (xval >= xstart && xval <= xend)
275
                        {
276
3492
                            _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, alpha);
277
                        }
278
6780
                        xval++;
279
                    }
280
                }
281
                else
282
                {
283
11578
                    count++;
284
1223596
                    while (count--)
285
                    {
286
1212018
                        pixel = *get++;
287

1212018
                        if (xval >= xstart && xval <= xend)
288
                        {
289
625911
                            _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, alpha);
290
                        }
291
1212018
                        xval++;
292
                    }
293
                }
294
            }
295
9673
            start_pos += pixelmap -> gx_pixelmap_height;
296
        }
297
    }
298
    else
299
    {
300
        /* Just do skip operation here. */
301
2734
        xval = 0;
302
2734
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
303
2734
        get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
304
6338
        while (xval < pixelmap -> gx_pixelmap_height)
305
        {
306
3604
            count = *get_count++;
307
3604
            if (count & 0x80)
308
            {
309
438
                count = (GX_UBYTE)((count & 0x7f) + 1);
310
438
                get++;
311
            }
312
            else
313
            {
314
3166
                count++;
315
3166
                get += count;
316
            }
317
3604
            xval += count;
318
        }
319
    }
320
321
    /* This line is drawn. cache the pointer for next line draw. */
322
8684
    info -> current_pixel_ptr = (GX_UBYTE *)get;
323
8684
    info -> current_aux_ptr = (GX_UBYTE *)get_count;
324
8684
}
325
326
/**************************************************************************/
327
/*                                                                        */
328
/*  FUNCTION                                               RELEASE        */
329
/*                                                                        */
330
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_          */
331
/*                                                 compressed_alpha_blend */
332
/*                                                                        */
333
/*                                                        PORTABLE C      */
334
/*                                                           6.1.4        */
335
/*  AUTHOR                                                                */
336
/*                                                                        */
337
/*    Kenneth Maxwell, Microsoft Corporation                              */
338
/*                                                                        */
339
/*  DESCRIPTION                                                           */
340
/*                                                                        */
341
/*    Internal helper function that handles writing of compressed         */
342
/*    pixlemap file with alpha channel with brush alpha for one line.     */
343
/*                                                                        */
344
/*  INPUT                                                                 */
345
/*                                                                        */
346
/*    context                               Drawing context               */
347
/*    xstart                                x-coord of line left          */
348
/*    xend                                  x-coord of line right         */
349
/*    y                                     y-coord of line top           */
350
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
351
/*    alpha                                 Alpha value                   */
352
/*                                                                        */
353
/*  OUTPUT                                                                */
354
/*                                                                        */
355
/*    None                                                                */
356
/*                                                                        */
357
/*  CALLS                                                                 */
358
/*                                                                        */
359
/*    _gx_display_driver_32argb_pixel_blend Basic display driver pixel    */
360
/*                                            blend function              */
361
/*                                                                        */
362
/*  CALLED BY                                                             */
363
/*                                                                        */
364
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
365
/*                                                                        */
366
/**************************************************************************/
367
15848
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_alpha_blend(GX_DRAW_CONTEXT *context,
368
                                                                                             INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info, GX_UBYTE alpha)
369
{
370
INT                xval;
371
GX_UBYTE           count;
372
INT                start_pos;
373
GX_COLOR           pixel;
374
15848
GX_CONST GX_COLOR *get = GX_NULL;
375
15848
GX_CONST GX_UBYTE *get_count = GX_NULL;
376
GX_PIXELMAP       *pixelmap;
377
378
15848
    pixelmap = info -> pixelmap;
379
380

15848
    if ((info -> draw) && (xstart <= xend))
381
    {
382
        /* Calculate draw start position. */
383
11644
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
384
385
        /* Repeat the draw operation to fill the whole dirty area. */
386
35421
        while (start_pos <= xend)
387
        {
388
23777
            xval = start_pos;
389
390
            /* Start from where we need to repeat. */
391
23777
            get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
392
23777
            get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
393
394
140632
            while (xval < start_pos + pixelmap -> gx_pixelmap_height)
395
            {
396
116855
                count = *get_count++;
397
116855
                if (count & 0x80)
398
                {
399
64064
                    count = (GX_UBYTE)((count & 0x7f) + 1);
400
64064
                    pixel = *get++;
401
2186308
                    while (count--)
402
                    {
403
2122244
                        if (pixel & 0xff000000)
404
                        {
405

752542
                            if (xval >= xstart && xval <= xend)
406
                            {
407
330547
                                _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, alpha);
408
                            }
409
                        }
410
2122244
                        xval++;
411
                    }
412
                }
413
                else
414
                {
415
52791
                    count++;
416
314147
                    while (count--)
417
                    {
418
261356
                        pixel = *get++;
419
261356
                        if (pixel & 0xff000000)
420
                        {
421

222102
                            if (xval >= xstart && xval <= xend)
422
                            {
423
142324
                                _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, alpha);
424
                            }
425
                        }
426
261356
                        xval++;
427
                    }
428
                }
429
            }
430
23777
            start_pos += pixelmap -> gx_pixelmap_height;
431
        }
432
    }
433
    else
434
    {
435
        /* Just do skip operation here. */
436
4204
        xval = 0;
437
4204
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
438
4204
        get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
439
33653
        while (xval < pixelmap -> gx_pixelmap_height)
440
        {
441
29449
            count = *get_count++;
442
29449
            if (count & 0x80)
443
            {
444
16055
                count = (GX_UBYTE)((count & 0x7f) + 1);
445
16055
                get++;
446
            }
447
            else
448
            {
449
13394
                count++;
450
13394
                get += count;
451
            }
452
29449
            xval += count;
453
        }
454
    }
455
456
    /* This line is drawn. cache the pointer for next line draw. */
457
15848
    info -> current_pixel_ptr = (GX_UBYTE *)get;
458
15848
    info -> current_aux_ptr = (GX_UBYTE *)get_count;
459
15848
}
460
#endif
461
462
/**************************************************************************/
463
/*                                                                        */
464
/*  FUNCTION                                               RELEASE        */
465
/*                                                                        */
466
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_    */
467
/*                                                                  write */
468
/*                                                                        */
469
/*                                                        PORTABLE C      */
470
/*                                                           6.1.4        */
471
/*  AUTHOR                                                                */
472
/*                                                                        */
473
/*    Kenneth Maxwell, Microsoft Corporation                              */
474
/*                                                                        */
475
/*  DESCRIPTION                                                           */
476
/*                                                                        */
477
/*    Internal helper function that handles writing of uncompressed       */
478
/*    pixlemap file with alpha channel for one line.                      */
479
/*                                                                        */
480
/*  INPUT                                                                 */
481
/*                                                                        */
482
/*    context                               Drawing context               */
483
/*    xstart                                x-coord of line left          */
484
/*    xend                                  x-coord of line right         */
485
/*    y                                     y-coord of line top           */
486
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
487
/*                                                                        */
488
/*  OUTPUT                                                                */
489
/*                                                                        */
490
/*    None                                                                */
491
/*                                                                        */
492
/*  CALLS                                                                 */
493
/*                                                                        */
494
/*    _gx_display_driver_32argb_pixel_blend                               */
495
/*    _gx_display_driver_32argb_pixel_write                               */
496
/*                                                                        */
497
/*  CALLED BY                                                             */
498
/*                                                                        */
499
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
500
/*                                                                        */
501
/**************************************************************************/
502
7104
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_write(GX_DRAW_CONTEXT *context,
503
                                                                                  INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
504
{
505
INT                xval;
506
GX_COLOR           color;
507
GX_CONST GX_COLOR *get;
508
UCHAR              alpha_value;
509
GX_PIXELMAP       *pixelmap;
510
GX_VALUE           pic_width;
511
GX_VALUE           offset;
512
513
7104
    pixelmap = info -> pixelmap;
514
515
7104
    pic_width = pixelmap -> gx_pixelmap_height;
516
517

7104
    if ((info -> draw) && (xstart <= xend))
518
    {
519
5950
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
520
521
        /* Calculate the offset.  */
522
5950
        offset = (GX_VALUE)(info -> x_offset % pic_width);
523
524
635353
        for (xval = xstart; xval <= xend; xval++)
525
        {
526
            /* Get points to the start postion of this row. So we need to calculate its position.  */
527
629403
            color = *(get + offset);
528
629403
            alpha_value = (GX_UBYTE)((color >> 24) & 0xff);
529
629403
            if (alpha_value)
530
            {
531
245166
                if (alpha_value == 255)
532
                {
533
156849
                    _gx_display_driver_32bpp_pixel_write(context, xval, y, color);
534
                }
535
                else
536
                {
537
88317
                    _gx_display_driver_32argb_pixel_blend(context, xval, y, color, 0xff);
538
                }
539
            }
540
629403
            offset++;
541
629403
            if (offset >= pic_width)
542
            {
543
16291
                offset = (GX_VALUE)(offset - pic_width);
544
            }
545
        }
546
    }
547
548
    /* This line is drawn. Update the pointer position for next row.  */
549
7104
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_COLOR);
550
7104
}
551
552
/**************************************************************************/
553
/*                                                                        */
554
/*  FUNCTION                                               RELEASE        */
555
/*                                                                        */
556
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_write */
557
/*                                                                        */
558
/*                                                        PORTABLE C      */
559
/*                                                           6.1.4        */
560
/*  AUTHOR                                                                */
561
/*                                                                        */
562
/*    Kenneth Maxwell, Microsoft Corporation                              */
563
/*                                                                        */
564
/*  DESCRIPTION                                                           */
565
/*                                                                        */
566
/*    Internal helper function that handles writing of raw pixlemap file  */
567
/*    for one line.                                                       */
568
/*                                                                        */
569
/*  INPUT                                                                 */
570
/*                                                                        */
571
/*    context                               Drawing context               */
572
/*    xstart                                x-coord of line left          */
573
/*    xend                                  x-coord of line right         */
574
/*    y                                     y-coord of line top           */
575
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
576
/*                                                                        */
577
/*  OUTPUT                                                                */
578
/*                                                                        */
579
/*    None                                                                */
580
/*                                                                        */
581
/*  CALLS                                                                 */
582
/*                                                                        */
583
/*    None                                                                */
584
/*                                                                        */
585
/*  CALLED BY                                                             */
586
/*                                                                        */
587
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
588
/*                                                                        */
589
/**************************************************************************/
590
8684
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_write(GX_DRAW_CONTEXT *context,
591
                                                                                INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
592
{
593
INT                xval;
594
INT                offset;
595
INT                pic_width;
596
GX_CONST GX_COLOR *get;
597
GX_COLOR          *put;
598
GX_PIXELMAP       *pixelmap;
599
600
8684
    pixelmap = info -> pixelmap;
601
602
8684
    pic_width = pixelmap -> gx_pixelmap_height;
603
604

8684
    if ((info -> draw) && (xstart <= xend))
605
    {
606
5950
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
607
5950
        put = (GX_COLOR *)context -> gx_draw_context_memory;
608
5950
        put += y * context -> gx_draw_context_pitch + xstart;
609
610
        /* Calculate the offset.  */
611
5950
        offset = (info -> x_offset % pic_width);
612
613
635353
        for (xval = xstart; xval <= xend; xval++)
614
        {
615
            /* Get points to the start postion of this row. So we need to calculate its position.  */
616
629403
            *put++ = *(get + offset);
617
629403
            offset++;
618
629403
            if (offset >= pic_width)
619
            {
620
3998
                offset -= pic_width;
621
            }
622
        }
623
    }
624
625
    /* This line is drawn. Update the pointer position for next row.  */
626
8684
    info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_COLOR);
627
8684
}
628
629
/**************************************************************************/
630
/*                                                                        */
631
/*  FUNCTION                                               RELEASE        */
632
/*                                                                        */
633
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_          */
634
/*                                                       compressed_write */
635
/*                                                                        */
636
/*                                                        PORTABLE C      */
637
/*                                                           6.1.4        */
638
/*  AUTHOR                                                                */
639
/*                                                                        */
640
/*    Kenneth Maxwell, Microsoft Corporation                              */
641
/*                                                                        */
642
/*  DESCRIPTION                                                           */
643
/*                                                                        */
644
/*    Internal helper function that handles writing of compressed         */
645
/*    pixlemap file without alpha channel for one line.                   */
646
/*                                                                        */
647
/*  INPUT                                                                 */
648
/*                                                                        */
649
/*    context                               Drawing context               */
650
/*    xstart                                x-coord of line left          */
651
/*    xend                                  x-coord of line right         */
652
/*    y                                     y-coord of line top           */
653
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
654
/*                                                                        */
655
/*  OUTPUT                                                                */
656
/*                                                                        */
657
/*    None                                                                */
658
/*                                                                        */
659
/*  CALLS                                                                 */
660
/*                                                                        */
661
/*    None                                                                */
662
/*                                                                        */
663
/*  CALLED BY                                                             */
664
/*                                                                        */
665
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
666
/*                                                                        */
667
/**************************************************************************/
668
8684
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_write(GX_DRAW_CONTEXT *context,
669
                                                                                       INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
670
{
671
INT                start_pos;
672
INT                xval;
673
GX_UBYTE           count;
674
GX_COLOR           pixel;
675
8684
GX_CONST GX_COLOR *get = GX_NULL;
676
GX_COLOR          *put;
677
8684
GX_CONST GX_UBYTE *get_count = GX_NULL;
678
GX_PIXELMAP       *pixelmap;
679
680
8684
    pixelmap = info -> pixelmap;
681
682

8684
    if ((info -> draw) && (xstart <= xend))
683
    {
684
        /* Calculate draw start position.  */
685
5950
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
686
687
5950
        put = (GX_COLOR *)context -> gx_draw_context_memory;
688
5950
        put += y * context -> gx_draw_context_pitch + start_pos;
689
690
        /* Repeat the draw operation to fill the whole dirty area.  */
691
15623
        while (start_pos <= xend)
692
        {
693
9673
            xval = start_pos;
694
695
            /* Start from where we need to repeat.  */
696
9673
            get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
697
9673
            get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
698
699
23276
            while (xval < start_pos + pixelmap -> gx_pixelmap_height)
700
            {
701
13603
                count = *get_count++;
702
13603
                if (count & 0x80)
703
                {
704
2025
                    count = (GX_UBYTE)((count & 0x7f) + 1);
705
706
2025
                    pixel = *get++;
707
8805
                    while (count--)
708
                    {
709

6780
                        if (xval >= xstart && xval <= xend)
710
                        {
711
3492
                            *put = pixel;
712
                        }
713
6780
                        xval++;
714
6780
                        put++;
715
                    }
716
                }
717
                else
718
                {
719
11578
                    count++;
720
1223596
                    while (count--)
721
                    {
722
1212018
                        pixel = *get++;
723

1212018
                        if (xval >= xstart && xval <= xend)
724
                        {
725
625911
                            *put = pixel;
726
                        }
727
1212018
                        xval++;
728
1212018
                        put++;
729
                    }
730
                }
731
            }
732
9673
            start_pos += pixelmap -> gx_pixelmap_height;
733
        }
734
    }
735
    else
736
    {
737
        /* Just do skip operation here.  */
738
2734
        xval = 0;
739
2734
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
740
2734
        get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
741
6338
        while (xval < pixelmap -> gx_pixelmap_height)
742
        {
743
3604
            count = *get_count++;
744
3604
            if (count & 0x80)
745
            {
746
438
                count = (GX_UBYTE)((count & 0x7f) + 1);
747
438
                get++;
748
            }
749
            else
750
            {
751
3166
                count++;
752
3166
                get += count;
753
            }
754
3604
            xval += count;
755
        }
756
    }
757
758
    /* This line is drawn. cache the pointer for next line draw.  */
759
8684
    info -> current_pixel_ptr = (GX_UBYTE *)get;
760
8684
    info -> current_aux_ptr = (GX_UBYTE *)get_count;
761
8684
}
762
763
/**************************************************************************/
764
/*                                                                        */
765
/*  FUNCTION                                               RELEASE        */
766
/*                                                                        */
767
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_          */
768
/*                                                 compressed_alpha_write */
769
/*                                                                        */
770
/*                                                        PORTABLE C      */
771
/*                                                           6.1.4        */
772
/*  AUTHOR                                                                */
773
/*                                                                        */
774
/*    Kenneth Maxwell, Microsoft Corporation                              */
775
/*                                                                        */
776
/*  DESCRIPTION                                                           */
777
/*                                                                        */
778
/*    Internal helper function that handles writing of compressed         */
779
/*    pixlemap file with alpha channel.                                   */
780
/*                                                                        */
781
/*  INPUT                                                                 */
782
/*                                                                        */
783
/*    context                               Drawing context               */
784
/*    xstart                                x-coord of line left          */
785
/*    xend                                  x-coord of line right         */
786
/*    y                                     y-coord of line top           */
787
/*    info                                  GX_FILL_PIXELMAP_INFO struct  */
788
/*                                                                        */
789
/*  OUTPUT                                                                */
790
/*                                                                        */
791
/*    None                                                                */
792
/*                                                                        */
793
/*  CALLS                                                                 */
794
/*                                                                        */
795
/*    _gx_display_driver_32argb_pixel_blend                               */
796
/*    _gx_display_driver_32argb_pixel_write                               */
797
/*                                                                        */
798
/*  CALLED BY                                                             */
799
/*                                                                        */
800
/*    _gx_display_driver_32bpp_horizontal_pixelmap_line_draw              */
801
/*                                                                        */
802
/**************************************************************************/
803
15848
static VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_alpha_write(GX_DRAW_CONTEXT *context,
804
                                                                                             INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
805
{
806
INT                xval;
807
GX_UBYTE           count;
808
INT                start_pos;
809
GX_UBYTE           alpha_value;
810
GX_COLOR           pixel;
811
15848
GX_CONST GX_COLOR *get = GX_NULL;
812
15848
GX_CONST GX_UBYTE *get_count = GX_NULL;
813
GX_PIXELMAP       *pixelmap;
814
815
15848
    pixelmap = info -> pixelmap;
816
817

15848
    if ((info -> draw) && (xstart <= xend))
818
    {
819
        /* Calculate draw start position.  */
820
11644
        start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
821
822
        /* Repeat the draw operation to fill the whole dirty area.  */
823
35421
        while (start_pos <= xend)
824
        {
825
23777
            xval = start_pos;
826
827
            /* Start from where we need to repeat.  */
828
23777
            get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
829
23777
            get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
830
831
140632
            while (xval < start_pos + pixelmap -> gx_pixelmap_height)
832
            {
833
116855
                count = *get_count++;
834
116855
                if (count & 0x80)
835
                {
836
64064
                    count = (GX_UBYTE)((count & 0x7f) + 1);
837
64064
                    pixel = *get++;
838
64064
                    alpha_value = (GX_UBYTE)((pixel >> 24) & 0xff);
839
2186308
                    while (count--)
840
                    {
841
2122244
                        if (alpha_value)
842
                        {
843

752542
                            if (xval >= xstart && xval <= xend)
844
                            {
845
330547
                                _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, 0xff);
846
                            }
847
                        }
848
2122244
                        xval++;
849
                    }
850
                }
851
                else
852
                {
853
52791
                    count++;
854
314147
                    while (count--)
855
                    {
856
261356
                        pixel = *get++;
857
261356
                        alpha_value = (GX_UBYTE)((pixel >> 24) & 0xff);
858
261356
                        if (alpha_value)
859
                        {
860

222102
                            if (xval >= xstart && xval <= xend)
861
                            {
862
142324
                                if (alpha_value == 0xff)
863
                                {
864
59799
                                    _gx_display_driver_32bpp_pixel_write(context, xval, y, pixel);
865
                                }
866
                                else
867
                                {
868
82525
                                    _gx_display_driver_32argb_pixel_blend(context, xval, y, pixel, 0xff);
869
                                }
870
                            }
871
                        }
872
261356
                        xval++;
873
                    }
874
                }
875
            }
876
23777
            start_pos += pixelmap -> gx_pixelmap_height;
877
        }
878
    }
879
    else
880
    {
881
        /* Just do skip operation here.  */
882
4204
        xval = 0;
883
4204
        get = (GX_CONST GX_COLOR *)info -> current_pixel_ptr;
884
4204
        get_count = (GX_CONST GX_UBYTE *)info -> current_aux_ptr;
885
33653
        while (xval < pixelmap -> gx_pixelmap_height)
886
        {
887
29449
            count = *get_count++;
888
29449
            if (count & 0x80)
889
            {
890
16055
                count = (GX_UBYTE)((count & 0x7f) + 1);
891
16055
                get++;
892
            }
893
            else
894
            {
895
13394
                count++;
896
13394
                get += count;
897
            }
898
29449
            xval += count;
899
        }
900
    }
901
902
    /* This line is drawn. cache the pointer for next line draw.  */
903
15848
    info -> current_pixel_ptr = (GX_UBYTE *)get;
904
15848
    info -> current_aux_ptr = (GX_UBYTE *)get_count;
905
15848
}
906
907
/**************************************************************************/
908
/*                                                                        */
909
/*  FUNCTION                                               RELEASE        */
910
/*                                                                        */
911
/*    _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw      */
912
/*                                                                        */
913
/*                                                        PORTABLE C      */
914
/*                                                           6.1.4        */
915
/*  AUTHOR                                                                */
916
/*                                                                        */
917
/*    Kenneth Maxwell, Microsoft Corporation                              */
918
/*                                                                        */
919
/*  DESCRIPTION                                                           */
920
/*                                                                        */
921
/*    32bpp screen driver horizontal pixelmap line drawing function that  */
922
/*    handles compressed or uncompress, with or without alpha channel.    */
923
/*                                                                        */
924
/*  INPUT                                                                 */
925
/*                                                                        */
926
/*    context                               Drawing context               */
927
/*    xstart                                x-coord of line left          */
928
/*    xend                                  x-coord of line right         */
929
/*    y                                     y-coord of line top           */
930
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
931
/*                                                                        */
932
/*  OUTPUT                                                                */
933
/*                                                                        */
934
/*    None                                                                */
935
/*                                                                        */
936
/*  CALLS                                                                 */
937
/*                                                                        */
938
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_         */
939
/*                                                 compressed_alpha_blend */
940
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_   */
941
/*                                                                  write */
942
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_         */
943
/*                                                       compressed_write */
944
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_write*/
945
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_c_a_blend*/
946
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_a_blend  */
947
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_c_blend  */
948
/*     _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_blend*/
949
/*                                                                        */
950
/*  CALLED BY                                                             */
951
/*                                                                        */
952
/*    GUIX Internal Code                                                  */
953
/*                                                                        */
954
/**************************************************************************/
955
119595
VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
956
                                                                    INT ystart, INT yend, INT x, GX_FILL_PIXELMAP_INFO *info)
957
{
958
INT xstart;
959
INT xend;
960
INT y;
961
962
119595
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
963
    {
964
78651
        xstart = ystart;
965
78651
        xend = yend;
966
78651
        y = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - x - 1;
967
    }
968
    else
969
    {
970
40944
        xstart = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1;
971
40944
        xend = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ystart - 1;
972
40944
        y = x;
973
40944
        info -> x_offset = (yend - ystart + 1 + info -> x_offset) % info -> pixelmap -> gx_pixelmap_height;
974
975
40944
        if (info -> x_offset)
976
        {
977
38589
            info -> x_offset = info -> pixelmap -> gx_pixelmap_height - info -> x_offset;
978
        }
979
}
980
981
#if defined GX_BRUSH_ALPHA_SUPPORT
982
GX_UBYTE alpha;
983
984
119595
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
985

119595
    if ((alpha == 0) || (info -> pixelmap == GX_NULL))
986
    {
987
        /* Nothing to drawn. Just return.  */
988
38955
        return;
989
    }
990
991
80640
    if (alpha != 0xff)
992
    {
993
40320
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
994
        {
995
24532
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
996
            {
997
                /* Compressed, with alpha channel.  */
998
15848
                _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_alpha_blend(context, xstart, xend, y, info, alpha);
999
            }
1000
            else
1001
            {
1002
                /* Compressed, without alpha channel.  */
1003
8684
                _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_blend(context, xstart, xend, y, info, alpha);
1004
            }
1005
        }
1006
        else
1007
        {
1008
15788
            if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1009
            {
1010
                /* No compression, with alpha channel.  */
1011
7104
                _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_blend(context, xstart, xend, y, info, alpha);
1012
            }
1013
            else
1014
            {
1015
                /* No compression without alpha channel.  */
1016
8684
                _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_blend(context, xstart, xend, y, info, alpha);
1017
            }
1018
        }
1019
1020
        /* Current pixelmap has gone over, so the offset pointer should be reset.  */
1021
40320
        if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1022
        {
1023
361
            info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
1024
361
            info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
1025
        }
1026
40320
        return;
1027
    }
1028
1029
#endif
1030
1031
40320
    if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
1032
    {
1033
24532
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1034
        {
1035
            /* Compressed, with alpha channel.  */
1036
15848
            _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_alpha_write(context, xstart, xend, y, info);
1037
        }
1038
        else
1039
        {
1040
            /* Compressed, without alpha channel.  */
1041
8684
            _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
1042
        }
1043
    }
1044
    else
1045
    {
1046
15788
        if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
1047
        {
1048
            /* No compression, with alpha channel.  */
1049
7104
            _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_alpha_write(context, xstart, xend, y, info);
1050
        }
1051
        else
1052
        {
1053
            /* No compression, without alpha channel.  */
1054
8684
            _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
1055
        }
1056
    }
1057
1058
    /* Current pixelmap has gone over, so the offset pointer should be reset.  */
1059
40320
    if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
1060
    {
1061
361
        info -> current_pixel_ptr = (GX_UBYTE *)info ->  pixelmap -> gx_pixelmap_data;
1062
361
        info -> current_aux_ptr = (GX_UBYTE *)info ->  pixelmap -> gx_pixelmap_aux_data;
1063
    }
1064
}
1065