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