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 /* FUNCTION RELEASE */ 32 /* */ 33 /* _gx_display_driver_32bpp_vertical_pattern_line_draw */ 34 /* PORTABLE C */ 35 /* 6.1 */ 36 /* AUTHOR */ 37 /* */ 38 /* Kenneth Maxwell, Microsoft Corporation */ 39 /* */ 40 /* DESCRIPTION */ 41 /* */ 42 /* Generic 32bpp color format vertical pattern line draw function. */ 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 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* None */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* None */ 58 /* */ 59 /* CALLED BY */ 60 /* */ 61 /* GUIX Internal Code */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 68 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 69 /* resulting in version 6.1 */ 70 /* */ 71 /**************************************************************************/ _gx_display_driver_32bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT * context,INT ystart,INT yend,INT xpos)72VOID _gx_display_driver_32bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) 73 { 74 INT row; 75 ULONG *put; 76 ULONG *rowstart; 77 ULONG pattern; 78 ULONG mask; 79 ULONG on_color; 80 ULONG off_color; 81 82 INT len = yend - ystart + 1; 83 84 /* pick up starting address of canvas memory */ 85 rowstart = (ULONG *)context -> gx_draw_context_memory; 86 87 /* calculate start of scanline */ 88 rowstart += context -> gx_draw_context_pitch * ystart; 89 90 /* offset into starting pixel */ 91 rowstart += xpos; 92 93 /* pick up the requested pattern and mask */ 94 pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; 95 mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; 96 on_color = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color; 97 off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color; 98 99 /* draw line from top to bottom */ 100 for (row = 0; row < len; row++) 101 { 102 put = rowstart; 103 104 if (pattern & mask) 105 { 106 *put = on_color; 107 } 108 else 109 { 110 *put = off_color; 111 } 112 113 mask >>= 1; 114 if (!mask) 115 { 116 mask = 0x80000000; 117 } 118 119 /* advance to the next scaneline */ 120 rowstart += context -> gx_draw_context_pitch; 121 } 122 /* save current masks value back to brush */ 123 context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; 124 } 125 126