GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_16bpp_rotated_vertical_line_draw.c Lines: 19 19 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
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_rotated_vertical_line_draw PORTABLE C      */
33
/*                                                           6.1.3        */
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
/*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
70
/*                                                                        */
71
/**************************************************************************/
72
392558
VOID _gx_display_driver_16bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
73
{
74
INT     row;
75
INT     column;
76
USHORT *put;
77
USHORT *rowstart;
78
392558
INT     len = yend - ystart + 1;
79
80
#if defined GX_BRUSH_ALPHA_SUPPORT
81
GX_UBYTE alpha;
82
83
392558
    alpha = context -> gx_draw_context_brush.gx_brush_alpha;
84
392558
    if (alpha == 0)
85
    {
86
        /* Nothing to drawn. Just return. */
87
8102
        return;
88
    }
89
384456
    if (alpha != 0xff)
90
    {
91
8102
        _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
92
8102
        return;
93
    }
94
#endif
95
96
    /* pick up starting address of canvas memory */
97
376354
    rowstart = (USHORT *)context -> gx_draw_context_memory;
98
99
376354
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
100
    {
101
        /* calculate start of scanline */
102
204851
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
103
104
        /* offset into starting pixel */
105
204851
        rowstart += ystart;
106
    }
107
    else
108
    {
109
171503
        rowstart += (xpos + width - 1) * context -> gx_draw_context_pitch;
110
171503
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
111
    }
112
113
    /* draw line width from left to right */
114
761803
    for (column = 0; column < width; column++)
115
    {
116
385449
        put = rowstart;
117
        /* draw line from top to bottom */
118
19863392
        for (row = 0; row < len; row++)
119
        {
120
19477943
            *put++ = (USHORT)color;
121
        }
122
123
        /* advance to the right */
124
385449
        rowstart -= context -> gx_draw_context_pitch;
125
    }
126
}
127