GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_565rgb_rotated_png_draw.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_context.h"
29
#include "gx_system.h"
30
#include "gx_display.h"
31
#include "gx_image_reader.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_display_driver_565rgb_rotated_png_draw          PORTABLE C      */
38
/*                                                           6.1.3        */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    565rgb format display driver PNG drawing function.                  */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    context                               Drawing context               */
50
/*    xpos                                  x-coord of top-left draw point*/
51
/*    ypos                                  y-coord of top-left draw point*/
52
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_image_reader_create                                             */
61
/*    _gx_image_reader_start                                              */
62
/*    _gx_display_driver_565rgb_rotated_pixelmap_draw                     */
63
/*    _gx_system_memory_free                                              */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
68
/*    GUIX Internal Code                                                  */
69
/*                                                                        */
70
/**************************************************************************/
71
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
72
72
VOID _gx_display_driver_565rgb_rotated_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
73
{
74
GX_IMAGE_READER image_reader;
75
GX_PIXELMAP     pic_outmap;
76
72
GX_UBYTE mode = GX_IMAGE_READER_MODE_ALPHA;
77
78
72
    if (context->gx_draw_context_display->gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
79
    {
80
52
        mode |= GX_IMAGE_READER_MODE_ROTATE_CW;
81
    }
82
    else
83
    {
84
20
        mode |= GX_IMAGE_READER_MODE_ROTATE_CCW;
85
    }
86
87
72
    _gx_image_reader_create(&image_reader,
88
                            pixelmap -> gx_pixelmap_data,
89
72
                            (INT)(pixelmap -> gx_pixelmap_data_size),
90
                            GX_COLOR_FORMAT_565RGB, mode);
91
92
72
    if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
93
    {
94
65
        _gx_display_driver_565rgb_rotated_pixelmap_draw(context, xpos, ypos, &pic_outmap);
95
96
65
        _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
97
98
65
        if (pic_outmap.gx_pixelmap_aux_data)
99
        {
100
46
            _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_aux_data);
101
        }
102
    }
103
72
}
104
#endif
105