GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_rotated_pixel_write.c Lines: 9 9 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 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_8bpp_rotated_pixel_write         PORTABLE C      */
33
/*                                                           6.1.4        */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Generic 8bpp color format rotated pixel write function.             */
41
/*                                                                        */
42
/*  INPUT                                                                 */
43
/*                                                                        */
44
/*    context                               Drawing context               */
45
/*    x                                     X coordinate                  */
46
/*    y                                     Y coordinate                  */
47
/*    color                                 Color of pixel to write       */
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
/*  02-02-2021     Kenneth Maxwell          Initial Version 6.1.4         */
66
/*                                                                        */
67
/**************************************************************************/
68
319020
VOID _gx_display_driver_8bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color)
69
{
70
319020
GX_UBYTE *put = (GX_UBYTE *)context -> gx_draw_context_memory;
71
72
    /* Calculate address of scan line.  */
73
319020
    if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
74
    {
75
163117
        put += context -> gx_draw_context_pitch * (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - x - 1);
76
77
        /* Step in by y coordinate.  */
78
163117
        put += y;
79
    }
80
    else
81
    {
82
155903
        put += context -> gx_draw_context_pitch * x;
83
84
        /* Step in by y coordinate.  */
85
155903
        put += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - y - 1);
86
    }
87
88
    /* write the pixel value */
89
319020
    *put = (GX_UBYTE)color;
90
319020
}
91