GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_horizontal_line_alpha_draw.c Lines: 8 8 100.0 %
Date: 2024-12-05 08:52:37 Branches: 6 6 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
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
#if defined(GX_BRUSH_ALPHA_SUPPORT)
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_display_driver_horizontal_line_alpha_draw         PORTABLE C    */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    Internal helper function that draws an alpha blended horizontal     */
44
/*    line.                                                               */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    context                               Drawing context               */
49
/*    xstart                                x-coord of left endpoint      */
50
/*    xend                                  x-coord of right endpoint     */
51
/*    ypos                                  y-coord of line top           */
52
/*    width                                 Width (height) of the line    */
53
/*    color                                 Color of line to write        */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    NOne                                                                */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
62
/*                                            blend function              */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    _gx_display_driver_8bpp_horizontal_line_draw                        */
67
/*    _gx_display_driver_16bpp_horizontal_line_draw                       */
68
/*    _gx_display_driver_32bpp_horizontal_line_draw                       */
69
/*                                                                        */
70
/*  RELEASE HISTORY                                                       */
71
/*                                                                        */
72
/*    DATE              NAME                      DESCRIPTION             */
73
/*                                                                        */
74
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76
/*                                            resulting in version 6.1    */
77
/*                                                                        */
78
/**************************************************************************/
79
328222
VOID _gx_display_driver_horizontal_line_alpha_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color, GX_UBYTE alpha)
80
{
81
INT    xval;
82
INT    yval;
83
INT    yend;
84
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
85
86
328222
    blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend;
87
88
328222
    if (blend_func == GX_NULL)
89
    {
90
116
        return;
91
    }
92
328106
    yend = ypos + width;
93
94
    /* draw 1-pixel hi lines to fill width */
95
3531451
    for (yval = ypos; yval < yend; yval++)
96
    {
97
        /* draw one line, left to right */
98
572820349
        for (xval = xstart; xval <= xend; xval++)
99
        {
100
569617004
            blend_func(context, xval, yval, color, alpha);
101
        }
102
    }
103
}
104
105
#endif /* GX_BRUSH_ALPHA_SUPPORT */
106