GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_1555xrgb_png_draw.c Lines: 9 9 100.0 %
Date: 2024-12-05 08:52:37 Branches: 4 4 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
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_context.h"
28
#include "gx_system.h"
29
#include "gx_display.h"
30
#include "gx_image_reader.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_display_driver_1555xrgb_png_draw                PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    1555xrgb format display driver PNG drawing function.                */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    context                               Drawing context               */
49
/*    xpos                                  x-coord of top-left draw point*/
50
/*    ypos                                  y-coord of top-left draw point*/
51
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    None                                                                */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    _gx_image_reader_create                                             */
60
/*    _gx_image_reader_start                                              */
61
/*    _gx_display_driver_565rgb_pixelmap_draw                             */
62
/*    _gx_system_memory_free                                              */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*    GUIX Internal Code                                                  */
68
/*                                                                        */
69
/*  RELEASE HISTORY                                                       */
70
/*                                                                        */
71
/*    DATE              NAME                      DESCRIPTION             */
72
/*                                                                        */
73
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75
/*                                            resulting in version 6.1    */
76
/*                                                                        */
77
/**************************************************************************/
78
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
79
3
VOID _gx_display_driver_1555xrgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
80
{
81
GX_IMAGE_READER image_reader;
82
GX_PIXELMAP     pic_outmap;
83
84
3
    _gx_image_reader_create(&image_reader,
85
                            pixelmap -> gx_pixelmap_data,
86
3
                            (INT)(pixelmap -> gx_pixelmap_data_size),
87
                            GX_COLOR_FORMAT_1555XRGB, GX_IMAGE_READER_MODE_ALPHA);
88
89
3
    if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
90
    {
91
2
        _gx_display_driver_1555xrgb_pixelmap_draw(context, xpos, ypos, &pic_outmap);
92
93
2
        _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
94
95
2
        if (pic_outmap.gx_pixelmap_aux_data)
96
        {
97
1
            _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_aux_data);
98
        }
99
    }
100
3
}
101
#endif
102