GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_4bpp_vertical_line_draw.c Lines: 25 25 100.0 %
Date: 2026-03-06 19:21:09 Branches: 12 12 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
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_display.h"
28
/**************************************************************************/
29
/*                                                                        */
30
/*  FUNCTION                                               RELEASE        */
31
/*                                                                        */
32
/*    _gx_display_driver_4bpp_vertical_line_draw          PORTABLE C      */
33
/*                                                           6.1          */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Vertical line draw function for 4bpp display driver.                */
41
/*                                                                        */
42
/*  INPUT                                                                 */
43
/*                                                                        */
44
/*    context                               Drawing context               */
45
/*    ystart                                y-coord of top endpoint       */
46
/*    yend                                  y-coord of bottom endpoint    */
47
/*    xpos                                  x-coord of left edge          */
48
/*    width                                 width of the line             */
49
/*    color                                 Color of line to write        */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    GUIX Internal Code                                                  */
62
/*                                                                        */
63
/**************************************************************************/
64
103424
VOID _gx_display_driver_4bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
65
{
66
INT       row;
67
INT       column;
68
GX_UBYTE *put;
69
GX_UBYTE *putrow;
70
GX_UBYTE  mask;
71
GX_UBYTE  pixel;
72
INT       stride;
73
74
    /* Get row pitch in bytes.  */
75
103424
    stride = (context -> gx_draw_context_pitch + 1) >> 1;
76
103424
    pixel = (GX_UBYTE)(color & 0x0f);
77
103424
    pixel |= (GX_UBYTE)(pixel << 4);
78
79
    /* pick up starting address of canvas memory */
80
103424
    putrow =  (GX_UBYTE *)context -> gx_draw_context_memory;
81
103424
    putrow += ystart * stride;
82
103424
    putrow += (xpos >> 1);
83
84
    /* draw line from top to bottom */
85
6926731
    for (row = ystart; row <= yend; row++)
86
    {
87
6823307
        put = putrow;
88
89
6823307
        if (xpos & 0x01)
90
        {
91
4097033
            mask = 0x0f;
92
        }
93
        else
94
        {
95
2726274
            mask = 0xf0;
96
        }
97
98
        /* draw line width from left to right */
99
14012118
        for (column = 0; column < width;)
100
        {
101

7188811
            if ((mask == 0xf0) && (width - column >= 2))
102
            {
103
364620
                *put++ = pixel;
104
364620
                column += 2;
105
            }
106
            else
107
            {
108
                /* Set bits first */
109
6824191
                *put &= (GX_UBYTE)(~mask);
110
6824191
                *put |= (pixel & mask);
111
6824191
                mask >>= 4;
112
113
6824191
                if (mask == 0)
114
                {
115
4097033
                    put++;
116
4097033
                    mask = 0xf0;
117
                }
118
6824191
                column++;
119
            }
120
        }
121
122
        /* advance to the next scaneline */
123
6823307
        putrow +=  stride;
124
    }
125
103424
}
126