GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_1bpp_vertical_line_draw.c Lines: 19 19 100.0 %
Date: 2026-03-06 19:21:09 Branches: 10 10 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_1bpp_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 1bpp 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
96382
VOID _gx_display_driver_1bpp_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
INT       stride;
72
73
    /* Get row pitch in bytes.  */
74
96382
    stride = (context -> gx_draw_context_pitch + 7) >> 3;
75
76
    /* pick up starting address of canvas memory */
77
96382
    putrow =  (GX_UBYTE *)context -> gx_draw_context_memory;
78
96382
    putrow += ystart * stride;
79
96382
    putrow += (xpos >> 3);
80
81
    /* draw line from top to bottom */
82
6192804
    for (row = ystart; row <= yend; row++)
83
    {
84
6096422
        put = putrow;
85
86
6096422
        mask = (GX_UBYTE)(0x80 >> (xpos & 0x07));
87
88
        /* draw line width from left to right */
89
14168596
        for (column = 0; column < width; column++)
90
        {
91
8072174
            if (color == 0x00)
92
            {
93
3254415
                *put = (GX_UBYTE)((*put) & (~mask));
94
            }
95
4817759
            else if ((color == 0x01))
96
            {
97
4817318
                *put |= mask;
98
            }
99
100
8072174
            mask >>= 1;
101
102
8072174
            if (!mask)
103
            {
104
1838009
                put++;
105
1838009
                mask = 0x80;
106
            }
107
        }
108
109
        /* advance to the next scaneline */
110
6096422
        putrow +=  stride;
111
    }
112
96382
}
113