GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_canvas_pixelmap_rotate.c Lines: 8 8 100.0 %
Date: 2024-12-05 08:52:37 Branches: 10 10 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
/**   Canvas Management (Canvas)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_canvas.h"
28
#include "gx_system.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_canvas_pixelmap_rotate                         PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function checks errors in the canvas pixelmap rotate function. */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    x_position                            Top-left x-coord to place     */
50
/*                                            pixelmap                    */
51
/*    y_position                            Top-left y-coord to place     */
52
/*                                            pixelmap                    */
53
/*    pixelmap                              Pointer to actual pixelmap    */
54
/*                                            to draw                     */
55
/*    angle                                 The angle to rotate           */
56
/*    rot_cx                                x-coord of rotating center, if*/
57
/*                                            -1 is set, default it to    */
58
/*                                            image center.               */
59
/*    rot_cy                                y-coord of rotationg center.  */
60
/*                                            -1 is set, default it to    */
61
/*                                            image center.               */
62
/*                                                                        */
63
/*  OUTPUT                                                                */
64
/*                                                                        */
65
/*    status                                Completion status             */
66
/*                                                                        */
67
/*  CALLS                                                                 */
68
/*                                                                        */
69
/*    _gx_canvas_pixelmap_draw              The actual function           */
70
/*                                                                        */
71
/*  CALLED BY                                                             */
72
/*                                                                        */
73
/*    Application code                                                    */
74
/*                                                                        */
75
/*  RELEASE HISTORY                                                       */
76
/*                                                                        */
77
/*    DATE              NAME                      DESCRIPTION             */
78
/*                                                                        */
79
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
80
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
81
/*                                            resulting in version 6.1    */
82
/*                                                                        */
83
/**************************************************************************/
84
17868
UINT  _gxe_canvas_pixelmap_rotate(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap,
85
                                  INT angle, INT rot_cx, INT rot_cy)
86
{
87
UINT status;
88
89
    /* Check for appropriate caller.  */
90

17868
    GX_INIT_AND_THREADS_CALLER_CHECKING
91
92
    /* Check error for valid pointer. */
93
17866
    if (pixelmap == GX_NULL)
94
    {
95
2
        return(GX_PTR_ERROR);
96
    }
97
98
17864
    if (_gx_system_current_draw_context == GX_NULL)
99
    {
100
1
        return GX_INVALID_CONTEXT;
101
    }
102
103
    /* Call the actual function.  */
104
17863
    status = _gx_canvas_pixelmap_rotate(x_position, y_position, pixelmap, angle, rot_cx, rot_cy);
105
106
    /* Return completion status.  */
107
17863
    return(status);
108
}
109