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_display.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_display_driver_32bpp_horizontal_line_draw       PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    Generic 32bpp color format horizontal line draw function.           */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    context                               Drawing context               */
47 /*    xstart                                x-coord of left endpoint      */
48 /*    xend                                  x-coord of right endpoint     */
49 /*    ypos                                  y-coord of line top           */
50 /*    width                                 Width (height) of the line    */
51 /*    color                                 Color of line to write        */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    NOne                                                                */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _gx_display_driver_horizontal_line_alpha_draw                       */
60 /*                                          Basic horizontal line alpha   */
61 /*                                            draw function               */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    GUIX Internal Code                                                  */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
72 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
73 /*                                            resulting in version 6.1    */
74 /*                                                                        */
75 /**************************************************************************/
_gx_display_driver_32bpp_horizontal_line_draw(GX_DRAW_CONTEXT * context,INT xstart,INT xend,INT ypos,INT width,GX_COLOR color)76 VOID _gx_display_driver_32bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
77 {
78 INT    row;
79 INT    column;
80 ULONG *put;
81 ULONG *rowstart;
82 INT    len = xend - xstart + 1;
83 
84 #if defined GX_BRUSH_ALPHA_SUPPORT
85 GX_UBYTE alpha;
86 
87     alpha = context -> gx_draw_context_brush.gx_brush_alpha;
88     if (alpha == 0)
89     {
90         /* Nothing to drawn. Just return. */
91         return;
92     }
93 
94     if (alpha != 0xff)
95     {
96         _gx_display_driver_horizontal_line_alpha_draw(context, xstart, xend, ypos, width, color, alpha);
97         return;
98     }
99 #endif
100 
101     /* pick up start address of canvas memory */
102     rowstart = (ULONG *)context -> gx_draw_context_memory;
103 
104     /* calculate start of row address */
105     rowstart += context -> gx_draw_context_pitch * ypos;
106 
107     /* calculate pixel address */
108     rowstart += xstart;
109     /* draw 1-pixel hi lines to fill width */
110     for (row = 0; row < width; row++)
111     {
112         put = rowstart;
113 
114         /* draw one line, left to right */
115         for (column = 0; column < len; column++)
116         {
117             *put++ = (ULONG)color;
118         }
119         rowstart += context -> gx_draw_context_pitch;
120     }
121 }
122 
123