GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_generic_polygon_draw.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 12 12 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
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_display.h"
29
#include "gx_canvas.h"
30
#include "gx_context.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_display_driver_generic_polygon_draw             PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    Generic polygon draw function.                                      */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    context                               Drawing context               */
49
/*    vertex                                Array of vertexes             */
50
/*    num                                   Number of vertexes            */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_canvas_line_draw                  Draw a line into canvas       */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    GUIX Internal Code                                                  */
63
/*                                                                        */
64
/**************************************************************************/
65
1418
VOID _gx_display_driver_generic_polygon_draw(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num)
66
{
67
INT index;
68
1418
INT brush_width = context -> gx_draw_context_brush.gx_brush_width;
69
#if defined (GX_BRUSH_ALPHA_SUPPORT)
70
GX_UBYTE     temp_alpha;
71
UINT         brush_style;
72
1418
    temp_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
73
1418
    brush_style = context -> gx_draw_context_brush.gx_brush_style;
74
1418
    if (brush_width > 1)
75
    {
76
1058
        if (temp_alpha != 0xff)
77
        {
78

502
            if ((brush_style & GX_BRUSH_ROUND) || (brush_style & GX_BRUSH_ALIAS))
79
            {
80
402
                context -> gx_draw_context_brush.gx_brush_alpha = GX_ALPHA_VALUE_OPAQUE;
81
            }
82
        }
83
    }
84
#endif
85
86
1418
    if (brush_width > 0)
87
    {
88
        /*round end*/
89
8605
        for (index = 0; index < num; index++)
90
        {
91
7430
            _gx_canvas_line_draw(vertex[index].gx_point_x, vertex[index].gx_point_y,
92
7430
                                 vertex[(index + 1) % num].gx_point_x, vertex[(index + 1) % num].gx_point_y);
93
        }
94
    }
95
#if defined (GX_BRUSH_ALPHA_SUPPORT)
96
1418
    context -> gx_draw_context_brush.gx_brush_alpha = temp_alpha;
97
#endif
98
1418
}
99