GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_rotated_horizontal_line_draw.c Lines: 14 14 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
#define GX_SOURCE_CODE
21
/* Include necessary system files.  */
22
23
#include "gx_api.h"
24
#include "gx_display.h"
25
26
/**************************************************************************/
27
/*                                                                        */
28
/*  FUNCTION                                               RELEASE        */
29
/*                                                                        */
30
/*    _gx_display_driver_8bpp_rotated_horizontal_line_draw                */
31
/*                                                        PORTABLE C      */
32
/*                                                           6.1.4        */
33
/*  AUTHOR                                                                */
34
/*                                                                        */
35
/*    Kenneth Maxwell, Microsoft Corporation                              */
36
/*                                                                        */
37
/*  DESCRIPTION                                                           */
38
/*                                                                        */
39
/*    Generic 8bpp color format rotated horizontal line draw function.    */
40
/*                                                                        */
41
/*  INPUT                                                                 */
42
/*                                                                        */
43
/*    context                               Drawing context               */
44
/*    xstart                                x-coord of left endpoint      */
45
/*    xend                                  x-coord of right endpoint     */
46
/*    ypos                                  y-coord of line top           */
47
/*    width                                 Width (height) of the line    */
48
/*    color                                 Color of line to write        */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    NOne                                                                */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    GUIX Internal Code                                                  */
61
/*                                                                        */
62
/*  RELEASE HISTORY                                                       */
63
/*                                                                        */
64
/*    DATE              NAME                      DESCRIPTION             */
65
/*                                                                        */
66
/*  02-02-2021     Kenneth Maxwell          Initial Version 6.1.4         */
67
/*                                                                        */
68
/**************************************************************************/
69
175073
VOID _gx_display_driver_8bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
70
{
71
INT       row;
72
INT       column;
73
GX_UBYTE *put;
74
GX_UBYTE *rowstart;
75
175073
INT       len = xend - xstart + 1;
76
77
    /* Pick up start address of canvas memory.  */
78
175073
    rowstart = (GX_UBYTE *)context -> gx_draw_context_memory;
79
80
    /* Calculate start of row address.  */
81
175073
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
82
    {
83
89706
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xstart - 1) * context -> gx_draw_context_pitch;
84
89706
        rowstart += ypos;
85
    }
86
    else
87
    {
88
85367
        rowstart += xend * context -> gx_draw_context_pitch;
89
85367
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - width);
90
    }
91
92
    /* Draw one line, left to right.  */
93
21327126
    for (column = 0; column < len; column++)
94
    {
95
21152053
        put = rowstart;
96
97
        /* Draw pixel to fill width.  */
98
2107279264
        for (row = 0; row < width; row++)
99
        {
100
2086127211
            *put++ = (GX_UBYTE)color;
101
        }
102
21152053
        rowstart -= context -> gx_draw_context_pitch;
103
    }
104
175073
}
105