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_16bpp_pixelmap_raw_blend PORTABLE C */ |
35 |
|
|
/* 6.1 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
43 |
|
|
/* pixlemap file */ |
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 |
|
|
/* alpha blending value 0 to 255 */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* [gx_display_driver_pixel_blend] Display driver basic pixel */ |
60 |
|
|
/* blend function */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* GUIX Internal Code */ |
65 |
|
|
/* */ |
66 |
|
|
/* RELEASE HISTORY */ |
67 |
|
|
/* */ |
68 |
|
|
/* DATE NAME DESCRIPTION */ |
69 |
|
|
/* */ |
70 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
71 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
72 |
|
|
/* resulting in version 6.1 */ |
73 |
|
|
/* */ |
74 |
|
|
/**************************************************************************/ |
75 |
|
6 |
static VOID _gx_display_driver_16bpp_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
76 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
77 |
|
|
{ |
78 |
|
|
int xval; |
79 |
|
|
int yval; |
80 |
|
|
USHORT *get; |
81 |
|
|
USHORT *getrow; |
82 |
|
|
USHORT pixel; |
83 |
|
|
|
84 |
|
6 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
85 |
|
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
86 |
|
|
|
87 |
|
6 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
88 |
✓✓ |
6 |
if (!blend_func) |
89 |
|
|
{ |
90 |
|
1 |
return; |
91 |
|
|
} |
92 |
|
|
|
93 |
|
5 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data + (INT)sizeof(USHORT) * pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos)); |
94 |
|
5 |
getrow += (clip -> gx_rectangle_left - xpos); |
95 |
✓✓ |
1011 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
96 |
|
|
{ |
97 |
|
1006 |
get = getrow; |
98 |
✓✓ |
163640 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
99 |
|
|
{ |
100 |
|
162634 |
pixel = *get++; |
101 |
|
162634 |
blend_func(context, xval, yval, pixel, alpha); |
102 |
|
|
} |
103 |
|
1006 |
getrow += pixelmap -> gx_pixelmap_width; |
104 |
|
|
} |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
/**************************************************************************/ |
108 |
|
|
/* */ |
109 |
|
|
/* FUNCTION RELEASE */ |
110 |
|
|
/* */ |
111 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend PORTABLE C */ |
112 |
|
|
/* 6.1 */ |
113 |
|
|
/* AUTHOR */ |
114 |
|
|
/* */ |
115 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
116 |
|
|
/* */ |
117 |
|
|
/* DESCRIPTION */ |
118 |
|
|
/* */ |
119 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
120 |
|
|
/* pixelmap file with alpha channel. */ |
121 |
|
|
/* */ |
122 |
|
|
/* INPUT */ |
123 |
|
|
/* */ |
124 |
|
|
/* context Drawing context */ |
125 |
|
|
/* xpos x-coord of top-left draw point*/ |
126 |
|
|
/* ypos y-coord of top-left draw point*/ |
127 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
128 |
|
|
/* alpha blending value 0 to 255 */ |
129 |
|
|
/* */ |
130 |
|
|
/* OUTPUT */ |
131 |
|
|
/* */ |
132 |
|
|
/* None */ |
133 |
|
|
/* */ |
134 |
|
|
/* CALLS */ |
135 |
|
|
/* */ |
136 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
137 |
|
|
/* blend function */ |
138 |
|
|
/* CALLED BY */ |
139 |
|
|
/* */ |
140 |
|
|
/* GUIX Internal Code */ |
141 |
|
|
/* */ |
142 |
|
|
/* RELEASE HISTORY */ |
143 |
|
|
/* */ |
144 |
|
|
/* DATE NAME DESCRIPTION */ |
145 |
|
|
/* */ |
146 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
147 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
148 |
|
|
/* resulting in version 6.1 */ |
149 |
|
|
/* */ |
150 |
|
|
/**************************************************************************/ |
151 |
|
257 |
static VOID _gx_display_driver_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, |
152 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
153 |
|
|
{ |
154 |
|
|
INT skipcount; |
155 |
|
|
INT xval; |
156 |
|
|
INT yval; |
157 |
|
|
USHORT *getrow; |
158 |
|
|
GX_UBYTE *getrowalpha; |
159 |
|
|
USHORT *get; |
160 |
|
|
USHORT pixel; |
161 |
|
|
GX_UBYTE *getalpha; |
162 |
|
|
INT combined_alpha; |
163 |
|
|
GX_UBYTE internal_alpha; |
164 |
|
|
|
165 |
|
257 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
166 |
|
|
void (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
167 |
|
|
|
168 |
|
257 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
169 |
✓✓ |
257 |
if (blend_func == GX_NULL) |
170 |
|
|
{ |
171 |
|
1 |
return; |
172 |
|
|
} |
173 |
|
|
|
174 |
|
|
|
175 |
|
|
/* calculate how many pixels to skip */ |
176 |
|
256 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
177 |
|
256 |
skipcount += (clip -> gx_rectangle_left - xpos); |
178 |
|
256 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
179 |
|
256 |
getrow += skipcount; |
180 |
|
|
|
181 |
|
256 |
getrowalpha = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data); |
182 |
|
256 |
getrowalpha += skipcount; |
183 |
|
|
|
184 |
✓✓ |
34043 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
185 |
|
|
{ |
186 |
|
33787 |
get = getrow; |
187 |
|
33787 |
getalpha = getrowalpha; |
188 |
|
|
|
189 |
✓✓ |
4379524 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
190 |
|
|
{ |
191 |
|
4345737 |
internal_alpha = *getalpha++; |
192 |
✓✓ |
4345737 |
if (internal_alpha) |
193 |
|
|
{ |
194 |
|
3114153 |
combined_alpha = internal_alpha * alpha; |
195 |
|
3114153 |
combined_alpha /= 255; |
196 |
|
3114153 |
pixel = *get; |
197 |
|
3114153 |
blend_func(context, xval, yval, pixel, (GX_UBYTE)combined_alpha); |
198 |
|
|
} |
199 |
|
4345737 |
get++; |
200 |
|
|
} |
201 |
|
33787 |
getrow += pixelmap -> gx_pixelmap_width; |
202 |
|
33787 |
getrowalpha += pixelmap -> gx_pixelmap_width; |
203 |
|
|
} |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
/**************************************************************************/ |
207 |
|
|
/* */ |
208 |
|
|
/* FUNCTION RELEASE */ |
209 |
|
|
/* */ |
210 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
211 |
|
|
/* PORTABLE C */ |
212 |
|
|
/* 6.1 */ |
213 |
|
|
/* AUTHOR */ |
214 |
|
|
/* */ |
215 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
216 |
|
|
/* */ |
217 |
|
|
/* DESCRIPTION */ |
218 |
|
|
/* */ |
219 |
|
|
/* Internal helper function that handles blending of compressed */ |
220 |
|
|
/* pixlemap file . */ |
221 |
|
|
/* */ |
222 |
|
|
/* INPUT */ |
223 |
|
|
/* */ |
224 |
|
|
/* context Drawing context */ |
225 |
|
|
/* xpos x-coord of top-left draw point*/ |
226 |
|
|
/* ypos y-coord of top-left draw point*/ |
227 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
228 |
|
|
/* alpha blending value 0 to 255 */ |
229 |
|
|
/* */ |
230 |
|
|
/* OUTPUT */ |
231 |
|
|
/* */ |
232 |
|
|
/* None */ |
233 |
|
|
/* */ |
234 |
|
|
/* CALLS */ |
235 |
|
|
/* */ |
236 |
|
|
/* [gx_display_driver_pixel_blend] Display driver basic pixel */ |
237 |
|
|
/* blend function */ |
238 |
|
|
/* */ |
239 |
|
|
/* CALLED BY */ |
240 |
|
|
/* */ |
241 |
|
|
/* GUIX Internal Code */ |
242 |
|
|
/* */ |
243 |
|
|
/* RELEASE HISTORY */ |
244 |
|
|
/* */ |
245 |
|
|
/* DATE NAME DESCRIPTION */ |
246 |
|
|
/* */ |
247 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
248 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
249 |
|
|
/* resulting in version 6.1 */ |
250 |
|
|
/* */ |
251 |
|
|
/**************************************************************************/ |
252 |
|
6 |
static VOID _gx_display_driver_16bpp_pixelmap_compressed_blend(GX_DRAW_CONTEXT *context, |
253 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
254 |
|
|
{ |
255 |
|
|
int yval; |
256 |
|
|
int xval; |
257 |
|
|
GX_CONST USHORT *get; |
258 |
|
|
USHORT count; |
259 |
|
|
USHORT pixel; |
260 |
|
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha); |
261 |
|
6 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
262 |
|
|
|
263 |
|
6 |
blend_func = context -> gx_draw_context_display -> gx_display_driver_pixel_blend; |
264 |
|
|
|
265 |
✓✓ |
6 |
if (!blend_func) |
266 |
|
|
{ |
267 |
|
1 |
return; |
268 |
|
|
} |
269 |
|
|
|
270 |
|
5 |
get = (GX_CONST USHORT *)pixelmap -> gx_pixelmap_data; |
271 |
|
|
|
272 |
|
|
/* compressed with no alpha is a two-byte count and two-byte pixel value */ |
273 |
|
|
|
274 |
|
|
/* first, skip to the starting row */ |
275 |
✓✓ |
83 |
for (yval = ypos; yval < clip -> gx_rectangle_top; yval++) |
276 |
|
|
{ |
277 |
|
78 |
xval = 0; |
278 |
✓✓ |
6846 |
while (xval < pixelmap -> gx_pixelmap_width) |
279 |
|
|
{ |
280 |
|
6768 |
count = *get++; |
281 |
|
|
|
282 |
✓✓ |
6768 |
if (count & 0x8000) |
283 |
|
|
{ |
284 |
|
3656 |
count = (USHORT)((count & 0x7fff) + 1); |
285 |
|
3656 |
get++; /* skip repeated pixel value */ |
286 |
|
|
} |
287 |
|
|
else |
288 |
|
|
{ |
289 |
|
3112 |
count++; |
290 |
|
3112 |
get += count; /* skip raw pixel values */ |
291 |
|
|
} |
292 |
|
6768 |
xval += count; |
293 |
|
|
} |
294 |
|
|
} |
295 |
|
|
|
296 |
|
|
|
297 |
✓✓ |
1390 |
while (yval <= clip -> gx_rectangle_bottom) |
298 |
|
|
{ |
299 |
|
1385 |
xval = xpos; |
300 |
|
|
|
301 |
✓✓ |
121659 |
while (xval < xpos + pixelmap -> gx_pixelmap_width) |
302 |
|
|
{ |
303 |
|
120274 |
count = *get++; |
304 |
|
|
|
305 |
✓✓ |
120274 |
if (count & 0x8000) |
306 |
|
|
{ |
307 |
|
|
/* repeated value */ |
308 |
|
65864 |
count = (USHORT)((count & 0x7fff) + 1); |
309 |
|
65864 |
pixel = *get++; |
310 |
|
|
|
311 |
✓✓ |
387114 |
while (count--) |
312 |
|
|
{ |
313 |
✓✓ |
321250 |
if (xval >= clip -> gx_rectangle_left && |
314 |
✓✓ |
309322 |
xval <= clip -> gx_rectangle_right) |
315 |
|
|
{ |
316 |
|
78355 |
blend_func(context, xval, yval, pixel, alpha); |
317 |
|
|
} |
318 |
|
321250 |
xval++; |
319 |
|
|
} |
320 |
|
|
} |
321 |
|
|
else |
322 |
|
|
{ |
323 |
|
|
/* string of non-repeated values */ |
324 |
|
54410 |
count++; |
325 |
✓✓ |
956115 |
while (count--) |
326 |
|
|
{ |
327 |
✓✓ |
901705 |
if (xval >= clip -> gx_rectangle_left && |
328 |
✓✓ |
878497 |
xval <= clip -> gx_rectangle_right) |
329 |
|
|
{ |
330 |
|
263924 |
pixel = *get; |
331 |
|
263924 |
blend_func(context, xval, yval, pixel, alpha); |
332 |
|
|
} |
333 |
|
901705 |
get++; |
334 |
|
901705 |
xval++; |
335 |
|
|
} |
336 |
|
|
} |
337 |
|
|
} |
338 |
|
1385 |
yval++; |
339 |
|
|
} |
340 |
|
|
} |
341 |
|
|
|
342 |
|
|
/**************************************************************************/ |
343 |
|
|
/* */ |
344 |
|
|
/* FUNCTION RELEASE */ |
345 |
|
|
/* */ |
346 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_raw_blend PORTABLE C */ |
347 |
|
|
/* 6.1 */ |
348 |
|
|
/* AUTHOR */ |
349 |
|
|
/* */ |
350 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
351 |
|
|
/* */ |
352 |
|
|
/* DESCRIPTION */ |
353 |
|
|
/* */ |
354 |
|
|
/* Internal helper function that handles blending of raw pixlemap */ |
355 |
|
|
/* file without transparent for palette pixelmap. */ |
356 |
|
|
/* */ |
357 |
|
|
/* INPUT */ |
358 |
|
|
/* */ |
359 |
|
|
/* context Drawing context */ |
360 |
|
|
/* xpos x-coord of top-left draw point*/ |
361 |
|
|
/* ypos y-coord of top-left draw point*/ |
362 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
363 |
|
|
/* alpha blending value 0 to 255 */ |
364 |
|
|
/* */ |
365 |
|
|
/* OUTPUT */ |
366 |
|
|
/* */ |
367 |
|
|
/* None */ |
368 |
|
|
/* */ |
369 |
|
|
/* CALLS */ |
370 |
|
|
/* */ |
371 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
372 |
|
|
/* blend function */ |
373 |
|
|
/* */ |
374 |
|
|
/* CALLED BY */ |
375 |
|
|
/* */ |
376 |
|
|
/* GUIX Internal Code */ |
377 |
|
|
/* */ |
378 |
|
|
/* RELEASE HISTORY */ |
379 |
|
|
/* */ |
380 |
|
|
/* DATE NAME DESCRIPTION */ |
381 |
|
|
/* */ |
382 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
383 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
384 |
|
|
/* resulting in version 6.1 */ |
385 |
|
|
/* */ |
386 |
|
|
/**************************************************************************/ |
387 |
|
2 |
static VOID _gx_display_driver_565rgb_palette_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
388 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
389 |
|
|
{ |
390 |
|
|
INT xval; |
391 |
|
|
INT yval; |
392 |
|
|
GX_UBYTE *getrow; |
393 |
|
|
GX_CONST GX_UBYTE *get; |
394 |
|
|
GX_COLOR *palette; |
395 |
|
|
USHORT pixel; |
396 |
|
|
GX_UBYTE r; |
397 |
|
|
GX_UBYTE g; |
398 |
|
|
GX_UBYTE b; |
399 |
|
|
|
400 |
|
2 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
401 |
|
|
|
402 |
|
2 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
403 |
|
2 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
404 |
|
2 |
getrow += (clip -> gx_rectangle_left - xpos); |
405 |
|
|
|
406 |
|
2 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
407 |
|
|
|
408 |
✓✓ |
530 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
409 |
|
|
{ |
410 |
|
528 |
get = getrow; |
411 |
|
|
|
412 |
✓✓ |
127776 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
413 |
|
|
{ |
414 |
|
127248 |
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3); |
415 |
|
127248 |
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2); |
416 |
|
127248 |
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get++]) >> 3); |
417 |
|
127248 |
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b); |
418 |
|
127248 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha); |
419 |
|
|
} |
420 |
|
528 |
getrow += pixelmap -> gx_pixelmap_width; |
421 |
|
|
} |
422 |
|
2 |
} |
423 |
|
|
|
424 |
|
|
/**************************************************************************/ |
425 |
|
|
/* */ |
426 |
|
|
/* FUNCTION RELEASE */ |
427 |
|
|
/* */ |
428 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_transparent_blend */ |
429 |
|
|
/* PORTABLE C */ |
430 |
|
|
/* 6.1 */ |
431 |
|
|
/* AUTHOR */ |
432 |
|
|
/* */ |
433 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
434 |
|
|
/* */ |
435 |
|
|
/* DESCRIPTION */ |
436 |
|
|
/* */ |
437 |
|
|
/* Internal helper function that handles blending of raw pixlemap */ |
438 |
|
|
/* file with transparent for palette pixelmap. */ |
439 |
|
|
/* */ |
440 |
|
|
/* INPUT */ |
441 |
|
|
/* */ |
442 |
|
|
/* context Drawing context */ |
443 |
|
|
/* xpos x-coord of top-left draw point*/ |
444 |
|
|
/* ypos y-coord of top-left draw point*/ |
445 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
446 |
|
|
/* alpha blending value 0 to 255 */ |
447 |
|
|
/* */ |
448 |
|
|
/* OUTPUT */ |
449 |
|
|
/* */ |
450 |
|
|
/* None */ |
451 |
|
|
/* */ |
452 |
|
|
/* CALLS */ |
453 |
|
|
/* */ |
454 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
455 |
|
|
/* blend function */ |
456 |
|
|
/* */ |
457 |
|
|
/* CALLED BY */ |
458 |
|
|
/* */ |
459 |
|
|
/* GUIX Internal Code */ |
460 |
|
|
/* */ |
461 |
|
|
/* RELEASE HISTORY */ |
462 |
|
|
/* */ |
463 |
|
|
/* DATE NAME DESCRIPTION */ |
464 |
|
|
/* */ |
465 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
466 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
467 |
|
|
/* resulting in version 6.1 */ |
468 |
|
|
/* */ |
469 |
|
|
/**************************************************************************/ |
470 |
|
2 |
static VOID _gx_display_driver_565rgb_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT *context, |
471 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
472 |
|
|
{ |
473 |
|
|
INT xval; |
474 |
|
|
INT yval; |
475 |
|
|
GX_UBYTE *getrow; |
476 |
|
|
GX_CONST GX_UBYTE *get; |
477 |
|
|
GX_COLOR *palette; |
478 |
|
|
USHORT pixel; |
479 |
|
|
GX_UBYTE r; |
480 |
|
|
GX_UBYTE g; |
481 |
|
|
GX_UBYTE b; |
482 |
|
|
|
483 |
|
2 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
484 |
|
|
|
485 |
|
2 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
486 |
|
2 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
487 |
|
2 |
getrow += (clip -> gx_rectangle_left - xpos); |
488 |
|
|
|
489 |
|
2 |
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data; |
490 |
|
|
|
491 |
|
|
|
492 |
✓✓ |
498 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
493 |
|
|
{ |
494 |
|
496 |
get = getrow; |
495 |
|
|
|
496 |
✓✓ |
86304 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
497 |
|
|
{ |
498 |
✓✓ |
85808 |
if ((*get) != pixelmap -> gx_pixelmap_transparent_color) |
499 |
|
|
{ |
500 |
|
66228 |
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3); |
501 |
|
66228 |
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2); |
502 |
|
66228 |
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get]) >> 3); |
503 |
|
66228 |
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b); |
504 |
|
66228 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha); |
505 |
|
|
} |
506 |
|
85808 |
get++; |
507 |
|
|
} |
508 |
|
496 |
getrow += pixelmap -> gx_pixelmap_width; |
509 |
|
|
} |
510 |
|
2 |
} |
511 |
|
|
|
512 |
|
|
/**************************************************************************/ |
513 |
|
|
/* */ |
514 |
|
|
/* FUNCTION RELEASE */ |
515 |
|
|
/* */ |
516 |
|
|
/* _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend */ |
517 |
|
|
/* PORTABLE C */ |
518 |
|
|
/* 6.1 */ |
519 |
|
|
/* AUTHOR */ |
520 |
|
|
/* */ |
521 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
522 |
|
|
/* */ |
523 |
|
|
/* DESCRIPTION */ |
524 |
|
|
/* */ |
525 |
|
|
/* Internal helper function that handles blending of uncompressed */ |
526 |
|
|
/* pixlemap file with alpha channel of 4444argb format. */ |
527 |
|
|
/* */ |
528 |
|
|
/* INPUT */ |
529 |
|
|
/* */ |
530 |
|
|
/* context Drawing context */ |
531 |
|
|
/* xpos x-coord of top-left draw point*/ |
532 |
|
|
/* ypos y-coord of top-left draw point*/ |
533 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
534 |
|
|
/* alpha blending value 0 to 255 */ |
535 |
|
|
/* */ |
536 |
|
|
/* OUTPUT */ |
537 |
|
|
/* */ |
538 |
|
|
/* None */ |
539 |
|
|
/* */ |
540 |
|
|
/* CALLS */ |
541 |
|
|
/* */ |
542 |
|
|
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */ |
543 |
|
|
/* blend function */ |
544 |
|
|
/* */ |
545 |
|
|
/* CALLED BY */ |
546 |
|
|
/* */ |
547 |
|
|
/* GUIX Internal Code */ |
548 |
|
|
/* */ |
549 |
|
|
/* RELEASE HISTORY */ |
550 |
|
|
/* */ |
551 |
|
|
/* DATE NAME DESCRIPTION */ |
552 |
|
|
/* */ |
553 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
554 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
555 |
|
|
/* resulting in version 6.1 */ |
556 |
|
|
/* */ |
557 |
|
|
/**************************************************************************/ |
558 |
|
4 |
static VOID _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, |
559 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
560 |
|
|
{ |
561 |
|
|
INT skipcount; |
562 |
|
|
INT xval; |
563 |
|
|
INT yval; |
564 |
|
|
USHORT *getrow; |
565 |
|
|
GX_CONST USHORT *get; |
566 |
|
|
UCHAR alpha_value; |
567 |
|
|
GX_UBYTE combined_alpha; |
568 |
|
|
USHORT pixel; |
569 |
|
|
|
570 |
|
4 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
571 |
|
|
|
572 |
|
|
/* calculate how many pixels to skip */ |
573 |
|
4 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
574 |
|
4 |
skipcount += (clip -> gx_rectangle_left - xpos); |
575 |
|
4 |
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data); |
576 |
|
4 |
getrow += skipcount; |
577 |
|
|
|
578 |
✓✓ |
622 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
579 |
|
|
{ |
580 |
|
618 |
get = getrow; |
581 |
|
|
|
582 |
✓✓ |
95942 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
583 |
|
|
{ |
584 |
|
|
/* 0x000f- -> b , 0x00f0- -> g , 0x0f00- -> r , 0xf000- -> a */ |
585 |
|
|
/*4444bgra - -> 565rgb*/ |
586 |
|
95324 |
alpha_value = (UCHAR)(((*get) & 0xf000) >> 8); |
587 |
✓✓ |
95324 |
if (alpha_value) |
588 |
|
|
{ |
589 |
|
88410 |
alpha_value = alpha_value | (alpha_value >> 4); |
590 |
|
88410 |
pixel = (USHORT)((((*get) & 0x0f00) << 4) | (((*get) & 0x00f0) << 3) | (((*get) & 0x000f) << 1)); |
591 |
|
88410 |
combined_alpha = (GX_UBYTE)(alpha * alpha_value / 255); |
592 |
|
88410 |
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, combined_alpha); |
593 |
|
|
} |
594 |
|
95324 |
get++; |
595 |
|
|
} |
596 |
|
618 |
getrow += pixelmap -> gx_pixelmap_width; |
597 |
|
|
} |
598 |
|
4 |
} |
599 |
|
|
|
600 |
|
|
/**************************************************************************/ |
601 |
|
|
/* */ |
602 |
|
|
/* FUNCTION RELEASE */ |
603 |
|
|
/* */ |
604 |
|
|
/* _gx_display_driver_565rgb_pixelmap_blend PORTABLE C */ |
605 |
|
|
/* 6.1 */ |
606 |
|
|
/* AUTHOR */ |
607 |
|
|
/* */ |
608 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
609 |
|
|
/* */ |
610 |
|
|
/* DESCRIPTION */ |
611 |
|
|
/* */ |
612 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
613 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
614 |
|
|
/* */ |
615 |
|
|
/* INPUT */ |
616 |
|
|
/* */ |
617 |
|
|
/* context Drawing context */ |
618 |
|
|
/* xpos x-coord of top-left draw point*/ |
619 |
|
|
/* ypos y-coord of top-left draw point*/ |
620 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
621 |
|
|
/* alpha blending value 0 to 255 */ |
622 |
|
|
/* */ |
623 |
|
|
/* OUTPUT */ |
624 |
|
|
/* */ |
625 |
|
|
/* None */ |
626 |
|
|
/* */ |
627 |
|
|
/* CALLS */ |
628 |
|
|
/* */ |
629 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_transparent_blend */ |
630 |
|
|
/* _gx_display_driver_565rgb_palette_pixelmap_raw_blend */ |
631 |
|
|
/* _gx_display_driver_565rgb_4444argb_pixelmap_raw_blend */ |
632 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend */ |
633 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
634 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
635 |
|
|
/* */ |
636 |
|
|
/* CALLED BY */ |
637 |
|
|
/* */ |
638 |
|
|
/* GUIX Internal Code */ |
639 |
|
|
/* */ |
640 |
|
|
/* RELEASE HISTORY */ |
641 |
|
|
/* */ |
642 |
|
|
/* DATE NAME DESCRIPTION */ |
643 |
|
|
/* */ |
644 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
645 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
646 |
|
|
/* resulting in version 6.1 */ |
647 |
|
|
/* */ |
648 |
|
|
/**************************************************************************/ |
649 |
|
271 |
VOID _gx_display_driver_565rgb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
650 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
651 |
|
|
{ |
652 |
✓✓ |
271 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
653 |
|
|
{ |
654 |
✓✓ |
3 |
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_565RGB) |
655 |
|
|
{ |
656 |
|
1 |
return; |
657 |
|
|
} |
658 |
|
|
} |
659 |
|
|
|
660 |
✓✓✓✓
|
270 |
switch (pixelmap -> gx_pixelmap_format) |
661 |
|
|
{ |
662 |
|
5 |
case GX_COLOR_FORMAT_8BIT_PALETTE: |
663 |
✓✓ |
5 |
if (pixelmap -> gx_pixelmap_aux_data == GX_NULL) |
664 |
|
|
{ |
665 |
|
1 |
break; |
666 |
|
|
} |
667 |
|
|
|
668 |
✓✓ |
4 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
669 |
|
|
{ |
670 |
|
2 |
_gx_display_driver_565rgb_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha); |
671 |
|
|
} |
672 |
|
|
else |
673 |
|
|
{ |
674 |
|
2 |
_gx_display_driver_565rgb_palette_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
675 |
|
|
} |
676 |
|
4 |
break; |
677 |
|
|
|
678 |
|
4 |
case GX_COLOR_FORMAT_4444ARGB: |
679 |
|
4 |
_gx_display_driver_565rgb_4444argb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
680 |
|
4 |
break; |
681 |
|
|
|
682 |
|
260 |
case GX_COLOR_FORMAT_565RGB: |
683 |
✓✓ |
260 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
684 |
|
|
{ |
685 |
|
256 |
_gx_display_driver_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
686 |
|
|
} |
687 |
|
|
else |
688 |
|
|
{ |
689 |
✓✓ |
4 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
690 |
|
|
{ |
691 |
|
2 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
692 |
|
|
} |
693 |
|
|
else |
694 |
|
|
{ |
695 |
|
2 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
696 |
|
|
} |
697 |
|
|
} |
698 |
|
260 |
break; |
699 |
|
|
|
700 |
|
1 |
default: |
701 |
|
1 |
return; |
702 |
|
|
} |
703 |
|
|
} |
704 |
|
|
|
705 |
|
|
/**************************************************************************/ |
706 |
|
|
/* */ |
707 |
|
|
/* FUNCTION RELEASE */ |
708 |
|
|
/* */ |
709 |
|
|
/* _gx_display_driver_1555xrgb_pixelmap_blend PORTABLE C */ |
710 |
|
|
/* 6.1 */ |
711 |
|
|
/* AUTHOR */ |
712 |
|
|
/* */ |
713 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
714 |
|
|
/* */ |
715 |
|
|
/* DESCRIPTION */ |
716 |
|
|
/* */ |
717 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
718 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
719 |
|
|
/* */ |
720 |
|
|
/* INPUT */ |
721 |
|
|
/* */ |
722 |
|
|
/* context Drawing context */ |
723 |
|
|
/* xpos x-coord of top-left draw point*/ |
724 |
|
|
/* ypos y-coord of top-left draw point*/ |
725 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
726 |
|
|
/* alpha blending value 0 to 255 */ |
727 |
|
|
/* */ |
728 |
|
|
/* OUTPUT */ |
729 |
|
|
/* */ |
730 |
|
|
/* None */ |
731 |
|
|
/* */ |
732 |
|
|
/* CALLS */ |
733 |
|
|
/* */ |
734 |
|
|
/* _gx_display_driver_565rgb_pixelmap_alpha_blend */ |
735 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
736 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
737 |
|
|
/* */ |
738 |
|
|
/* CALLED BY */ |
739 |
|
|
/* */ |
740 |
|
|
/* GUIX Internal Code */ |
741 |
|
|
/* */ |
742 |
|
|
/* RELEASE HISTORY */ |
743 |
|
|
/* */ |
744 |
|
|
/* DATE NAME DESCRIPTION */ |
745 |
|
|
/* */ |
746 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
747 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
748 |
|
|
/* resulting in version 6.1 */ |
749 |
|
|
/* */ |
750 |
|
|
/**************************************************************************/ |
751 |
|
4 |
VOID _gx_display_driver_1555xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
752 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
753 |
|
|
{ |
754 |
✓✓ |
4 |
switch (pixelmap -> gx_pixelmap_format) |
755 |
|
|
{ |
756 |
|
3 |
case GX_COLOR_FORMAT_1555XRGB: |
757 |
✓✓ |
3 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
758 |
|
|
{ |
759 |
|
1 |
_gx_display_driver_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha); |
760 |
|
|
} |
761 |
|
|
else |
762 |
|
|
{ |
763 |
✓✓ |
2 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
764 |
|
|
{ |
765 |
|
1 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
766 |
|
|
} |
767 |
|
|
else |
768 |
|
|
{ |
769 |
|
1 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
770 |
|
|
} |
771 |
|
|
} |
772 |
|
3 |
break; |
773 |
|
|
|
774 |
|
1 |
default: |
775 |
|
1 |
return; |
776 |
|
|
} |
777 |
|
|
} |
778 |
|
|
|
779 |
|
|
/**************************************************************************/ |
780 |
|
|
/* */ |
781 |
|
|
/* FUNCTION RELEASE */ |
782 |
|
|
/* */ |
783 |
|
|
/* _gx_display_driver_4444argb_pixelmap_blend PORTABLE C */ |
784 |
|
|
/* 6.1 */ |
785 |
|
|
/* AUTHOR */ |
786 |
|
|
/* */ |
787 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
788 |
|
|
/* */ |
789 |
|
|
/* DESCRIPTION */ |
790 |
|
|
/* */ |
791 |
|
|
/* Driver entry point for pixelmap blending function that handles */ |
792 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
793 |
|
|
/* */ |
794 |
|
|
/* INPUT */ |
795 |
|
|
/* */ |
796 |
|
|
/* context Drawing context */ |
797 |
|
|
/* xpos x-coord of top-left draw point*/ |
798 |
|
|
/* ypos y-coord of top-left draw point*/ |
799 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
800 |
|
|
/* alpha blending value 0 to 255 */ |
801 |
|
|
/* */ |
802 |
|
|
/* OUTPUT */ |
803 |
|
|
/* */ |
804 |
|
|
/* None */ |
805 |
|
|
/* */ |
806 |
|
|
/* CALLS */ |
807 |
|
|
/* */ |
808 |
|
|
/* _gx_display_driver_16bpp_pixelmap_compressed_blend */ |
809 |
|
|
/* _gx_display_driver_16bpp_pixelmap_raw_blend */ |
810 |
|
|
/* */ |
811 |
|
|
/* CALLED BY */ |
812 |
|
|
/* */ |
813 |
|
|
/* GUIX Internal Code */ |
814 |
|
|
/* */ |
815 |
|
|
/* RELEASE HISTORY */ |
816 |
|
|
/* */ |
817 |
|
|
/* DATE NAME DESCRIPTION */ |
818 |
|
|
/* */ |
819 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
820 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
821 |
|
|
/* resulting in version 6.1 */ |
822 |
|
|
/* */ |
823 |
|
|
/**************************************************************************/ |
824 |
|
8 |
VOID _gx_display_driver_4444argb_pixelmap_blend(GX_DRAW_CONTEXT *context, |
825 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
826 |
|
|
{ |
827 |
✓✓ |
8 |
switch (pixelmap -> gx_pixelmap_format) |
828 |
|
|
{ |
829 |
|
7 |
case GX_COLOR_FORMAT_4444ARGB: |
830 |
✓✓ |
7 |
if (!(pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)) |
831 |
|
|
{ |
832 |
✓✓ |
6 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
833 |
|
|
{ |
834 |
|
3 |
_gx_display_driver_16bpp_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha); |
835 |
|
|
} |
836 |
|
|
else |
837 |
|
|
{ |
838 |
|
3 |
_gx_display_driver_16bpp_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha); |
839 |
|
|
} |
840 |
|
|
} |
841 |
|
7 |
break; |
842 |
|
|
|
843 |
|
1 |
default: |
844 |
|
1 |
return; |
845 |
|
|
} |
846 |
|
|
} |
847 |
|
|
|