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