GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_32bpp_vertical_line_draw.c Lines: 16 16 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
/*                                                                        */
31
/*  FUNCTION                                               RELEASE        */
32
/*                                                                        */
33
/*    _gx_display_driver_32bpp_vertical_line_draw         PORTABLE C      */
34
/*                                                           6.1          */
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
/*                                          Basic display driver vertical */
60
/*                                            line alpha draw function    */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    GUIX Internal Code                                                  */
65
/*                                                                        */
66
/*  RELEASE HISTORY                                                       */
67
/*                                                                        */
68
/*    DATE              NAME                      DESCRIPTION             */
69
/*                                                                        */
70
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72
/*                                            resulting in version 6.1    */
73
/*                                                                        */
74
/**************************************************************************/
75
1218347
VOID _gx_display_driver_32bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
76
{
77
INT    row;
78
INT    column;
79
ULONG *put;
80
ULONG *rowstart;
81
1218347
INT    len = yend - ystart + 1;
82
#if defined GX_BRUSH_ALPHA_SUPPORT
83
GX_UBYTE alpha;
84
85
1218347
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
86
1218347
    if (alpha == 0)
87
    {
88
        /* Nothing to drawn. Just return. */
89
428
        return;
90
    }
91
1217919
    if (alpha != 0xff)
92
    {
93
61732
        _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
94
61732
        return;
95
    }
96
#endif
97
98
    /* pick up starting address of canvas memory */
99
1156187
    rowstart = (ULONG *)context -> gx_draw_context_memory;
100
101
    /* calculate start of scanline */
102
1156187
    rowstart += context -> gx_draw_context_pitch * ystart;
103
104
    /* offset into starting pixel */
105
1156187
    rowstart += xpos;
106
107
    /* draw line from top to bottom */
108
65683013
    for (row = 0; row < len; row++)
109
    {
110
64526826
        put = rowstart;
111
112
        /* draw line width from left to right */
113
144331109
        for (column = 0; column < width; column++)
114
        {
115
79804283
            *put++ = (ULONG)color;
116
        }
117
118
        /* advance to the next scaneline */
119
64526826
        rowstart += context -> gx_draw_context_pitch;
120
    }
121
}