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