GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_vertical_pattern_line_draw.c Lines: 20 20 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_display_driver_8bpp_ertical_pattern_line_draw   PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    Generic 8bpp color format vertical line draw function.              */
43
/*                                                                        */
44
/*  INPUT                                                                 */
45
/*                                                                        */
46
/*    context                               Drawing context               */
47
/*    ystart                                y-coord of top endpoint       */
48
/*    yend                                  y-coord of bottom endpoint    */
49
/*    xpos                                  x-coord of left edge          */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    GUIX Internal Code                                                  */
62
/*                                                                        */
63
/**************************************************************************/
64
18
VOID _gx_display_driver_8bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
65
{
66
INT       row;
67
GX_UBYTE *put;
68
GX_UBYTE *rowstart;
69
ULONG     pattern;
70
ULONG     mask;
71
GX_UBYTE  on_color;
72
GX_UBYTE  off_color;
73
74
18
INT       len = yend - ystart + 1;
75
76
    /* pick up starting address of canvas memory */
77
18
    rowstart =  (GX_UBYTE *)context -> gx_draw_context_memory;
78
79
    /* calculate start of scanline */
80
18
    rowstart += context -> gx_draw_context_pitch * ystart;
81
82
    /* offset into starting pixel */
83
18
    rowstart += xpos;
84
85
    /* pick up the requested pattern and mask */
86
18
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
87
18
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
88
18
    on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color;
89
18
    off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color;
90
91
    /* draw line from top to bottom */
92
2924
    for (row = 0; row < len; row++)
93
    {
94
2906
        put = rowstart;
95
96
2906
        if (pattern & mask)
97
        {
98
1440
            *put = on_color;
99
        }
100
        else
101
        {
102
1466
            *put = off_color;
103
        }
104
105
2906
        mask >>= 1;
106
2906
        if (!mask)
107
        {
108
102
            mask = 0x80000000;
109
        }
110
111
        /* advance to the next scaneline */
112
2906
        rowstart +=  context -> gx_draw_context_pitch;
113
    }
114
    /* save current masks value back to brush */
115
18
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
116
18
}
117