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 |
|
|
/* FUNCTION RELEASE */ |
32 |
|
|
/* */ |
33 |
|
|
/* _gx_display_driver_8bpp_rotated_vertical_pattern_line_draw */ |
34 |
|
|
/* PORTABLE C */ |
35 |
|
|
/* 6.1.4 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* Generic 8bpp color format rotated vertical 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 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
2170 |
VOID _gx_display_driver_8bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) |
71 |
|
|
{ |
72 |
|
|
INT row; |
73 |
|
|
GX_UBYTE *put; |
74 |
|
|
GX_UBYTE *rowstart; |
75 |
|
|
ULONG pattern; |
76 |
|
|
ULONG mask; |
77 |
|
|
GX_UBYTE on_color; |
78 |
|
|
GX_UBYTE off_color; |
79 |
|
|
|
80 |
|
2170 |
INT len = yend - ystart + 1; |
81 |
|
|
|
82 |
|
|
/* Pick up starting address of canvas memory. */ |
83 |
|
2170 |
rowstart = (GX_UBYTE *)context -> gx_draw_context_memory; |
84 |
|
|
|
85 |
✓✓ |
2170 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
86 |
|
|
{ |
87 |
|
|
/* Calculate start of scanline. */ |
88 |
|
1090 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch; |
89 |
|
|
|
90 |
|
|
/* Offset into starting pixel. */ |
91 |
|
1090 |
rowstart += ystart; |
92 |
|
|
} |
93 |
|
|
else |
94 |
|
|
{ |
95 |
|
|
/* Calculate start of scanline. */ |
96 |
|
1080 |
rowstart += xpos * context -> gx_draw_context_pitch; |
97 |
|
|
|
98 |
|
|
/* Offset into starting pixel. */ |
99 |
|
1080 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
/* Pick up the requested pattern and mask. */ |
103 |
|
2170 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
104 |
|
2170 |
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
105 |
|
2170 |
on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color; |
106 |
|
2170 |
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color; |
107 |
|
|
|
108 |
|
|
/* Draw line from top to bottom. */ |
109 |
✓✓ |
653738 |
for (row = 0; row < len; row++) |
110 |
|
|
{ |
111 |
|
651568 |
put = rowstart; |
112 |
|
|
|
113 |
✓✓ |
651568 |
if (pattern & mask) |
114 |
|
|
{ |
115 |
|
425439 |
*put = on_color; |
116 |
|
|
} |
117 |
|
|
else |
118 |
|
|
{ |
119 |
|
226129 |
*put = off_color; |
120 |
|
|
} |
121 |
|
|
|
122 |
|
651568 |
mask >>= 1; |
123 |
✓✓ |
651568 |
if (!mask) |
124 |
|
|
{ |
125 |
|
18918 |
mask = 0x80000000; |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
/* advance to the next scaneline */ |
129 |
|
651568 |
rowstart++; |
130 |
|
|
} |
131 |
|
|
/* save current masks value back to brush */ |
132 |
|
2170 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; |
133 |
|
2170 |
} |
134 |
|
|
|