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 |
|
|
#include "gx_context.h" |
29 |
|
|
|
30 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_display_driver_8bpp_rotated_pixelmap_raw_write PORTABLE C */ |
35 |
|
|
/* 6.1.4 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
43 |
|
|
/* pixlemap file without alpha channel. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* context Drawing context */ |
48 |
|
|
/* xpos x-coord of top-left draw point*/ |
49 |
|
|
/* ypos y-coord of top-left draw point*/ |
50 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLED BY */ |
57 |
|
|
/* */ |
58 |
|
|
/* GUIX Internal Code */ |
59 |
|
|
/* */ |
60 |
|
|
/* RELEASE HISTORY */ |
61 |
|
|
/* */ |
62 |
|
|
/* DATE NAME DESCRIPTION */ |
63 |
|
|
/* */ |
64 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
65 |
|
|
/* */ |
66 |
|
|
/**************************************************************************/ |
67 |
|
216 |
static VOID _gx_display_driver_8bpp_rotated_pixelmap_raw_write(GX_DRAW_CONTEXT *context, |
68 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
69 |
|
|
{ |
70 |
|
|
INT xval; |
71 |
|
|
INT yval; |
72 |
|
|
GX_UBYTE *putrow; |
73 |
|
|
GX_UBYTE *getrow; |
74 |
|
|
GX_UBYTE *put; |
75 |
|
|
GX_CONST GX_UBYTE *get; |
76 |
|
|
|
77 |
|
216 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
78 |
|
|
GX_RECTANGLE rotated_clip; |
79 |
|
|
|
80 |
|
216 |
GX_SWAP_VALS(xpos, ypos); |
81 |
|
|
|
82 |
✓✓ |
216 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
83 |
|
|
{ |
84 |
|
108 |
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top; |
85 |
|
108 |
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom; |
86 |
|
108 |
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1); |
87 |
|
108 |
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1); |
88 |
|
108 |
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width); |
89 |
|
|
} |
90 |
|
|
else |
91 |
|
|
{ |
92 |
|
108 |
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1); |
93 |
|
108 |
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1); |
94 |
|
108 |
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left; |
95 |
|
108 |
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right; |
96 |
|
108 |
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
216 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
100 |
|
216 |
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch; |
101 |
|
216 |
putrow += rotated_clip.gx_rectangle_left; |
102 |
|
|
|
103 |
|
216 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
104 |
|
216 |
getrow += pixelmap -> gx_pixelmap_height * (rotated_clip.gx_rectangle_top - ypos); |
105 |
|
216 |
getrow += (rotated_clip.gx_rectangle_left - xpos); |
106 |
|
|
|
107 |
✓✓ |
49124 |
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++) |
108 |
|
|
{ |
109 |
|
48908 |
put = putrow; |
110 |
|
48908 |
get = getrow; |
111 |
|
|
|
112 |
✓✓ |
5945734 |
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++) |
113 |
|
|
{ |
114 |
|
5896826 |
*put++ = *get++; |
115 |
|
|
} |
116 |
|
48908 |
putrow += context -> gx_draw_context_pitch; |
117 |
|
48908 |
getrow += pixelmap -> gx_pixelmap_height; |
118 |
|
|
} |
119 |
|
216 |
} |
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
/**************************************************************************/ |
124 |
|
|
/* */ |
125 |
|
|
/* FUNCTION RELEASE */ |
126 |
|
|
/* */ |
127 |
|
|
/* _gx_display_driver_8bpp_rotated_pixelmap_compressed_write */ |
128 |
|
|
/* PORTABLE C */ |
129 |
|
|
/* 6.1.4 */ |
130 |
|
|
/* AUTHOR */ |
131 |
|
|
/* */ |
132 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
133 |
|
|
/* */ |
134 |
|
|
/* DESCRIPTION */ |
135 |
|
|
/* */ |
136 |
|
|
/* Internal helper function that handles writing of compressed */ |
137 |
|
|
/* pixlemap file. */ |
138 |
|
|
/* */ |
139 |
|
|
/* INPUT */ |
140 |
|
|
/* */ |
141 |
|
|
/* context Drawing context */ |
142 |
|
|
/* xpos x-coord of top-left draw point*/ |
143 |
|
|
/* ypos y-coord of top-left draw point*/ |
144 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
145 |
|
|
/* */ |
146 |
|
|
/* OUTPUT */ |
147 |
|
|
/* */ |
148 |
|
|
/* None */ |
149 |
|
|
/* */ |
150 |
|
|
/* CALLS */ |
151 |
|
|
/* */ |
152 |
|
|
/* None */ |
153 |
|
|
/* */ |
154 |
|
|
/* CALLED BY */ |
155 |
|
|
/* */ |
156 |
|
|
/* GUIX Internal Code */ |
157 |
|
|
/* */ |
158 |
|
|
/* RELEASE HISTORY */ |
159 |
|
|
/* */ |
160 |
|
|
/* DATE NAME DESCRIPTION */ |
161 |
|
|
/* */ |
162 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
163 |
|
|
/* */ |
164 |
|
|
/**************************************************************************/ |
165 |
|
4486 |
static VOID _gx_display_driver_8bpp_rotated_pixelmap_compressed_write(GX_DRAW_CONTEXT *context, |
166 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
167 |
|
|
{ |
168 |
|
|
INT yval; |
169 |
|
|
INT xval; |
170 |
|
|
GX_CONST GX_UBYTE *get; |
171 |
|
|
GX_UBYTE *put; |
172 |
|
|
GX_UBYTE *putrow; |
173 |
|
|
GX_UBYTE count; |
174 |
|
4486 |
GX_UBYTE pixel = 0; |
175 |
|
4486 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
176 |
|
|
|
177 |
|
|
GX_RECTANGLE rotated_clip; |
178 |
|
|
|
179 |
|
4486 |
GX_SWAP_VALS(xpos, ypos); |
180 |
|
|
|
181 |
✓✓ |
4486 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
182 |
|
|
{ |
183 |
|
2273 |
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top; |
184 |
|
2273 |
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom; |
185 |
|
2273 |
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1); |
186 |
|
2273 |
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1); |
187 |
|
2273 |
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width); |
188 |
|
|
} |
189 |
|
|
else |
190 |
|
|
{ |
191 |
|
2213 |
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1); |
192 |
|
2213 |
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1); |
193 |
|
2213 |
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left; |
194 |
|
2213 |
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right; |
195 |
|
2213 |
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height); |
196 |
|
|
} |
197 |
|
|
|
198 |
|
4486 |
get = (GX_CONST GX_UBYTE *)pixelmap -> gx_pixelmap_data; |
199 |
|
|
|
200 |
|
|
/* First, skip to the starting row. */ |
201 |
✓✓ |
5750 |
for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++) |
202 |
|
|
{ |
203 |
|
1264 |
xval = 0; |
204 |
✓✓ |
28858 |
while (xval < pixelmap -> gx_pixelmap_height) |
205 |
|
|
{ |
206 |
|
27594 |
count = *get++; |
207 |
|
|
|
208 |
✓✓ |
27594 |
if (count & 0x80) |
209 |
|
|
{ |
210 |
|
15793 |
count = (GX_UBYTE)((count & 0x7f) + 1); |
211 |
|
|
|
212 |
|
|
/* Skip repeated pixel value. */ |
213 |
|
15793 |
get++; |
214 |
|
|
} |
215 |
|
|
else |
216 |
|
|
{ |
217 |
|
11801 |
count++; |
218 |
|
|
|
219 |
|
|
/* Skip raw pixel values. */ |
220 |
|
11801 |
get += count; |
221 |
|
|
} |
222 |
|
27594 |
xval += count; |
223 |
|
|
} |
224 |
|
|
} |
225 |
|
|
|
226 |
|
|
/* Now we are on the first visible row, copy pixels until we get |
227 |
|
|
to the end of the last visible row. */ |
228 |
|
4486 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
229 |
|
4486 |
putrow += yval * context -> gx_draw_context_pitch; |
230 |
|
4486 |
putrow += xpos; |
231 |
|
|
|
232 |
✓✓ |
81934 |
while (yval <= rotated_clip.gx_rectangle_bottom) |
233 |
|
|
{ |
234 |
|
77448 |
put = putrow; |
235 |
|
77448 |
xval = xpos; |
236 |
|
|
|
237 |
✓✓ |
441971 |
while (xval < (xpos + pixelmap -> gx_pixelmap_height)) |
238 |
|
|
{ |
239 |
|
364523 |
count = *get++; |
240 |
|
|
|
241 |
✓✓ |
364523 |
if (count & 0x80) |
242 |
|
|
{ |
243 |
|
|
|
244 |
|
|
/* Repeated value. */ |
245 |
|
179780 |
count = (GX_UBYTE)((count & 0x7f) + 1); |
246 |
|
179780 |
pixel = *get++; |
247 |
|
|
|
248 |
✓✓ |
1254431 |
while (count--) |
249 |
|
|
{ |
250 |
✓✓ |
1074651 |
if (xval >= rotated_clip.gx_rectangle_left && |
251 |
✓✓ |
1058955 |
xval <= rotated_clip.gx_rectangle_right) |
252 |
|
|
{ |
253 |
|
1038885 |
*put = pixel; |
254 |
|
|
} |
255 |
|
1074651 |
put++; |
256 |
|
1074651 |
xval++; |
257 |
|
|
} |
258 |
|
|
} |
259 |
|
|
else |
260 |
|
|
{ |
261 |
|
|
|
262 |
|
|
/* String of non-repeated values. */ |
263 |
|
184743 |
count++; |
264 |
|
|
|
265 |
✓✓ |
1023980 |
while (count--) |
266 |
|
|
{ |
267 |
✓✓ |
839237 |
if (xval >= rotated_clip.gx_rectangle_left && |
268 |
✓✓ |
822090 |
xval <= rotated_clip.gx_rectangle_right) |
269 |
|
|
{ |
270 |
|
801253 |
*put = *get; |
271 |
|
|
} |
272 |
|
839237 |
put++; |
273 |
|
839237 |
get++; |
274 |
|
839237 |
xval++; |
275 |
|
|
} |
276 |
|
|
} |
277 |
|
|
} |
278 |
|
77448 |
putrow += context -> gx_draw_context_pitch; |
279 |
|
77448 |
yval++; |
280 |
|
|
} |
281 |
|
4486 |
} |
282 |
|
|
|
283 |
|
|
/**************************************************************************/ |
284 |
|
|
/* */ |
285 |
|
|
/* FUNCTION RELEASE */ |
286 |
|
|
/* */ |
287 |
|
|
/* _gx_display_driver_8bpp_rotated_pixelmap_transparent_write */ |
288 |
|
|
/* PORTABLE C */ |
289 |
|
|
/* 6.1.4 */ |
290 |
|
|
/* AUTHOR */ |
291 |
|
|
/* */ |
292 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
293 |
|
|
/* */ |
294 |
|
|
/* DESCRIPTION */ |
295 |
|
|
/* */ |
296 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
297 |
|
|
/* pixlemap file with alpha channel. */ |
298 |
|
|
/* */ |
299 |
|
|
/* INPUT */ |
300 |
|
|
/* */ |
301 |
|
|
/* context Drawing context */ |
302 |
|
|
/* xpos x-coord of top-left draw point*/ |
303 |
|
|
/* ypos y-coord of top-left draw point*/ |
304 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
305 |
|
|
/* */ |
306 |
|
|
/* OUTPUT */ |
307 |
|
|
/* */ |
308 |
|
|
/* None */ |
309 |
|
|
/* */ |
310 |
|
|
/* CALLS */ |
311 |
|
|
/* */ |
312 |
|
|
/* None */ |
313 |
|
|
/* */ |
314 |
|
|
/* CALLED BY */ |
315 |
|
|
/* */ |
316 |
|
|
/* GUIX Internal Code */ |
317 |
|
|
/* */ |
318 |
|
|
/* RELEASE HISTORY */ |
319 |
|
|
/* */ |
320 |
|
|
/* DATE NAME DESCRIPTION */ |
321 |
|
|
/* */ |
322 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
323 |
|
|
/* */ |
324 |
|
|
/**************************************************************************/ |
325 |
|
11051 |
static VOID _gx_display_driver_8bpp_rotated_pixelmap_transparent_write(GX_DRAW_CONTEXT *context, |
326 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
327 |
|
|
{ |
328 |
|
|
INT xval; |
329 |
|
|
INT yval; |
330 |
|
|
GX_UBYTE *putrow; |
331 |
|
|
GX_UBYTE *getrow; |
332 |
|
|
GX_UBYTE *put; |
333 |
|
|
GX_UBYTE inval; |
334 |
|
|
GX_CONST GX_UBYTE *get; |
335 |
|
|
|
336 |
|
11051 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
337 |
|
|
GX_RECTANGLE rotated_clip; |
338 |
|
|
|
339 |
|
11051 |
GX_SWAP_VALS(xpos, ypos); |
340 |
|
|
|
341 |
✓✓ |
11051 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
342 |
|
|
{ |
343 |
|
6052 |
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top; |
344 |
|
6052 |
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom; |
345 |
|
6052 |
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1); |
346 |
|
6052 |
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1); |
347 |
|
6052 |
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width); |
348 |
|
|
} |
349 |
|
|
else |
350 |
|
|
{ |
351 |
|
4999 |
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1); |
352 |
|
4999 |
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1); |
353 |
|
4999 |
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left; |
354 |
|
4999 |
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right; |
355 |
|
4999 |
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height); |
356 |
|
|
} |
357 |
|
|
|
358 |
|
11051 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
359 |
|
11051 |
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch; |
360 |
|
11051 |
putrow += rotated_clip.gx_rectangle_left; |
361 |
|
|
|
362 |
|
11051 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
363 |
|
11051 |
getrow += pixelmap -> gx_pixelmap_height * (rotated_clip.gx_rectangle_top - ypos); |
364 |
|
11051 |
getrow += (rotated_clip.gx_rectangle_left - xpos); |
365 |
|
|
|
366 |
✓✓ |
462141 |
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++) |
367 |
|
|
{ |
368 |
|
451090 |
put = putrow; |
369 |
|
451090 |
get = getrow; |
370 |
|
|
|
371 |
✓✓ |
109597233 |
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++) |
372 |
|
|
{ |
373 |
|
109146143 |
inval = *get++; |
374 |
✓✓ |
109146143 |
if (inval == pixelmap -> gx_pixelmap_transparent_color) |
375 |
|
|
{ |
376 |
|
58506085 |
put++; |
377 |
|
|
} |
378 |
|
|
else |
379 |
|
|
{ |
380 |
|
50640058 |
*put++ = inval; |
381 |
|
|
} |
382 |
|
|
} |
383 |
|
451090 |
putrow += context -> gx_draw_context_pitch; |
384 |
|
451090 |
getrow += pixelmap -> gx_pixelmap_height; |
385 |
|
|
} |
386 |
|
11051 |
} |
387 |
|
|
|
388 |
|
|
/**************************************************************************/ |
389 |
|
|
/* */ |
390 |
|
|
/* FUNCTION RELEASE */ |
391 |
|
|
/* */ |
392 |
|
|
/* _gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_ */ |
393 |
|
|
/* write */ |
394 |
|
|
/* PORTABLE C */ |
395 |
|
|
/* 6.1.4 */ |
396 |
|
|
/* AUTHOR */ |
397 |
|
|
/* */ |
398 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
399 |
|
|
/* */ |
400 |
|
|
/* DESCRIPTION */ |
401 |
|
|
/* */ |
402 |
|
|
/* Internal helper function that handles writing of compressed */ |
403 |
|
|
/* pixlemap file with alpha channel. */ |
404 |
|
|
/* */ |
405 |
|
|
/* INPUT */ |
406 |
|
|
/* */ |
407 |
|
|
/* context Drawing context */ |
408 |
|
|
/* xpos x-coord of top-left draw point*/ |
409 |
|
|
/* ypos y-coord of top-left draw point*/ |
410 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
411 |
|
|
/* */ |
412 |
|
|
/* OUTPUT */ |
413 |
|
|
/* */ |
414 |
|
|
/* None */ |
415 |
|
|
/* */ |
416 |
|
|
/* CALLS */ |
417 |
|
|
/* */ |
418 |
|
|
/* None */ |
419 |
|
|
/* */ |
420 |
|
|
/* CALLED BY */ |
421 |
|
|
/* */ |
422 |
|
|
/* GUIX Internal Code */ |
423 |
|
|
/* */ |
424 |
|
|
/* RELEASE HISTORY */ |
425 |
|
|
/* */ |
426 |
|
|
/* DATE NAME DESCRIPTION */ |
427 |
|
|
/* */ |
428 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
429 |
|
|
/* */ |
430 |
|
|
/**************************************************************************/ |
431 |
|
14769 |
static VOID _gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_write(GX_DRAW_CONTEXT *context, |
432 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
433 |
|
|
{ |
434 |
|
|
INT yval; |
435 |
|
|
INT xval; |
436 |
|
|
GX_CONST GX_UBYTE *get; |
437 |
|
|
GX_UBYTE *put; |
438 |
|
|
GX_UBYTE *putrow; |
439 |
|
|
GX_UBYTE count; |
440 |
|
14769 |
GX_UBYTE pixel = 0; |
441 |
|
14769 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
442 |
|
|
GX_RECTANGLE rotated_clip; |
443 |
|
|
|
444 |
|
14769 |
GX_SWAP_VALS(xpos, ypos); |
445 |
|
|
|
446 |
✓✓ |
14769 |
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW) |
447 |
|
|
{ |
448 |
|
7480 |
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top; |
449 |
|
7480 |
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom; |
450 |
|
7480 |
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1); |
451 |
|
7480 |
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1); |
452 |
|
7480 |
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width); |
453 |
|
|
} |
454 |
|
|
else |
455 |
|
|
{ |
456 |
|
7289 |
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1); |
457 |
|
7289 |
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1); |
458 |
|
7289 |
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left; |
459 |
|
7289 |
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right; |
460 |
|
7289 |
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height); |
461 |
|
|
} |
462 |
|
|
|
463 |
|
14769 |
get = (GX_CONST GX_UBYTE *)pixelmap -> gx_pixelmap_data; |
464 |
|
|
|
465 |
|
|
/* First, skip to the starting row. */ |
466 |
✓✓ |
15435 |
for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++) |
467 |
|
|
{ |
468 |
|
666 |
xval = 0; |
469 |
✓✓ |
1508 |
while (xval < pixelmap -> gx_pixelmap_height) |
470 |
|
|
{ |
471 |
|
842 |
count = *get++; |
472 |
|
|
|
473 |
✓✓ |
842 |
if (count & 0x80) |
474 |
|
|
{ |
475 |
|
796 |
count = (GX_UBYTE)((count & 0x7f) + 1); |
476 |
|
|
|
477 |
|
|
/* Skip repeated pixel value. */ |
478 |
|
796 |
get++; |
479 |
|
|
} |
480 |
|
|
else |
481 |
|
|
{ |
482 |
|
46 |
count++; |
483 |
|
|
|
484 |
|
|
/* Skip raw pixel values. */ |
485 |
|
46 |
get += count; |
486 |
|
|
} |
487 |
|
842 |
xval += count; |
488 |
|
|
} |
489 |
|
|
} |
490 |
|
|
|
491 |
|
|
/* Now we are on the first visible row, copy pixels until we get |
492 |
|
|
to the end of the last visible row. */ |
493 |
|
14769 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
494 |
|
14769 |
putrow += yval * context -> gx_draw_context_pitch; |
495 |
|
14769 |
putrow += xpos; |
496 |
|
|
|
497 |
✓✓ |
259395 |
while (yval <= rotated_clip.gx_rectangle_bottom) |
498 |
|
|
{ |
499 |
|
244626 |
put = putrow; |
500 |
|
244626 |
xval = xpos; |
501 |
✓✓ |
1190261 |
while (xval < (xpos + pixelmap -> gx_pixelmap_height)) |
502 |
|
|
{ |
503 |
|
945635 |
count = *get++; |
504 |
|
|
|
505 |
✓✓ |
945635 |
if (count & 0x80) |
506 |
|
|
{ |
507 |
|
|
|
508 |
|
|
/* Repeated value. */ |
509 |
|
457117 |
count = (GX_UBYTE)((count & 0x7f) + 1); |
510 |
|
457117 |
pixel = *get++; |
511 |
|
|
|
512 |
✓✓ |
457117 |
if (pixel == pixelmap -> gx_pixelmap_transparent_color) |
513 |
|
|
{ |
514 |
|
148857 |
put += count; |
515 |
|
148857 |
xval += count; |
516 |
|
|
} |
517 |
|
|
else |
518 |
|
|
{ |
519 |
✓✓ |
2680499 |
while (count--) |
520 |
|
|
{ |
521 |
✓✓ |
2372239 |
if (xval >= rotated_clip.gx_rectangle_left && |
522 |
✓✓ |
2370942 |
xval <= rotated_clip.gx_rectangle_right) |
523 |
|
|
{ |
524 |
|
2369560 |
*put = pixel; |
525 |
|
|
} |
526 |
|
2372239 |
put++; |
527 |
|
2372239 |
xval++; |
528 |
|
|
} |
529 |
|
|
} |
530 |
|
|
} |
531 |
|
|
else |
532 |
|
|
{ |
533 |
|
|
|
534 |
|
|
/* String of non-repeated values. */ |
535 |
|
488518 |
count++; |
536 |
|
|
|
537 |
✓✓ |
2779288 |
while (count--) |
538 |
|
|
{ |
539 |
|
2290770 |
pixel = *get++; |
540 |
|
|
|
541 |
✓✓ |
2290770 |
if (xval >= rotated_clip.gx_rectangle_left && |
542 |
✓✓ |
2290600 |
xval <= rotated_clip.gx_rectangle_right && |
543 |
✓✓ |
2290404 |
pixel != pixelmap -> gx_pixelmap_transparent_color) |
544 |
|
|
{ |
545 |
|
2075666 |
*put = pixel; |
546 |
|
|
} |
547 |
|
2290770 |
put++; |
548 |
|
2290770 |
xval++; |
549 |
|
|
} |
550 |
|
|
} |
551 |
|
|
} |
552 |
|
244626 |
putrow += context -> gx_draw_context_pitch; |
553 |
|
244626 |
yval++; |
554 |
|
|
} |
555 |
|
14769 |
} |
556 |
|
|
|
557 |
|
|
/**************************************************************************/ |
558 |
|
|
/* */ |
559 |
|
|
/* FUNCTION RELEASE */ |
560 |
|
|
/* */ |
561 |
|
|
/* _gx_display_driver_8bpp_rotated_pixelmap_draw PORTABLE C */ |
562 |
|
|
/* 6.1.4 */ |
563 |
|
|
/* AUTHOR */ |
564 |
|
|
/* */ |
565 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
566 |
|
|
/* */ |
567 |
|
|
/* DESCRIPTION */ |
568 |
|
|
/* */ |
569 |
|
|
/* 8bit screen driver pixelmap drawing function that handles */ |
570 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
571 |
|
|
/* */ |
572 |
|
|
/* INPUT */ |
573 |
|
|
/* */ |
574 |
|
|
/* context Drawing context */ |
575 |
|
|
/* xpos x-coord of top-left draw point*/ |
576 |
|
|
/* ypos y-coord of top-left draw point*/ |
577 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
578 |
|
|
/* */ |
579 |
|
|
/* OUTPUT */ |
580 |
|
|
/* */ |
581 |
|
|
/* None */ |
582 |
|
|
/* */ |
583 |
|
|
/* CALLS */ |
584 |
|
|
/* */ |
585 |
|
|
/* _gx_display_driver_8bit_rotated_pixelmap_compressed_write */ |
586 |
|
|
/* _gx_display_driver_8bit_rotated_pixelmap_compressed_transparent_ */ |
587 |
|
|
/* write */ |
588 |
|
|
/* _gx_display_driver_8bit_rotated_pixelmap_transparent_write */ |
589 |
|
|
/* _gx_display_driver_8bit_rotated_pixelmap_raw_write */ |
590 |
|
|
/* */ |
591 |
|
|
/* CALLED BY */ |
592 |
|
|
/* */ |
593 |
|
|
/* GUIX Internal Code */ |
594 |
|
|
/* */ |
595 |
|
|
/* RELEASE HISTORY */ |
596 |
|
|
/* */ |
597 |
|
|
/* DATE NAME DESCRIPTION */ |
598 |
|
|
/* */ |
599 |
|
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */ |
600 |
|
|
/* */ |
601 |
|
|
/**************************************************************************/ |
602 |
|
30524 |
VOID _gx_display_driver_8bpp_rotated_pixelmap_draw(GX_DRAW_CONTEXT *context, |
603 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
604 |
|
|
{ |
605 |
|
|
|
606 |
✓✓ |
30524 |
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_8BIT_PALETTE || |
607 |
✓✓ |
30523 |
(pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)) |
608 |
|
|
{ |
609 |
|
|
|
610 |
|
|
/* Wrong color format for this driver. */ |
611 |
|
2 |
return; |
612 |
|
|
} |
613 |
|
|
|
614 |
✓✓ |
30522 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
615 |
|
|
{ |
616 |
✓✓ |
25820 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
617 |
|
|
{ |
618 |
|
|
|
619 |
|
|
/* Has both compression and transparent. */ |
620 |
|
14769 |
_gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_write(context, xpos, ypos, pixelmap); |
621 |
|
|
} |
622 |
|
|
else |
623 |
|
|
{ |
624 |
|
|
|
625 |
|
|
/* Transparent, no compression. */ |
626 |
|
11051 |
_gx_display_driver_8bpp_rotated_pixelmap_transparent_write(context, xpos, ypos, pixelmap); |
627 |
|
|
} |
628 |
|
|
} |
629 |
|
|
else |
630 |
|
|
{ |
631 |
✓✓ |
4702 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
632 |
|
|
{ |
633 |
|
|
|
634 |
|
|
/* Compressed with no transparency. */ |
635 |
|
4486 |
_gx_display_driver_8bpp_rotated_pixelmap_compressed_write(context, xpos, ypos, pixelmap); |
636 |
|
|
} |
637 |
|
|
else |
638 |
|
|
{ |
639 |
|
|
|
640 |
|
|
/* No compression or transaprency. */ |
641 |
|
216 |
_gx_display_driver_8bpp_rotated_pixelmap_raw_write(context, xpos, ypos, pixelmap); |
642 |
|
|
} |
643 |
|
|
} |
644 |
|
|
} |
645 |
|
|
|