GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_1bpp_pixel_write.c Lines: 11 11 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Display Management (Display)                                        */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_display.h"
28
/**************************************************************************/
29
/*                                                                        */
30
/*  FUNCTION                                               RELEASE        */
31
/*                                                                        */
32
/*    _gx_display_driver_1bpp_pixel_write                 PORTABLE C      */
33
/*                                                           6.1          */
34
/*  AUTHOR                                                                */
35
/*                                                                        */
36
/*    Kenneth Maxwell, Microsoft Corporation                              */
37
/*                                                                        */
38
/*  DESCRIPTION                                                           */
39
/*                                                                        */
40
/*    Pixel write function for the 1bpp display driver.                   */
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
/**************************************************************************/
62
118252
VOID _gx_display_driver_1bpp_pixel_write(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color)
63
{
64
118252
GX_UBYTE *put = (GX_UBYTE *)context -> gx_draw_context_memory;
65
GX_UBYTE  mask;
66
UINT      stride;
67
68
    /* Get row pitch in bytes. */
69
118252
    stride = _gx_display_driver_1bpp_row_pitch_get((USHORT)(context -> gx_draw_context_pitch));
70
71
    /* Calculate address of writing byte.  */
72
118252
    put = (GX_UBYTE *)((INT)put + y * (INT)stride);
73
118252
    put += x >> 3;
74
75
118252
    mask = (GX_UBYTE)(0x80 >> (x & 0x07));
76
77
    /* Write the pixel value.  */
78
118252
    if (color == 0x00)
79
    {
80
17790
        *put = (GX_UBYTE)(*put & (~mask));
81
    }
82
100462
    else if (color == 0x01)
83
    {
84
100461
        *put |= mask;
85
    }
86
118252
}
87