GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_32bpp_horizontal_pattern_line_draw.c Lines: 19 19 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
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_32bpp_horizontal_pattern_line_draw               */
32
/*                                                        PORTABLE C      */
33
/*                                                           6.1          */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Generic 32bpp color format horizontal pattern line draw function.   */
41
/*                                                                        */
42
/*  INPUT                                                                 */
43
/*                                                                        */
44
/*    context                               Drawing context               */
45
/*    xstart                                x-coord of left endpoint      */
46
/*    xend                                  x-coord of right endpoint     */
47
/*    ypos                                  y-coord of line top           */
48
/*                                                                        */
49
/*  OUTPUT                                                                */
50
/*                                                                        */
51
/*    None                                                                */
52
/*                                                                        */
53
/*  CALLS                                                                 */
54
/*                                                                        */
55
/*    None                                                                */
56
/*                                                                        */
57
/*  CALLED BY                                                             */
58
/*                                                                        */
59
/*    GUIX Internal Code                                                  */
60
/*                                                                        */
61
/*  RELEASE HISTORY                                                       */
62
/*                                                                        */
63
/*    DATE              NAME                      DESCRIPTION             */
64
/*                                                                        */
65
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
66
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
67
/*                                            resulting in version 6.1    */
68
/*                                                                        */
69
/**************************************************************************/
70
989
VOID _gx_display_driver_32bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos)
71
{
72
INT    column;
73
ULONG *put;
74
ULONG *rowstart;
75
ULONG  pattern;
76
ULONG  mask;
77
ULONG  on_color;
78
ULONG  off_color;
79
80
989
INT    len = xend - xstart + 1;
81
82
    /* pick up start address of canvas memory */
83
989
    rowstart = (ULONG *)context -> gx_draw_context_memory;
84
85
    /* calculate start of row address */
86
989
    rowstart +=  context -> gx_draw_context_pitch * ypos;
87
88
    /* calculate pixel address */
89
989
    rowstart +=  xstart;
90
    /* draw 1-pixel hi lines to fill width */
91
92
    /* pick up the requested pattern and mask */
93
989
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
94
989
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
95
989
    on_color = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color;
96
989
    off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color;
97
98
989
    put = rowstart;
99
100
    /* draw one line, left to right */
101
9543
    for (column = 0; column < len; column++)
102
    {
103
8554
        if (pattern & mask)
104
        {
105
4277
            *put++ = on_color;
106
        }
107
        else
108
        {
109
4277
            *put++ = off_color;
110
        }
111
8554
        mask >>= 1;
112
8554
        if (!mask)
113
        {
114
10
            mask = 0x80000000;
115
        }
116
    }
117
118
    /* save current masks value back to brush */
119
989
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
120
989
}
121