/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** GUIX Component */ /** */ /** Display Management (Display) */ /** */ /**************************************************************************/ #define GX_SOURCE_CODE /* Include necessary system files. */ #include "gx_api.h" #include "gx_display.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _gx_display_driver_8bpp_horizontal_pattern_line_draw */ /* PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Kenneth Maxwell, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* Generic 8bpp color format horizontal pattern line draw function. */ /* */ /* INPUT */ /* */ /* context Drawing context */ /* xstart x-coord of left endpoint */ /* xend x-coord of right endpoint */ /* ypos y-coord of line top */ /* */ /* OUTPUT */ /* */ /* None */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* GUIX Internal Code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ /* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _gx_display_driver_8bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos) { INT column; GX_UBYTE *put; GX_UBYTE *rowstart; ULONG pattern; ULONG mask; GX_UBYTE on_color; GX_UBYTE off_color; INT len = xend - xstart + 1; /* pick up start address of canvas memory */ rowstart = (GX_UBYTE *)context -> gx_draw_context_memory; /* calculate start of row address */ rowstart += context -> gx_draw_context_pitch * ypos; /* calculate pixel address */ rowstart += xstart; /* draw 1-pixel hi lines to fill width */ /* pick up the requested pattern and mask */ pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color; off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color; put = rowstart; /* draw one line, left to right */ for (column = 0; column < len; column++) { if (pattern & mask) { *put++ = on_color; } else { *put++ = off_color; } mask >>= 1; if (!mask) { mask = 0x80000000; } } /* save current masks value back to brush */ context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; }