1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Display Management (Display)                                        */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_display.h"
29 
30 #if defined GX_BRUSH_ALPHA_SUPPORT
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw          */
37 /*                                                        PORTABLE C      */
38 /*                                                           6.1.3        */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    Internal helper function that handles writing  with brush alpha     */
46 /*    of uncompressed alpha map file.                                     */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    context                               Drawing context               */
51 /*    xpos                                  x-coord of top-left draw point*/
52 /*    ypos                                  y-coord of top-left draw point*/
53 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
54 /*    alpha                                 alpha value from 0 to 255     */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    None                                                                */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
63 /*                                            blend function              */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    _gx_display_driver_generic_alphamap_draw                            */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
74 /*                                                                        */
75 /**************************************************************************/
_gx_display_driver_generic_rotated_alphamap_raw_alpha_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pmp,GX_UBYTE alpha)76 static VOID  _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp, GX_UBYTE alpha)
77 {
78 INT                xval;
79 INT                yval;
80 GX_UBYTE          *getrowalpha;
81 GX_CONST GX_UBYTE *getalpha;
82 GX_UBYTE           combined_alpha;
83 GX_COLOR           fill_color;
84 GX_RECTANGLE      *clip;
85 GX_RECTANGLE       rotated_clip;
86 VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
87 
88     /* Pick up clip rectangle.  */
89     clip = context -> gx_draw_context_clip;
90 
91     GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
92 
93     /* Pick up context fill color.  */
94     fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
95 
96     GX_SWAP_VALS(xpos, ypos);
97 
98     if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
99     {
100         ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
101         rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
102         rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
103         rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
104         rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
105     }
106     else
107     {
108         xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
109         rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
110         rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
111         rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
112         rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
113     }
114 
115     getrowalpha = (UCHAR *)(pmp -> gx_pixelmap_data);
116     getrowalpha += (pmp -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
117     getrowalpha += (rotated_clip.gx_rectangle_left - xpos);
118 
119     for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
120     {
121         getalpha = getrowalpha;
122 
123         for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
124         {
125             combined_alpha = (GX_UBYTE)((*getalpha++) * alpha / 255);
126             blend_func(context, xval, yval, fill_color, combined_alpha);
127         }
128 
129         getrowalpha += pmp -> gx_pixelmap_height;
130     }
131 }
132 
133 /**************************************************************************/
134 /*                                                                        */
135 /*  FUNCTION                                               RELEASE        */
136 /*                                                                        */
137 /*    _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw   */
138 /*                                                        PORTABLE C      */
139 /*                                                           6.1.3        */
140 /*  AUTHOR                                                                */
141 /*                                                                        */
142 /*    Kenneth Maxwell, Microsoft Corporation                              */
143 /*                                                                        */
144 /*  DESCRIPTION                                                           */
145 /*                                                                        */
146 /*    Internal helper function that handles writing with brush alpha      */
147 /*    of compressed alpha map file.                                       */
148 /*                                                                        */
149 /*  INPUT                                                                 */
150 /*                                                                        */
151 /*    context                               Drawing context               */
152 /*    xpos                                  x-coord of top-left draw point*/
153 /*    ypos                                  y-coord of top-left draw point*/
154 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
155 /*    alpha                                 alpha value from 0 to 255     */
156 /*                                                                        */
157 /*  OUTPUT                                                                */
158 /*                                                                        */
159 /*    None                                                                */
160 /*                                                                        */
161 /*  CALLS                                                                 */
162 /*                                                                        */
163 /*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
164 /*                                            blend function              */
165 /*                                                                        */
166 /*  CALLED BY                                                             */
167 /*                                                                        */
168 /*    _gx_display_driver_generic_alphamap_draw                            */
169 /*                                                                        */
170 /*  RELEASE HISTORY                                                       */
171 /*                                                                        */
172 /*    DATE              NAME                      DESCRIPTION             */
173 /*                                                                        */
174 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
175 /*                                                                        */
176 /**************************************************************************/
_gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pmp,GX_UBYTE alpha)177 static VOID  _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp, GX_UBYTE alpha)
178 {
179 INT                yval;
180 INT                xval;
181 GX_CONST GX_UBYTE *get;
182 GX_UBYTE           count;
183 GX_UBYTE           falpha;
184 GX_COLOR           fill_color;
185 GX_RECTANGLE      *clip;
186 GX_RECTANGLE       rotated_clip;
187 GX_UBYTE           combined_alpha;
188 VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
189 
190     /* Pick up clip rectangle. */
191     clip = context -> gx_draw_context_clip;
192 
193     GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
194 
195     /* Pick up context fill color.  */
196     fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
197 
198     get = (GX_CONST GX_UBYTE *)pmp -> gx_pixelmap_data;
199 
200     GX_SWAP_VALS(xpos, ypos);
201 
202     if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
203     {
204         ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
205         rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
206         rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
207         rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
208         rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
209     }
210     else
211     {
212         xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
213         rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
214         rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
215         rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
216         rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
217     }
218 
219     /* compressed with no alpha is a two-byte count and two-byte pixel value */
220 
221     /* first, skip to the starting row */
222     for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++)
223     {
224         xval = 0;
225         while (xval < pmp -> gx_pixelmap_height)
226         {
227             count = *get++;
228 
229             if (count & 0x80)
230             {
231                 count = (GX_UBYTE)((count & 0x7f) + 1);
232                 get++;      /* skip repeated pixel value */
233             }
234             else
235             {
236                 count++;
237                 get += count;   /* skip raw pixel values */
238             }
239             xval += count;
240         }
241     }
242 
243     /* now we are on the first visible row, copy pixels until we get
244        to the enf of the last visible row
245      */
246 
247     while (yval <= rotated_clip.gx_rectangle_bottom)
248     {
249         xval = xpos;
250 
251         while (xval < xpos + pmp -> gx_pixelmap_height)
252         {
253             count = *get++;
254 
255             if (count & 0x80)
256             {
257                 /* repeated value */
258                 count = (GX_UBYTE)((count & 0x7f) + 1);
259                 falpha = *get++;
260 
261                 while (count--)
262                 {
263                     if (xval >= rotated_clip.gx_rectangle_left &&
264                         xval <= rotated_clip.gx_rectangle_right)
265                     {
266                         combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
267                         blend_func(context, xval, yval, fill_color, combined_alpha);
268                     }
269                     xval++;
270                 }
271             }
272             else
273             {
274                 /* string of non-repeated values */
275                 count++;
276                 while (count--)
277                 {
278                     if (xval >= rotated_clip.gx_rectangle_left &&
279                         xval <= rotated_clip.gx_rectangle_right)
280                     {
281                         combined_alpha = (GX_UBYTE)((*get) * alpha / 255);
282                         blend_func(context, xval, yval, fill_color, combined_alpha);
283                     }
284                     get++;
285                     xval++;
286                 }
287             }
288         }
289         yval++;
290     }
291 }
292 #endif /* GX_BRUSH_ALPHA_SUPPORT*/
293 
294 /**************************************************************************/
295 /*                                                                        */
296 /*  FUNCTION                                               RELEASE        */
297 /*                                                                        */
298 /*    _gx_display_driver_generic_rotated_alphamap_raw_draw                */
299 /*                                                        PORTABLE C      */
300 /*                                                           6.1.3        */
301 /*  AUTHOR                                                                */
302 /*                                                                        */
303 /*    Kenneth Maxwell, Microsoft Corporation                              */
304 /*                                                                        */
305 /*  DESCRIPTION                                                           */
306 /*                                                                        */
307 /*    Internal helper function that handles writing of uncompressed       */
308 /*    alpha map file.                                                     */
309 /*                                                                        */
310 /*  INPUT                                                                 */
311 /*                                                                        */
312 /*    context                               Drawing context               */
313 /*    xpos                                  x-coord of top-left draw point*/
314 /*    ypos                                  y-coord of top-left draw point*/
315 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
316 /*                                                                        */
317 /*  OUTPUT                                                                */
318 /*                                                                        */
319 /*    None                                                                */
320 /*                                                                        */
321 /*  CALLS                                                                 */
322 /*                                                                        */
323 /*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
324 /*                                            blend function              */
325 /*                                                                        */
326 /*  CALLED BY                                                             */
327 /*                                                                        */
328 /*    _gx_display_driver_generic_alphamap_draw                            */
329 /*                                                                        */
330 /*  RELEASE HISTORY                                                       */
331 /*                                                                        */
332 /*    DATE              NAME                      DESCRIPTION             */
333 /*                                                                        */
334 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
335 /*                                                                        */
336 /**************************************************************************/
_gx_display_driver_generic_rotated_alphamap_raw_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pmp)337 static VOID  _gx_display_driver_generic_rotated_alphamap_raw_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
338 {
339 INT                xval;
340 INT                yval;
341 GX_UBYTE          *getrowalpha;
342 GX_CONST GX_UBYTE *getalpha;
343 GX_COLOR           fill_color;
344 GX_RECTANGLE      *clip;
345 GX_RECTANGLE       rotated_clip;
346 VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
347 
348     /* Pick up clip rectangle.  */
349     clip = context -> gx_draw_context_clip;
350 
351     GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
352 
353     /* Pick up context fill color.  */
354     fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
355 
356     GX_SWAP_VALS(xpos, ypos);
357 
358     if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
359     {
360         ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
361         rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
362         rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
363         rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
364         rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
365     }
366     else
367     {
368         xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
369         rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
370         rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
371         rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
372         rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
373     }
374 
375     getrowalpha = (UCHAR *)(pmp -> gx_pixelmap_data);
376     getrowalpha += (pmp -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
377     getrowalpha += (rotated_clip.gx_rectangle_left - xpos);
378 
379     for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
380     {
381         getalpha = getrowalpha;
382 
383         for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
384         {
385             blend_func(context, xval, yval, fill_color, *getalpha++);
386         }
387 
388         getrowalpha += pmp -> gx_pixelmap_height;
389     }
390 }
391 
392 /**************************************************************************/
393 /*                                                                        */
394 /*  FUNCTION                                               RELEASE        */
395 /*                                                                        */
396 /*    _gx_display_driver_generic_rotated_alphamap_compressed_draw         */
397 /*                                                        PORTABLE C      */
398 /*                                                           6.1.3        */
399 /*  AUTHOR                                                                */
400 /*                                                                        */
401 /*    Kenneth Maxwell, Microsoft Corporation                              */
402 /*                                                                        */
403 /*  DESCRIPTION                                                           */
404 /*                                                                        */
405 /*    Internal helper function that handles writing of compressed         */
406 /*    alpha map file.                                                     */
407 /*                                                                        */
408 /*  INPUT                                                                 */
409 /*                                                                        */
410 /*    context                               Drawing context               */
411 /*    xpos                                  x-coord of top-left draw point*/
412 /*    ypos                                  y-coord of top-left draw point*/
413 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
414 /*                                                                        */
415 /*  OUTPUT                                                                */
416 /*                                                                        */
417 /*    None                                                                */
418 /*                                                                        */
419 /*  CALLS                                                                 */
420 /*                                                                        */
421 /*    [gx_display_driver_pixel_blend]       Basic display driver pixel    */
422 /*                                            blend function              */
423 /*                                                                        */
424 /*  CALLED BY                                                             */
425 /*                                                                        */
426 /*    _gx_display_driver_generic_alphamap_draw                            */
427 /*                                                                        */
428 /*  RELEASE HISTORY                                                       */
429 /*                                                                        */
430 /*    DATE              NAME                      DESCRIPTION             */
431 /*                                                                        */
432 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
433 /*                                                                        */
434 /**************************************************************************/
_gx_display_driver_generic_rotated_alphamap_compressed_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pmp)435 static VOID  _gx_display_driver_generic_rotated_alphamap_compressed_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
436 {
437 INT                yval;
438 INT                xval;
439 GX_CONST GX_UBYTE *get;
440 GX_UBYTE           count;
441 GX_UBYTE           pixel;
442 GX_COLOR           fill_color;
443 GX_RECTANGLE      *clip;
444 GX_RECTANGLE       rotated_clip;
445 VOID               (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
446 
447     /* Pick up clip rectangle.  */
448     clip = context->gx_draw_context_clip;
449 
450     GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
451 
452     /* Pick up context fill color.  */
453     fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
454 
455     get = (GX_CONST GX_UBYTE *)pmp -> gx_pixelmap_data;
456 
457     GX_SWAP_VALS(xpos, ypos);
458 
459     if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
460     {
461         ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
462         rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
463         rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
464         rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
465         rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
466     }
467     else
468     {
469         xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
470         rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
471         rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
472         rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
473         rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
474     }
475 
476     /* compressed with no alpha is a two-byte count and two-byte pixel value */
477 
478     /* first, skip to the starting row */
479     for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++)
480     {
481         xval = 0;
482         while (xval < pmp -> gx_pixelmap_height)
483         {
484             count = *get++;
485 
486             if (count & 0x80)
487             {
488                 count = (GX_UBYTE)((count & 0x7f) + 1);
489                 get++;      /* skip repeated pixel value */
490             }
491             else
492             {
493                 count++;
494                 get += count;   /* skip raw pixel values */
495             }
496             xval += count;
497         }
498     }
499 
500     /* now we are on the first visible row, copy pixels until we get
501        to the enf of the last visible row
502      */
503 
504     while (yval <= rotated_clip.gx_rectangle_bottom)
505     {
506         xval = xpos;
507 
508         while (xval < xpos + pmp -> gx_pixelmap_height)
509         {
510             count = *get++;
511 
512             if (count & 0x80)
513             {
514                 /* repeated value */
515                 count = (GX_UBYTE)((count & 0x7f) + 1);
516                 pixel = *get++;
517 
518                 while (count--)
519                 {
520                     if (xval >= rotated_clip.gx_rectangle_left &&
521                         xval <= rotated_clip.gx_rectangle_right)
522                     {
523                         blend_func(context, xval, yval, fill_color, pixel);
524                     }
525                     xval++;
526                 }
527             }
528             else
529             {
530                 /* string of non-repeated values */
531                 count++;
532                 while (count--)
533                 {
534                     if (xval >= rotated_clip.gx_rectangle_left &&
535                         xval <= rotated_clip.gx_rectangle_right)
536                     {
537                         blend_func(context, xval, yval, fill_color, *get);
538                     }
539                     get++;
540                     xval++;
541                 }
542             }
543         }
544         yval++;
545     }
546 }
547 
548 /**************************************************************************/
549 /*                                                                        */
550 /*  FUNCTION                                               RELEASE        */
551 /*                                                                        */
552 /*    _gx_display_driver_generic_rotated_alphamap_draw    PORTABLE C      */
553 /*                                                           6.1.3        */
554 /*  AUTHOR                                                                */
555 /*                                                                        */
556 /*    Kenneth Maxwell, Microsoft Corporation                              */
557 /*                                                                        */
558 /*  DESCRIPTION                                                           */
559 /*                                                                        */
560 /*    This function blends the context fill color with the canvas         */
561 /*      background.                                                       */
562 /*                                                                        */
563 /*  INPUT                                                                 */
564 /*                                                                        */
565 /*    context                               Drawing context               */
566 /*    xpos                                  x-coord of top-left draw point*/
567 /*    ypos                                  y-coord of top-left draw point*/
568 /*    pmp                                   Pointer to GX_PIXELMAP struct */
569 /*                                                                        */
570 /*  OUTPUT                                                                */
571 /*                                                                        */
572 /*    status                                Completion status             */
573 /*                                                                        */
574 /*  CALLS                                                                 */
575 /*                                                                        */
576 /*    _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw   */
577 /*                                          Real display driver alphamap  */
578 /*                                            draw function               */
579 /*    _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw          */
580 /*                                          Real display driver alphamap  */
581 /*                                            draw function               */
582 /*    _gx_display_driver_generic_rotated_alphamap_compressed_draw         */
583 /*                                          Real display driver alphamap  */
584 /*                                            draw function               */
585 /*    _gx_display_driver_generic_rotated_alphamap_raw_draw                */
586 /*                                          Real display driver alphamap  */
587 /*                                            draw function               */
588 /*                                                                        */
589 /*  CALLED BY                                                             */
590 /*                                                                        */
591 /*    Application Code                                                    */
592 /*    GUIX default draw funtions                                          */
593 /*                                                                        */
594 /*  RELEASE HISTORY                                                       */
595 /*                                                                        */
596 /*    DATE              NAME                      DESCRIPTION             */
597 /*                                                                        */
598 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
599 /*                                                                        */
600 /**************************************************************************/
_gx_display_driver_generic_rotated_alphamap_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pmp)601 VOID  _gx_display_driver_generic_rotated_alphamap_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
602 {
603 #if defined GX_BRUSH_ALPHA_SUPPORT
604 GX_UBYTE alpha;
605 
606     alpha = context -> gx_draw_context_brush.gx_brush_alpha;
607     if (alpha == 0)
608     {
609         /* Nothing to drawn. Just return. */
610         return;
611     }
612 
613     if (alpha != 0xff)
614     {
615         if (pmp -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
616         {
617             _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw(context, xpos, ypos, pmp, alpha);
618         }
619         else
620         {
621             _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw(context, xpos, ypos, pmp, alpha);
622         }
623         return;
624     }
625 #endif
626 
627     if (pmp -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
628     {
629         _gx_display_driver_generic_rotated_alphamap_compressed_draw(context, xpos, ypos, pmp);
630     }
631     else
632     {
633         _gx_display_driver_generic_rotated_alphamap_raw_draw(context, xpos, ypos, pmp);
634     }
635 }
636 
637