1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
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_16bpp_rotated_vertical_pattern_line_draw */ |
34 |
|
|
/* PORTABLE C */ |
35 |
|
|
/* 6.1.3 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* Generic 16bpp color format rotated vertical pattern line draw */ |
43 |
|
|
/* function. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* context Drawing context */ |
48 |
|
|
/* ystart y-coord of top endpoint */ |
49 |
|
|
/* yend y-coord of bottom endpoint */ |
50 |
|
|
/* xpos x-coord of left edge */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* None */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* GUIX Internal Code */ |
63 |
|
|
/* */ |
64 |
|
|
/**************************************************************************/ |
65 |
|
2100 |
VOID _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) |
66 |
|
|
{ |
67 |
|
|
INT row; |
68 |
|
|
USHORT *put; |
69 |
|
|
USHORT *rowstart; |
70 |
|
|
ULONG pattern; |
71 |
|
|
ULONG mask; |
72 |
|
|
USHORT on_color; |
73 |
|
|
USHORT off_color; |
74 |
|
|
|
75 |
|
2100 |
INT len = yend - ystart + 1; |
76 |
|
|
|
77 |
|
|
/* pick up starting address of canvas memory */ |
78 |
|
2100 |
rowstart = (USHORT *)context -> gx_draw_context_memory; |
79 |
|
|
|
80 |
✓✓ |
2100 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
81 |
|
|
{ |
82 |
|
|
/* calculate start of scanline */ |
83 |
|
1050 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch; |
84 |
|
|
|
85 |
|
|
/* offset into starting pixel */ |
86 |
|
1050 |
rowstart += ystart; |
87 |
|
|
} |
88 |
|
|
else |
89 |
|
|
{ |
90 |
|
|
/* calculate start of scanline */ |
91 |
|
1050 |
rowstart += xpos * context -> gx_draw_context_pitch; |
92 |
|
|
|
93 |
|
|
/* offset into starting pixel */ |
94 |
|
1050 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1); |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* pick up the requested pattern and mask */ |
98 |
|
2100 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
99 |
|
2100 |
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
100 |
|
2100 |
on_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color; |
101 |
|
2100 |
off_color = (USHORT)context -> gx_draw_context_brush.gx_brush_fill_color; |
102 |
|
|
|
103 |
|
2100 |
put = rowstart; |
104 |
|
|
|
105 |
|
|
/* draw line from left to right */ |
106 |
✓✓ |
648404 |
for (row = 0; row < len; row++) |
107 |
|
|
{ |
108 |
✓✓ |
646304 |
if (pattern & mask) |
109 |
|
|
{ |
110 |
|
422142 |
*put = on_color; |
111 |
|
|
} |
112 |
|
|
else |
113 |
|
|
{ |
114 |
|
224162 |
*put = off_color; |
115 |
|
|
} |
116 |
|
|
|
117 |
|
646304 |
mask >>= 1; |
118 |
✓✓ |
646304 |
if (!mask) |
119 |
|
|
{ |
120 |
|
18764 |
mask = 0x80000000; |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
/* advance to the right */ |
124 |
|
646304 |
put++; |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
/* save current masks value back to brush */ |
128 |
|
2100 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; |
129 |
|
2100 |
} |
130 |
|
|
|