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 |
|
|
/** Utility (Utility) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
|
31 |
|
|
GX_CALLER_CHECKING_EXTERNS |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gxe_utility_pixelmap_resize PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function checks for errors in the utility pixelmap resize */ |
46 |
|
|
/* function call. */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* src The source pixelmap */ |
51 |
|
|
/* destination The resized pixelmap to be */ |
52 |
|
|
/* returned */ |
53 |
|
|
/* width New width */ |
54 |
|
|
/* height New height */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* None */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* _gx_utility_pixelmap_resize Actual utility pixelmap */ |
63 |
|
|
/* resize function */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
3531 |
UINT _gxe_utility_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height) |
71 |
|
|
{ |
72 |
|
|
UINT status; |
73 |
|
|
|
74 |
|
|
/* Check for invalid input pointers. */ |
75 |
✓✓✓✓
|
3531 |
if ((src == GX_NULL) || (destination == GX_NULL)) |
76 |
|
|
{ |
77 |
|
2 |
return GX_PTR_ERROR; |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
/* Check for valid value. */ |
81 |
✓✓✓✓
|
3529 |
if ((width <= 0) && (height <= 0)) |
82 |
|
|
{ |
83 |
|
1 |
return GX_INVALID_VALUE; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
/* Check for pixelmap flags. */ |
87 |
✓✓ |
3528 |
if (src -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
88 |
|
|
{ |
89 |
|
2 |
return GX_NOT_SUPPORTED; |
90 |
|
|
} |
91 |
|
|
|
92 |
✓✓✓✓
|
3526 |
if (!_gx_system_memory_allocator || !_gx_system_memory_free) |
93 |
|
|
{ |
94 |
|
2 |
return GX_SYSTEM_MEMORY_ERROR; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* Call the actual utility pixelmap resize function. */ |
98 |
|
3524 |
status = _gx_utility_pixelmap_resize(src, destination, width, height); |
99 |
|
|
|
100 |
|
3524 |
return status; |
101 |
|
|
} |
102 |
|
|
|