1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Display Management (Display)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_context.h"
29 #include "gx_system.h"
30 #include "gx_display.h"
31 #include "gx_image_reader.h"
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_display_driver_24xrgb_rotated_png_draw          PORTABLE C      */
38 /*                                                           6.1.4        */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    Rotated 24xrgb format screen driver PNG drawing function.           */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    context                               Drawing context               */
50 /*    xpos                                  x-coord of top-left draw point*/
51 /*    ypos                                  y-coord of top-left draw point*/
52 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    None                                                                */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _gx_image_reader_create                                             */
61 /*    _gx_image_reader_start                                              */
62 /*    _gx_display_driver_24xrgb_rotated_pixelmap_draw                     */
63 /*    _gx_system_memory_free                                              */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*    GUIX Internal Code                                                  */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  02-02-2021     Kenneth Maxwell          Initial Version 6.1.4         */
75 /*                                                                        */
76 /**************************************************************************/
77 #if defined(GX_SOFTWARE_DECODER_SUPPORT)
_gx_display_driver_24xrgb_rotated_png_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap)78 VOID _gx_display_driver_24xrgb_rotated_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
79 {
80 GX_IMAGE_READER image_reader;
81 GX_PIXELMAP     pic_outmap;
82 
83 GX_UBYTE        mode = GX_IMAGE_READER_MODE_ALPHA;
84 
85     if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
86     {
87         mode |= GX_IMAGE_READER_MODE_ROTATE_CW;
88     }
89     else
90     {
91         mode |= GX_IMAGE_READER_MODE_ROTATE_CCW;
92     }
93 
94     _gx_image_reader_create(&image_reader,
95                             pixelmap -> gx_pixelmap_data,
96                             (INT)pixelmap -> gx_pixelmap_data_size,
97                             GX_COLOR_FORMAT_24XRGB, mode);
98 
99     if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
100     {
101         _gx_display_driver_32bpp_rotated_pixelmap_draw(context, xpos, ypos, &pic_outmap);
102 
103         _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
104     }
105 }
106 #endif
107 
108