GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_32bpp_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
#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_32bpp_vertical_pattern_line_draw                 */
34
/*                                                        PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    Generic 32bpp 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
844
VOID _gx_display_driver_32bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
65
{
66
INT    row;
67
ULONG *put;
68
ULONG *rowstart;
69
ULONG  pattern;
70
ULONG  mask;
71
ULONG  on_color;
72
ULONG  off_color;
73
74
844
INT    len = yend - ystart + 1;
75
76
    /* pick up starting address of canvas memory */
77
844
    rowstart =  (ULONG *)context -> gx_draw_context_memory;
78
79
    /* calculate start of scanline */
80
844
    rowstart += context -> gx_draw_context_pitch * ystart;
81
82
    /* offset into starting pixel */
83
844
    rowstart += xpos;
84
85
    /* pick up the requested pattern and mask */
86
844
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
87
844
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
88
844
    on_color = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color;
89
844
    off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color;
90
91
    /* draw line from top to bottom */
92
20028
    for (row = 0; row < len; row++)
93
    {
94
19184
        put = rowstart;
95
96
19184
        if (pattern & mask)
97
        {
98
9539
            *put = on_color;
99
        }
100
        else
101
        {
102
9645
            *put = off_color;
103
        }
104
105
19184
        mask >>= 1;
106
19184
        if (!mask)
107
        {
108
552
            mask = 0x80000000;
109
        }
110
111
        /* advance to the next scaneline */
112
19184
        rowstart +=  context -> gx_draw_context_pitch;
113
    }
114
    /* save current masks value back to brush */
115
844
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
116
844
}
117