GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_animation_canvas_define.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 8 8 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
/**   Animation Management (Animation)                                    */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_widget.h"
29
#include "gx_utility.h"
30
#include "gx_window.h"
31
#include "gx_canvas.h"
32
#include "gx_animation.h"
33
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gxe_animation_canvas_define                        PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This function checks error in animation canvas define function.     */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    animation                             Animation control block       */
52
/*    canvas                                Pointer to animation canvas   */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_animation_canvas_define           The actual animation canvas   */
61
/*                                            define function             */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*                                                                        */
67
/**************************************************************************/
68
#if (GX_ANIMATION_POOL_SIZE > 0)
69
13
UINT  _gxe_animation_canvas_define(GX_ANIMATION *animation, GX_CANVAS *canvas)
70
{
71
13
UINT  status = GX_SUCCESS;
72
GX_DISPLAY *display;
73
ULONG required_size;
74
75

13
    if (animation == GX_NULL ||
76
        canvas == GX_NULL)
77
    {
78
3
        return GX_PTR_ERROR;
79
    }
80
81
10
    display = canvas -> gx_canvas_display;
82
10
    if (display == GX_NULL)
83
    {
84
1
        return GX_PTR_ERROR;
85
    }
86
87
9
    required_size = (ULONG)(display -> gx_display_driver_row_pitch_get((USHORT) canvas->gx_canvas_x_resolution));
88
9
    required_size = required_size * (ULONG) canvas->gx_canvas_y_resolution;
89
90
9
    if (canvas ->gx_canvas_memory_size < required_size)
91
    {
92
1
        return GX_INVALID_MEMORY_SIZE;
93
    }
94
95
8
    status = _gx_animation_canvas_define(animation, canvas);
96
97
    /* Return completion status code. */
98
8
    return(status);
99
}
100
#endif