GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_16bpp_horizontal_pattern_line_draw.c Lines: 18 18 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_16bpp_horizontal_pattern_line_draw               */
36
/*                                                        PORTABLE C      */
37
/*                                                           6.3.0        */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    Generic 16bpp 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
2527
VOID _gx_display_driver_16bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos)
67
{
68
INT     column;
69
USHORT *put;
70
USHORT *rowstart;
71
ULONG   pattern;
72
ULONG   mask;
73
USHORT  on_color;
74
USHORT  off_color;
75
76
2527
INT     len = xend - xstart + 1;
77
78
    /* pick up start address of canvas memory */
79
2527
    rowstart = (USHORT *)context -> gx_draw_context_memory;
80
81
2527
    GX_CALCULATE_PUTROW(rowstart, xstart, ypos, context);
82
83
    /* draw 1-pixel hi lines to fill width */
84
85
    /* pick up the requested pattern and mask */
86
2527
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
87
2527
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
88
2527
    on_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color;
89
2527
    off_color = (USHORT)context -> gx_draw_context_brush.gx_brush_fill_color;
90
91
2527
    put = rowstart;
92
93
    /* draw one line, left to right */
94
471493
    for (column = 0; column < len; column++)
95
    {
96
468966
        if (pattern & mask)
97
        {
98
237109
            *put++ = on_color;
99
        }
100
        else
101
        {
102
231857
            *put++ = off_color;
103
        }
104
468966
        mask >>= 1;
105
468966
        if (!mask)
106
        {
107
13533
            mask = 0x80000000;
108
        }
109
    }
110
111
    /* save current masks value back to brush */
112
2527
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
113
2527
}
114