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_32bpp_rotated_vertical_pattern_line_draw */ |
34 |
|
|
/* */ |
35 |
|
|
/* PORTABLE C */ |
36 |
|
|
/* 6.1.4 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* Generic rotated 32bpp color format vertical pattern line draw */ |
44 |
|
|
/* function. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* context Drawing context */ |
49 |
|
|
/* ystart y-coord of top endpoint */ |
50 |
|
|
/* yend y-coord of bottom endpoint */ |
51 |
|
|
/* xpos x-coord of left edge */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
3230 |
VOID _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) |
67 |
|
|
{ |
68 |
|
|
INT row; |
69 |
|
|
ULONG *put; |
70 |
|
|
ULONG *rowstart; |
71 |
|
|
ULONG pattern; |
72 |
|
|
ULONG mask; |
73 |
|
|
ULONG on_color; |
74 |
|
|
ULONG off_color; |
75 |
|
3230 |
INT len = yend - ystart + 1; |
76 |
|
|
|
77 |
|
|
/* Pick up starting address of canvas memory. */ |
78 |
|
3230 |
rowstart = (ULONG *)context -> gx_draw_context_memory; |
79 |
|
|
|
80 |
✓✓ |
3230 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
81 |
|
|
{ |
82 |
|
|
/* Calculate start of scanline. */ |
83 |
|
2140 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch; |
84 |
|
|
|
85 |
|
|
/* Offset into starting pixel. */ |
86 |
|
2140 |
rowstart += ystart; |
87 |
|
|
} |
88 |
|
|
else |
89 |
|
|
{ |
90 |
|
|
/* Calculate start of scanline. */ |
91 |
|
1090 |
rowstart += xpos * context -> gx_draw_context_pitch; |
92 |
|
|
|
93 |
|
|
/* Offset into starting pixel. */ |
94 |
|
1090 |
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1); |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* Pick up the requested pattern and mask. */ |
98 |
|
3230 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
99 |
|
3230 |
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
100 |
|
3230 |
on_color = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color; |
101 |
|
3230 |
off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color; |
102 |
|
|
|
103 |
|
3230 |
put = rowstart; |
104 |
|
|
|
105 |
|
|
/* Draw line from top to bottom. */ |
106 |
✓✓ |
978700 |
for (row = 0; row < len; row++) |
107 |
|
|
{ |
108 |
✓✓ |
975470 |
if (pattern & mask) |
109 |
|
|
{ |
110 |
|
636979 |
*put = on_color; |
111 |
|
|
} |
112 |
|
|
else |
113 |
|
|
{ |
114 |
|
338491 |
*put = off_color; |
115 |
|
|
} |
116 |
|
|
|
117 |
|
975470 |
mask >>= 1; |
118 |
✓✓ |
975470 |
if (!mask) |
119 |
|
|
{ |
120 |
|
28322 |
mask = 0x80000000; |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
/* Advance to the next scaneline. */ |
124 |
|
975470 |
put++; |
125 |
|
|
} |
126 |
|
|
/* Save current masks value back to brush. */ |
127 |
|
3230 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask; |
128 |
|
3230 |
} |
129 |
|
|
|