GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_16bpp_vertical_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
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_display.h"
28
29
/**************************************************************************/
30
/*                                                                        */
31
/*  FUNCTION                                               RELEASE        */
32
/*                                                                        */
33
/*    _gx_display_driver_16bpp_vertical_pattern_line_draw                 */
34
/*                                                        PORTABLE C      */
35
/*                                                           6.3.0        */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    Generic 16bpp color format vertical pattern 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
2634
VOID _gx_display_driver_16bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
65
{
66
INT     row;
67
USHORT *put;
68
USHORT *rowstart;
69
ULONG   pattern;
70
ULONG   mask;
71
USHORT  on_color;
72
USHORT  off_color;
73
74
2634
INT     len = yend - ystart + 1;
75
76
    /* pick up starting address of canvas memory */
77
2634
    rowstart =  (USHORT *)context -> gx_draw_context_memory;
78
79
2634
    GX_CALCULATE_PUTROW(rowstart, xpos, ystart, context);
80
81
    /* pick up the requested pattern and mask */
82
2634
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
83
2634
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
84
2634
    on_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color;
85
2634
    off_color = (USHORT)context -> gx_draw_context_brush.gx_brush_fill_color;
86
87
    /* draw line from top to bottom */
88
563498
    for (row = 0; row < len; row++)
89
    {
90
560864
        put = rowstart;
91
92
560864
        if (pattern & mask)
93
        {
94
367251
            *put = on_color;
95
        }
96
        else
97
        {
98
193613
            *put = off_color;
99
        }
100
101
560864
        mask >>= 1;
102
560864
        if (!mask)
103
        {
104
16765
            mask = 0x80000000;
105
        }
106
107
        /* advance to the next scaneline */
108
560864
        rowstart +=  context -> gx_draw_context_pitch;
109
    }
110
    /* save current masks value back to brush */
111
2634
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
112
2634
}
113