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