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 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_display.h"
28 
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_display_driver_32bpp_vertical_line_draw         PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    Generic vertical line draw function for 16bpp canvas.               */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    context                               Drawing context               */
47 /*    ystart                                y-coord of top endpoint       */
48 /*    yend                                  y-coord of bottom endpoint    */
49 /*    xpos                                  x-coord of left edge          */
50 /*    width                                 width of the line             */
51 /*    color                                 Color of line to write        */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    None                                                                */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _gx_display_driver_vertical_line_alpha_draw                         */
60 /*                                          Basic display driver vertical */
61 /*                                            line alpha 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_vertical_line_draw(GX_DRAW_CONTEXT * context,INT ystart,INT yend,INT xpos,INT width,GX_COLOR color)76 VOID _gx_display_driver_32bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
77 {
78 INT    row;
79 INT    column;
80 ULONG *put;
81 ULONG *rowstart;
82 INT    len = yend - ystart + 1;
83 #if defined GX_BRUSH_ALPHA_SUPPORT
84 GX_UBYTE alpha;
85 
86     alpha = context -> gx_draw_context_brush.gx_brush_alpha;
87     if (alpha == 0)
88     {
89         /* Nothing to drawn. Just return. */
90         return;
91     }
92     if (alpha != 0xff)
93     {
94         _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
95         return;
96     }
97 #endif
98 
99     /* pick up starting address of canvas memory */
100     rowstart = (ULONG *)context -> gx_draw_context_memory;
101 
102     /* calculate start of scanline */
103     rowstart += context -> gx_draw_context_pitch * ystart;
104 
105     /* offset into starting pixel */
106     rowstart += xpos;
107 
108     /* draw line from top to bottom */
109     for (row = 0; row < len; row++)
110     {
111         put = rowstart;
112 
113         /* draw line width from left to right */
114         for (column = 0; column < width; column++)
115         {
116             *put++ = (ULONG)color;
117         }
118 
119         /* advance to the next scaneline */
120         rowstart += context -> gx_draw_context_pitch;
121     }
122 }
123