GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_vertical_line_draw.c Lines: 18 18 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
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_display.h"
27
28
/**************************************************************************/
29
/*                                                                        */
30
/*  FUNCTION                                               RELEASE        */
31
/*                                                                        */
32
/*    _gx_display_driver_8bpp_vertical_line_draw          PORTABLE C      */
33
/*                                                           6.1          */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Generic 8bpp color format vertical line draw function.              */
41
/*                                                                        */
42
/*  INPUT                                                                 */
43
/*                                                                        */
44
/*    context                               Drawing context               */
45
/*    ystart                                y-coord of top endpoint       */
46
/*    yend                                  y-coord of bottom endpoint    */
47
/*    xpos                                  x-coord of left edge          */
48
/*    width                                 width of the line             */
49
/*    color                                 Color of line to draw         */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_display_driver_vertical_line_alpha_draw                         */
58
/*                                          Basic display driver vertical */
59
/*                                            alpha line draw function    */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/**************************************************************************/
66
528681
VOID _gx_display_driver_8bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
67
{
68
INT       row;
69
INT       column;
70
GX_UBYTE *put;
71
GX_UBYTE *rowstart;
72
528681
INT       len = yend - ystart + 1;
73
#if defined GX_BRUSH_ALPHA_SUPPORT
74
GX_UBYTE alpha;
75
76
528681
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
77
528681
    if (alpha == 0)
78
    {
79
        /* Nothing to drawn. Just return. */
80
1282
        return;
81
    }
82
527399
    if (alpha != 0xff)
83
    {
84
1340
        if (context -> gx_draw_context_display -> gx_display_color_format != GX_COLOR_FORMAT_8BIT_PACKED_PIXEL)
85
        {
86
            /* Alpha blend is not supported for palette driver. */
87
5
            return;
88
        }
89
90
1335
        _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
91
1335
        return;
92
    }
93
#endif
94
95
    /* pick up starting address of canvas memory */
96
526059
    rowstart = (GX_UBYTE *)context -> gx_draw_context_memory;
97
98
    /* calculate start of scanline */
99
526059
    rowstart += context -> gx_draw_context_pitch * ystart;
100
101
    /* offset into starting pixel */
102
526059
    rowstart += xpos;
103
104
    /* draw line from top to bottom */
105
22341707
    for (row = 0; row < len; row++)
106
    {
107
21815648
        put = rowstart;
108
109
        /* draw line width from left to right */
110
48142953
        for (column = 0; column < width; column++)
111
        {
112
26327305
            *put++ = (GX_UBYTE)color;
113
        }
114
115
        /* advance to the next scaneline */
116
21815648
        rowstart += context -> gx_draw_context_pitch;
117
    }
118
}