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_display.h" |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw */ |
35 |
|
|
/* PORTABLE C */ |
36 |
|
|
/* 6.1.4 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* Generic 8bpp color format rotated horizontal pattern line draw */ |
44 |
|
|
/* function. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* context Drawing context */ |
49 |
|
|
/* xstart x-coord of left endpoint */ |
50 |
|
|
/* xend x-coord of right endpoint */ |
51 |
|
|
/* ypos y-coord of line top */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/* RELEASE HISTORY */ |
66 |
|
|
/* */ |
67 |
|
|
/* DATE NAME DESCRIPTION */ |
68 |
|
|
/* */ |
69 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
70 |
|
|
/* */ |
71 |
|
|
/**************************************************************************/ |
72 |
|
2188 |
VOID _gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos) |
73 |
|
|
{ |
74 |
|
|
INT column; |
75 |
|
|
GX_UBYTE *put; |
76 |
|
|
GX_UBYTE *rowstart; |
77 |
|
|
ULONG pattern; |
78 |
|
|
ULONG mask; |
79 |
|
|
GX_UBYTE on_color; |
80 |
|
|
GX_UBYTE off_color; |
81 |
|
|
|
82 |
|
2188 |
INT len = xend - xstart + 1; |
83 |
|
|
|
84 |
|
|
/* Pick up start address of canvas memory. */ |
85 |
|
2188 |
rowstart = (GX_UBYTE *)context -> gx_draw_context_memory; |
86 |
|
|
|
87 |
|
|
/* Calculate start of row address. */ |
88 |
✓✓ |
2188 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
89 |
|
|
{ |
90 |
|
1100 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xstart - 1) * context -> gx_draw_context_pitch; |
91 |
|
1100 |
rowstart += ypos; |
92 |
|
|
} |
93 |
|
|
else |
94 |
|
|
{ |
95 |
|
1088 |
rowstart += xend * context -> gx_draw_context_pitch; |
96 |
|
1088 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - 1); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* Pick up the requested pattern and mask. */ |
100 |
|
2188 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
101 |
|
2188 |
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
102 |
|
2188 |
on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color; |
103 |
|
2188 |
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color; |
104 |
|
|
|
105 |
|
2188 |
put = rowstart; |
106 |
|
|
|
107 |
|
|
/* Draw one line, left to right. */ |
108 |
✓✓ |
653180 |
for (column = 0; column < len; column++) |
109 |
|
|
{ |
110 |
✓✓ |
650992 |
if (pattern & mask) |
111 |
|
|
{ |
112 |
|
326545 |
*put = on_color; |
113 |
|
|
} |
114 |
|
|
else |
115 |
|
|
{ |
116 |
|
324447 |
*put = off_color; |
117 |
|
|
} |
118 |
|
|
|
119 |
|
650992 |
put -= context -> gx_draw_context_pitch; |
120 |
|
650992 |
mask >>= 1; |
121 |
✓✓ |
650992 |
if (!mask) |
122 |
|
|
{ |
123 |
|
18882 |
mask = 0x80000000; |
124 |
|
|
} |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
/* Save current masks value back to brush. */ |
128 |
|
2188 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; |
129 |
|
2188 |
} |
130 |
|
|
|