GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_16bpp_vertical_line_draw.c Lines: 15 15 100.0 %
Date: 2024-12-05 08:52:37 Branches: 8 8 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 *
4
 * This program and the accompanying materials are made available under the
5
 * terms of the MIT License which is available at
6
 * https://opensource.org/licenses/MIT.
7
 *
8
 * SPDX-License-Identifier: MIT
9
 **************************************************************************/
10
11
12
/**************************************************************************/
13
/**************************************************************************/
14
/**                                                                       */
15
/** GUIX Component                                                        */
16
/**                                                                       */
17
/**   Display Management (Display)                                        */
18
/**                                                                       */
19
/**************************************************************************/
20
#define GX_SOURCE_CODE
21
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_16bpp_vertical_line_draw         PORTABLE C      */
33
/*                                                           6.3.0        */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Generic vertical line draw function for 16bpp canvas.               */
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 write        */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_display_driver_vertical_line_alpha_draw                         */
58
/*                                          Display driver basic vertical */
59
/*                                            line alpha draw function    */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/*  RELEASE HISTORY                                                       */
66
/*                                                                        */
67
/*    DATE              NAME                      DESCRIPTION             */
68
/*                                                                        */
69
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71
/*                                            resulting in version 6.1    */
72
/*  10-31-2023     Ting Zhu                 Modified comment(s),          */
73
/*                                            added partial canvas buffer */
74
/*                                            support,                    */
75
/*                                            resulting in version 6.3.0  */
76
/*                                                                        */
77
/**************************************************************************/
78
833038
VOID _gx_display_driver_16bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
79
{
80
INT     row;
81
INT     column;
82
USHORT *put;
83
USHORT *rowstart;
84
833038
INT     len = yend - ystart + 1;
85
#if defined GX_BRUSH_ALPHA_SUPPORT
86
GX_UBYTE alpha;
87
88
833038
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
89
833038
    if (alpha == 0)
90
    {
91
        /* Nothing to drawn. Just return. */
92
236
        return;
93
    }
94
832802
    if (alpha != 0xff)
95
    {
96
57444
        _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
97
57444
        return;
98
    }
99
#endif
100
101
    /* pick up starting address of canvas memory */
102
775358
    rowstart = (USHORT *)context -> gx_draw_context_memory;
103
104
775358
    GX_CALCULATE_PUTROW(rowstart, xpos, ystart, context);
105
106
    /* draw line from top to bottom */
107
44851719
    for (row = 0; row < len; row++)
108
    {
109
44076361
        put = rowstart;
110
111
        /* draw line width from left to right */
112
91327742
        for (column = 0; column < width; column++)
113
        {
114
47251381
            *put++ = (USHORT)color;
115
        }
116
117
        /* advance to the next scaneline */
118
44076361
        rowstart += context -> gx_draw_context_pitch;
119
    }
120
}
121