GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_32bpp_rotated_vertical_pattern_line_draw.c Lines: 23 23 100.0 %
Date: 2024-12-05 08:52:37 Branches: 8 8 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_32bpp_rotated_vertical_pattern_line_draw         */
33
/*                                                                        */
34
/*                                                        PORTABLE C      */
35
/*                                                           6.1.4        */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    Generic rotated 32bpp color format vertical pattern line draw       */
43
/*    function.                                                           */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    context                               Drawing context               */
48
/*    ystart                                y-coord of top endpoint       */
49
/*    yend                                  y-coord of bottom endpoint    */
50
/*    xpos                                  x-coord of left edge          */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    GUIX Internal Code                                                  */
63
/*                                                                        */
64
/*  RELEASE HISTORY                                                       */
65
/*                                                                        */
66
/*    DATE              NAME                      DESCRIPTION             */
67
/*                                                                        */
68
/*  02-02-2021     Kenneth Maxwell          Initial Version 6.1.4         */
69
/*                                                                        */
70
/**************************************************************************/
71
3230
VOID _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
72
{
73
INT    row;
74
ULONG *put;
75
ULONG *rowstart;
76
ULONG  pattern;
77
ULONG  mask;
78
ULONG  on_color;
79
ULONG  off_color;
80
3230
INT    len = yend - ystart + 1;
81
82
    /* Pick up starting address of canvas memory.  */
83
3230
    rowstart =  (ULONG *)context -> gx_draw_context_memory;
84
85
3230
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
86
    {
87
        /* Calculate start of scanline.  */
88
2140
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
89
90
        /* Offset into starting pixel.  */
91
2140
        rowstart += ystart;
92
    }
93
    else
94
    {
95
        /* Calculate start of scanline.  */
96
1090
        rowstart += xpos * context -> gx_draw_context_pitch;
97
98
        /* Offset into starting pixel.  */
99
1090
        rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
100
    }
101
102
    /* Pick up the requested pattern and mask.  */
103
3230
    pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
104
3230
    mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
105
3230
    on_color = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color;
106
3230
    off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color;
107
108
3230
    put = rowstart;
109
110
    /* Draw line from top to bottom.  */
111
978700
    for (row = 0; row < len; row++)
112
    {
113
975470
        if (pattern & mask)
114
        {
115
636979
            *put = on_color;
116
        }
117
        else
118
        {
119
338491
            *put = off_color;
120
        }
121
122
975470
        mask >>= 1;
123
975470
        if (!mask)
124
        {
125
28322
            mask = 0x80000000;
126
        }
127
128
        /* Advance to the next scaneline.  */
129
975470
        put++;
130
    }
131
    /* Save current masks value back to brush.  */
132
3230
    context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
133
3230
}
134