GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_utility_pixelmap_resize.c Lines: 11 11 100.0 %
Date: 2024-12-05 08:52:37 Branches: 14 14 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
/**   Utility (Utility)                                                   */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_system.h"
28
#include "gx_utility.h"
29
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_utility_pixelmap_resize                        PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function checks for errors in the utility pixelmap resize      */
45
/*    function call.                                                      */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    src                                   The source pixelmap           */
50
/*    destination                           The resized pixelmap to be    */
51
/*                                            returned                    */
52
/*    width                                 New width                     */
53
/*    height                                New height                    */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _gx_utility_pixelmap_resize           Actual utility pixelmap       */
62
/*                                            resize function             */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*                                                                        */
76
/**************************************************************************/
77
3528
UINT _gxe_utility_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height)
78
{
79
UINT status;
80
81
    /* Check for invalid input pointers.  */
82

3528
    if ((src == GX_NULL) || (destination == GX_NULL))
83
    {
84
2
        return GX_PTR_ERROR;
85
    }
86
87
    /* Check for valid value.  */
88

3526
    if ((width <= 0) && (height <= 0))
89
    {
90
1
        return GX_INVALID_VALUE;
91
    }
92
93
    /* Check for pixelmap flags.  */
94
3525
    if (src -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
95
    {
96
2
        return GX_NOT_SUPPORTED;
97
    }
98
99

3523
    if (!_gx_system_memory_allocator || !_gx_system_memory_free)
100
    {
101
2
        return GX_SYSTEM_MEMORY_ERROR;
102
    }
103
104
    /* Call the actual utility pixelmap resize function.  */
105
3521
    status = _gx_utility_pixelmap_resize(src, destination, width, height);
106
107
3521
    return status;
108
}
109