GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_16bpp_rotated_vertical_line_draw.c Lines: 19 19 100.0 %
Date: 2026-03-06 19:21:09 Branches: 10 10 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_rotated_vertical_line_draw PORTABLE C      */
34
/*                                                           6.1.3        */
35
/*  AUTHOR                                                                */
36
/*                                                                        */
37
/*    Kenneth Maxwell, Microsoft Corporation                              */
38
/*                                                                        */
39
/*  DESCRIPTION                                                           */
40
/*                                                                        */
41
/*    Generic vertical line draw function for 16bpp canvas.               */
42
/*                                                                        */
43
/*  INPUT                                                                 */
44
/*                                                                        */
45
/*    context                               Drawing context               */
46
/*    ystart                                y-coord of top endpoint       */
47
/*    yend                                  y-coord of bottom endpoint    */
48
/*    xpos                                  x-coord of left edge          */
49
/*    width                                 width of the line             */
50
/*    color                                 Color of line to write        */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_display_driver_vertical_line_alpha_draw                         */
59
/*                                          Display driver basic vertical */
60
/*                                            line alpha draw function    */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    GUIX Internal Code                                                  */
65
/*                                                                        */
66
/**************************************************************************/
67
392558
VOID _gx_display_driver_16bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
68
{
69
INT     row;
70
INT     column;
71
USHORT *put;
72
USHORT *rowstart;
73
392558
INT     len = yend - ystart + 1;
74
75
#if defined GX_BRUSH_ALPHA_SUPPORT
76
GX_UBYTE alpha;
77
78
392558
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
79
392558
    if (alpha == 0)
80
    {
81
        /* Nothing to drawn. Just return. */
82
8102
        return;
83
    }
84
384456
    if (alpha != 0xff)
85
    {
86
8102
        _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
87
8102
        return;
88
    }
89
#endif
90
91
    /* pick up starting address of canvas memory */
92
376354
    rowstart = (USHORT *)context -> gx_draw_context_memory;
93
94
376354
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
95
    {
96
        /* calculate start of scanline */
97
204851
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
98
99
        /* offset into starting pixel */
100
204851
        rowstart += ystart;
101
    }
102
    else
103
    {
104
171503
        rowstart += (xpos + width - 1) * context -> gx_draw_context_pitch;
105
171503
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
106
    }
107
108
    /* draw line width from left to right */
109
761803
    for (column = 0; column < width; column++)
110
    {
111
385449
        put = rowstart;
112
        /* draw line from top to bottom */
113
19863392
        for (row = 0; row < len; row++)
114
        {
115
19477943
            *put++ = (USHORT)color;
116
        }
117
118
        /* advance to the right */
119
385449
        rowstart -= context -> gx_draw_context_pitch;
120
    }
121
}
122