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 |
|
|
#include "gx_context.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_display_driver_332rgb_pixelmap_raw_write PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
45 |
|
|
/* pixlemap file without alpha channel. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* context Drawing context */ |
50 |
|
|
/* xpos x-coord of top-left draw point*/ |
51 |
|
|
/* ypos y-coord of top-left draw point*/ |
52 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* None */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* None */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_display_driver_332rgb_pixelmap_draw */ |
65 |
|
|
/* */ |
66 |
|
|
/**************************************************************************/ |
67 |
|
11907 |
static VOID _gx_display_driver_332rgb_pixelmap_raw_write(GX_DRAW_CONTEXT *context, |
68 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
69 |
|
|
{ |
70 |
|
|
INT xval; |
71 |
|
|
INT yval; |
72 |
|
|
INT width; |
73 |
|
|
GX_UBYTE *putrow; |
74 |
|
|
GX_UBYTE *getrow; |
75 |
|
|
GX_UBYTE *put; |
76 |
|
|
GX_CONST GX_UBYTE *get; |
77 |
|
|
|
78 |
|
11907 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
79 |
|
|
|
80 |
|
11907 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
81 |
|
11907 |
putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch; |
82 |
|
11907 |
putrow += clip -> gx_rectangle_left; |
83 |
|
|
|
84 |
|
11907 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
85 |
|
11907 |
getrow += pixelmap -> gx_pixelmap_width * (clip -> gx_rectangle_top - ypos); |
86 |
|
11907 |
getrow += (clip -> gx_rectangle_left - xpos); |
87 |
|
|
|
88 |
|
11907 |
width = clip -> gx_rectangle_right - clip -> gx_rectangle_left + 1; |
89 |
|
|
|
90 |
✓✓ |
237757 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
91 |
|
|
{ |
92 |
|
225850 |
put = putrow; |
93 |
|
225850 |
get = getrow; |
94 |
|
|
|
95 |
✓✓ |
16069373 |
for (xval = 0; xval < width; xval++) |
96 |
|
|
{ |
97 |
|
15843523 |
*put++ = *get++; |
98 |
|
|
} |
99 |
|
225850 |
putrow += context -> gx_draw_context_pitch; |
100 |
|
225850 |
getrow += pixelmap -> gx_pixelmap_width; |
101 |
|
|
} |
102 |
|
11907 |
} |
103 |
|
|
/**************************************************************************/ |
104 |
|
|
/* */ |
105 |
|
|
/* FUNCTION RELEASE */ |
106 |
|
|
/* */ |
107 |
|
|
/* _gx_display_driver_332rgb_pixelmap_compressed_write PORTABLE C */ |
108 |
|
|
/* 6.1 */ |
109 |
|
|
/* AUTHOR */ |
110 |
|
|
/* */ |
111 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
112 |
|
|
/* */ |
113 |
|
|
/* DESCRIPTION */ |
114 |
|
|
/* */ |
115 |
|
|
/* Internal helper function that handles writing of compressed */ |
116 |
|
|
/* pixlemap file without alpha channel. */ |
117 |
|
|
/* */ |
118 |
|
|
/* INPUT */ |
119 |
|
|
/* */ |
120 |
|
|
/* context Drawing context */ |
121 |
|
|
/* xpos x-coord of top-left draw point*/ |
122 |
|
|
/* ypos y-coord of top-left draw point*/ |
123 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
124 |
|
|
/* */ |
125 |
|
|
/* OUTPUT */ |
126 |
|
|
/* */ |
127 |
|
|
/* None */ |
128 |
|
|
/* */ |
129 |
|
|
/* CALLS */ |
130 |
|
|
/* */ |
131 |
|
|
/* _gx_display_driver_332rgb_pixel_blend Basic display driver pixel */ |
132 |
|
|
/* blend function */ |
133 |
|
|
/* */ |
134 |
|
|
/* CALLED BY */ |
135 |
|
|
/* */ |
136 |
|
|
/* _gx_display_driver_332rgb_pixelmap_draw */ |
137 |
|
|
/* */ |
138 |
|
|
/**************************************************************************/ |
139 |
|
92 |
static VOID _gx_display_driver_332rgb_pixelmap_compressed_write(GX_DRAW_CONTEXT *context, |
140 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
141 |
|
|
{ |
142 |
|
|
INT yval; |
143 |
|
|
INT xval; |
144 |
|
|
GX_CONST GX_UBYTE *get; |
145 |
|
|
GX_UBYTE *put; |
146 |
|
|
GX_UBYTE *putrow; |
147 |
|
|
GX_UBYTE count; |
148 |
|
|
GX_UBYTE pixel; |
149 |
|
|
GX_UBYTE brush_alpha; |
150 |
|
|
|
151 |
|
92 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
152 |
|
|
|
153 |
|
92 |
get = (GX_CONST GX_UBYTE *)pixelmap -> gx_pixelmap_data; |
154 |
|
92 |
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha; |
155 |
|
|
/* compressed with no alpha is a one-byte count and one-byte pixel value */ |
156 |
|
|
|
157 |
|
|
/* first, skip to the starting row */ |
158 |
✓✓ |
147 |
for (yval = ypos; yval < clip -> gx_rectangle_top; yval++) |
159 |
|
|
{ |
160 |
|
55 |
xval = 0; |
161 |
✓✓ |
435 |
while (xval < pixelmap -> gx_pixelmap_width) |
162 |
|
|
{ |
163 |
|
380 |
count = *get++; |
164 |
|
|
|
165 |
✓✓ |
380 |
if (count & 0x80) |
166 |
|
|
{ |
167 |
|
250 |
count = (GX_UBYTE)((count & 0x7f) + 1u); |
168 |
|
250 |
get++; /* skip repeated pixel value */ |
169 |
|
|
} |
170 |
|
|
else |
171 |
|
|
{ |
172 |
|
130 |
count++; |
173 |
|
130 |
get += count; /* skip raw pixel values */ |
174 |
|
|
} |
175 |
|
380 |
xval += count; |
176 |
|
|
} |
177 |
|
|
} |
178 |
|
|
|
179 |
|
|
/* now we are on the first visible row, copy pixels until we get |
180 |
|
|
to the enf of the last visible row |
181 |
|
|
*/ |
182 |
|
92 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
183 |
|
92 |
putrow += yval * context -> gx_draw_context_pitch; |
184 |
|
92 |
putrow += xpos; |
185 |
|
|
|
186 |
✓✓ |
12029 |
while (yval <= clip -> gx_rectangle_bottom) |
187 |
|
|
{ |
188 |
|
11937 |
put = putrow; |
189 |
|
11937 |
xval = xpos; |
190 |
|
|
|
191 |
✓✓ |
110857 |
while (xval < xpos + pixelmap -> gx_pixelmap_width) |
192 |
|
|
{ |
193 |
|
98920 |
count = *get++; |
194 |
|
|
|
195 |
✓✓ |
98920 |
if (count & 0x80) |
196 |
|
|
{ |
197 |
|
|
/* repeated value */ |
198 |
|
56846 |
count = (GX_UBYTE)((count & 0x7f) + 1u); |
199 |
|
56846 |
pixel = *get++; |
200 |
|
|
|
201 |
✓✓ |
56846 |
if (brush_alpha == 0xff) |
202 |
|
|
{ |
203 |
✓✓ |
1720515 |
while (count--) |
204 |
|
|
{ |
205 |
✓✓ |
1672958 |
if (xval >= clip -> gx_rectangle_left && |
206 |
✓✓ |
1668096 |
xval <= clip -> gx_rectangle_right) |
207 |
|
|
{ |
208 |
|
1638342 |
*put = pixel; |
209 |
|
|
} |
210 |
|
1672958 |
put++; |
211 |
|
1672958 |
xval++; |
212 |
|
|
} |
213 |
|
|
} |
214 |
|
|
else |
215 |
|
|
{ |
216 |
✓✓ |
333465 |
while (count--) |
217 |
|
|
{ |
218 |
✓✓ |
324176 |
if (xval >= clip -> gx_rectangle_left && |
219 |
✓✓ |
304728 |
xval <= clip -> gx_rectangle_right) |
220 |
|
|
{ |
221 |
|
185712 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, pixel, brush_alpha); |
222 |
|
|
} |
223 |
|
324176 |
xval++; |
224 |
|
|
} |
225 |
|
|
} |
226 |
|
|
|
227 |
|
|
} |
228 |
|
|
else |
229 |
|
|
{ |
230 |
|
|
/* string of non-repeated values */ |
231 |
|
42074 |
count++; |
232 |
✓✓ |
42074 |
if (brush_alpha == 0xff) |
233 |
|
|
{ |
234 |
✓✓ |
140523 |
while (count--) |
235 |
|
|
{ |
236 |
✓✓ |
105266 |
if (xval >= clip -> gx_rectangle_left && |
237 |
✓✓ |
104870 |
xval <= clip -> gx_rectangle_right) |
238 |
|
|
{ |
239 |
|
101642 |
*put = *get; |
240 |
|
|
} |
241 |
|
105266 |
put++; |
242 |
|
105266 |
get++; |
243 |
|
105266 |
xval++; |
244 |
|
|
} |
245 |
|
|
} |
246 |
|
|
else |
247 |
|
|
{ |
248 |
✓✓ |
27125 |
while (count--) |
249 |
|
|
{ |
250 |
✓✓ |
20308 |
if (xval >= clip -> gx_rectangle_left && |
251 |
✓✓ |
18724 |
xval <= clip -> gx_rectangle_right) |
252 |
|
|
{ |
253 |
|
5812 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, *get, brush_alpha); |
254 |
|
|
} |
255 |
|
20308 |
get++; |
256 |
|
20308 |
xval++; |
257 |
|
|
} |
258 |
|
|
} |
259 |
|
|
|
260 |
|
|
} |
261 |
|
|
} |
262 |
|
11937 |
putrow += context -> gx_draw_context_pitch; |
263 |
|
11937 |
yval++; |
264 |
|
|
} |
265 |
|
92 |
} |
266 |
|
|
|
267 |
|
|
/**************************************************************************/ |
268 |
|
|
/* */ |
269 |
|
|
/* FUNCTION RELEASE */ |
270 |
|
|
/* */ |
271 |
|
|
/* _gx_display_driver_332rgb_pixelmap_alpha_write PORTABLE C */ |
272 |
|
|
/* 6.1 */ |
273 |
|
|
/* AUTHOR */ |
274 |
|
|
/* */ |
275 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
276 |
|
|
/* */ |
277 |
|
|
/* DESCRIPTION */ |
278 |
|
|
/* */ |
279 |
|
|
/* Internal helper function that handles writing of uncompressed */ |
280 |
|
|
/* pixlemap file with alpha channel. */ |
281 |
|
|
/* */ |
282 |
|
|
/* INPUT */ |
283 |
|
|
/* */ |
284 |
|
|
/* context Drawing context */ |
285 |
|
|
/* xpos x-coord of top-left draw point*/ |
286 |
|
|
/* ypos y-coord of top-left draw point*/ |
287 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
288 |
|
|
/* */ |
289 |
|
|
/* OUTPUT */ |
290 |
|
|
/* */ |
291 |
|
|
/* None */ |
292 |
|
|
/* */ |
293 |
|
|
/* CALLS */ |
294 |
|
|
/* */ |
295 |
|
|
/* _gx_display_driver_332rgb_pixel_blend Basic display driver pixel */ |
296 |
|
|
/* blend function */ |
297 |
|
|
/* */ |
298 |
|
|
/* CALLED BY */ |
299 |
|
|
/* */ |
300 |
|
|
/* _gx_display_driver_332rgb_pixelmap_draw */ |
301 |
|
|
/* */ |
302 |
|
|
/**************************************************************************/ |
303 |
|
18964 |
static VOID _gx_display_driver_332rgb_pixelmap_alpha_write(GX_DRAW_CONTEXT *context, |
304 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
305 |
|
|
{ |
306 |
|
|
INT skipcount; |
307 |
|
|
INT xval; |
308 |
|
|
INT yval; |
309 |
|
|
GX_UBYTE *getrow; |
310 |
|
|
GX_UBYTE *getalpha_row; |
311 |
|
|
GX_CONST GX_UBYTE *getalpha; |
312 |
|
|
GX_CONST GX_UBYTE *get; |
313 |
|
|
|
314 |
|
18964 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
315 |
|
|
|
316 |
|
|
/* calculate how many pixels to skip */ |
317 |
|
18964 |
skipcount = (pixelmap -> gx_pixelmap_width) * (clip -> gx_rectangle_top - ypos); |
318 |
|
18964 |
skipcount += (clip -> gx_rectangle_left - xpos); |
319 |
|
18964 |
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data); |
320 |
|
18964 |
getrow += skipcount; |
321 |
|
18964 |
getalpha_row = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data); |
322 |
|
18964 |
getalpha_row += skipcount; |
323 |
|
|
|
324 |
✓✓ |
524632 |
for (yval = clip -> gx_rectangle_top; yval <= clip -> gx_rectangle_bottom; yval++) |
325 |
|
|
{ |
326 |
|
505668 |
get = getrow; |
327 |
|
505668 |
getalpha = getalpha_row; |
328 |
✓✓ |
60942424 |
for (xval = clip -> gx_rectangle_left; xval <= clip -> gx_rectangle_right; xval++) |
329 |
|
|
{ |
330 |
|
60436756 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, *get++, *getalpha++); |
331 |
|
|
} |
332 |
|
505668 |
getrow += pixelmap -> gx_pixelmap_width; |
333 |
|
505668 |
getalpha_row += pixelmap -> gx_pixelmap_width; |
334 |
|
|
} |
335 |
|
18964 |
} |
336 |
|
|
|
337 |
|
|
/**************************************************************************/ |
338 |
|
|
/* */ |
339 |
|
|
/* FUNCTION RELEASE */ |
340 |
|
|
/* */ |
341 |
|
|
/* _gx_display_driver_332rgb_pixelmap_compressed_alpha_write */ |
342 |
|
|
/* PORTABLE C */ |
343 |
|
|
/* 6.1 */ |
344 |
|
|
/* AUTHOR */ |
345 |
|
|
/* */ |
346 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
347 |
|
|
/* */ |
348 |
|
|
/* DESCRIPTION */ |
349 |
|
|
/* */ |
350 |
|
|
/* Internal helper function that handles writing of compressed */ |
351 |
|
|
/* pixlemap file with alpha channel. */ |
352 |
|
|
/* */ |
353 |
|
|
/* INPUT */ |
354 |
|
|
/* */ |
355 |
|
|
/* context Drawing context */ |
356 |
|
|
/* xpos x-coord of top-left draw point*/ |
357 |
|
|
/* ypos y-coord of top-left draw point*/ |
358 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
359 |
|
|
/* */ |
360 |
|
|
/* OUTPUT */ |
361 |
|
|
/* */ |
362 |
|
|
/* None */ |
363 |
|
|
/* */ |
364 |
|
|
/* CALLS */ |
365 |
|
|
/* */ |
366 |
|
|
/* _gx_display_driver_332rgb_pixel_blend Basic display driver pixel */ |
367 |
|
|
/* blend function */ |
368 |
|
|
/* */ |
369 |
|
|
/* CALLED BY */ |
370 |
|
|
/* */ |
371 |
|
|
/* _gx_display_driver_332rgb_pixelmap_draw */ |
372 |
|
|
/* */ |
373 |
|
|
/**************************************************************************/ |
374 |
|
537 |
static VOID _gx_display_driver_332rgb_pixelmap_compressed_alpha_write(GX_DRAW_CONTEXT *context, |
375 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
376 |
|
|
{ |
377 |
|
|
INT yval; |
378 |
|
|
INT xval; |
379 |
|
|
GX_CONST USHORT *get; |
380 |
|
|
USHORT count; |
381 |
|
|
USHORT pixel; |
382 |
|
|
GX_UBYTE alpha; |
383 |
|
|
GX_UBYTE brush_alpha; |
384 |
|
|
GX_UBYTE combined_alpha; |
385 |
|
537 |
GX_RECTANGLE *clip = context -> gx_draw_context_clip; |
386 |
|
|
|
387 |
|
537 |
get = (GX_CONST USHORT *)pixelmap -> gx_pixelmap_data; |
388 |
|
537 |
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha; |
389 |
|
|
/* compressed with alpha is 2-byte count, byte alpha, and and byte pixel value */ |
390 |
|
|
|
391 |
|
|
/* first, skip to the starting row */ |
392 |
✓✓ |
600 |
for (yval = ypos; yval < clip -> gx_rectangle_top; yval++) |
393 |
|
|
{ |
394 |
|
63 |
xval = 0; |
395 |
✓✓ |
876 |
while (xval < pixelmap -> gx_pixelmap_width) |
396 |
|
|
{ |
397 |
|
813 |
count = *get++; |
398 |
|
|
|
399 |
✓✓ |
813 |
if (count & 0x8000) |
400 |
|
|
{ |
401 |
|
525 |
count = (USHORT)((count & 0x7fff) + 1u); |
402 |
|
525 |
get++; /* skip repeated pixel value */ |
403 |
|
|
} |
404 |
|
|
else |
405 |
|
|
{ |
406 |
|
288 |
count++; |
407 |
|
288 |
get += count; /* skip string of non-repeated pixels */ |
408 |
|
|
} |
409 |
|
813 |
xval += count; |
410 |
|
|
} |
411 |
|
|
} |
412 |
|
|
|
413 |
|
|
/* now we are on the first visible row, copy pixels until we get |
414 |
|
|
to the end of the last visible row. |
415 |
|
|
*/ |
416 |
✓✓ |
32362 |
while (yval <= clip -> gx_rectangle_bottom) |
417 |
|
|
{ |
418 |
|
31825 |
xval = xpos; |
419 |
✓✓ |
476899 |
while (xval < xpos + pixelmap -> gx_pixelmap_width) |
420 |
|
|
{ |
421 |
|
445074 |
count = *get++; |
422 |
|
|
|
423 |
✓✓ |
445074 |
if (count & 0x8000) |
424 |
|
|
{ |
425 |
|
|
/* repeated value */ |
426 |
|
292046 |
count = (USHORT)((count & 0x7fff) + 1u); |
427 |
|
292046 |
pixel = *get++; |
428 |
|
292046 |
alpha = (GX_UBYTE)((pixel & 0xff00) >> 8); |
429 |
|
|
|
430 |
✓✓ |
292046 |
if (alpha) |
431 |
|
|
{ |
432 |
✓✓ |
242873 |
if (brush_alpha != 0xff) |
433 |
|
|
{ |
434 |
|
23870 |
combined_alpha = (GX_UBYTE)(alpha * brush_alpha / 255); |
435 |
|
23870 |
alpha = combined_alpha; |
436 |
|
|
} |
437 |
|
|
|
438 |
✓✓ |
2662388 |
while (count--) |
439 |
|
|
{ |
440 |
✓✓ |
2419515 |
if (xval >= clip -> gx_rectangle_left && |
441 |
✓✓ |
2417235 |
xval <= clip -> gx_rectangle_right) |
442 |
|
|
{ |
443 |
|
2286240 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, (GX_COLOR)(pixel & 0xff), alpha); |
444 |
|
|
} |
445 |
|
2419515 |
xval++; |
446 |
|
|
} |
447 |
|
|
} |
448 |
|
|
else |
449 |
|
|
{ |
450 |
|
49173 |
xval += count; |
451 |
|
|
} |
452 |
|
|
} |
453 |
|
|
else |
454 |
|
|
{ |
455 |
|
|
/* string of non-repeated values */ |
456 |
|
153028 |
count++; |
457 |
✓✓ |
153028 |
if (brush_alpha == 0xff) |
458 |
|
|
{ |
459 |
✓✓ |
617824 |
while (count--) |
460 |
|
|
{ |
461 |
✓✓ |
479093 |
if (xval >= clip -> gx_rectangle_left && |
462 |
✓✓ |
477949 |
xval <= clip -> gx_rectangle_right) |
463 |
|
|
{ |
464 |
|
472162 |
pixel = *get; |
465 |
|
472162 |
alpha = (GX_UBYTE)((pixel & 0xff00) >> 8); |
466 |
✓✓ |
472162 |
if (alpha) |
467 |
|
|
{ |
468 |
|
458775 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, (GX_COLOR)(pixel & 0xff), alpha); |
469 |
|
|
} |
470 |
|
|
} |
471 |
|
479093 |
get++; |
472 |
|
479093 |
xval++; |
473 |
|
|
} |
474 |
|
|
} |
475 |
|
|
else |
476 |
|
|
{ |
477 |
✓✓ |
63093 |
while (count--) |
478 |
|
|
{ |
479 |
✓✓ |
48796 |
if (xval >= clip -> gx_rectangle_left && |
480 |
✓✓ |
44964 |
xval <= clip -> gx_rectangle_right) |
481 |
|
|
{ |
482 |
|
24079 |
pixel = *get; |
483 |
|
24079 |
alpha = (GX_UBYTE)((pixel & 0xff00) >> 8); |
484 |
|
24079 |
combined_alpha = (GX_UBYTE)(alpha * brush_alpha / 255); |
485 |
|
24079 |
_gx_display_driver_332rgb_pixel_blend(context, xval, yval, (GX_COLOR)(pixel & 0xff), combined_alpha); |
486 |
|
|
} |
487 |
|
48796 |
get++; |
488 |
|
48796 |
xval++; |
489 |
|
|
} |
490 |
|
|
} |
491 |
|
|
|
492 |
|
|
} |
493 |
|
|
} |
494 |
|
31825 |
yval++; |
495 |
|
|
} |
496 |
|
537 |
} |
497 |
|
|
/**************************************************************************/ |
498 |
|
|
/* */ |
499 |
|
|
/* FUNCTION RELEASE */ |
500 |
|
|
/* */ |
501 |
|
|
/* _gx_display_driver_332rgb_pixelmap_draw PORTABLE C */ |
502 |
|
|
/* 6.1 */ |
503 |
|
|
/* AUTHOR */ |
504 |
|
|
/* */ |
505 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
506 |
|
|
/* */ |
507 |
|
|
/* DESCRIPTION */ |
508 |
|
|
/* */ |
509 |
|
|
/* 332rgb screen driver pixelmap drawing function that handles */ |
510 |
|
|
/* compressed or uncompress, with or without alpha channel. */ |
511 |
|
|
/* */ |
512 |
|
|
/* INPUT */ |
513 |
|
|
/* */ |
514 |
|
|
/* context Drawing context */ |
515 |
|
|
/* xpos x-coord of top-left draw point*/ |
516 |
|
|
/* ypos y-coord of top-left draw point*/ |
517 |
|
|
/* pixelmap Pointer to GX_PIXELMAP struct */ |
518 |
|
|
/* */ |
519 |
|
|
/* OUTPUT */ |
520 |
|
|
/* */ |
521 |
|
|
/* None */ |
522 |
|
|
/* */ |
523 |
|
|
/* CALLS */ |
524 |
|
|
/* */ |
525 |
|
|
/* _gx_display_driver_332rgb_pixelmap_compressed_alpha_write */ |
526 |
|
|
/* Real pixelmap draw function */ |
527 |
|
|
/* _gx_display_driver_332rgb_pixelmap_alpha_write */ |
528 |
|
|
/* Real pixelmap draw function */ |
529 |
|
|
/* _gx_display_driver_332rgb_pixelmap_compressed_write */ |
530 |
|
|
/* Real pixelmap draw function */ |
531 |
|
|
/* _gx_display_driver_332rgb_pixelmap_raw_write */ |
532 |
|
|
/* Real pixelmap draw function */ |
533 |
|
|
/* _gx_display_driver_8bpp_pixelmap_blend */ |
534 |
|
|
/* Basic display driver pixelmap */ |
535 |
|
|
/* blend function */ |
536 |
|
|
/* */ |
537 |
|
|
/* CALLED BY */ |
538 |
|
|
/* */ |
539 |
|
|
/* GUIX Internal Code */ |
540 |
|
|
/* */ |
541 |
|
|
/**************************************************************************/ |
542 |
|
31557 |
VOID _gx_display_driver_332rgb_pixelmap_draw(GX_DRAW_CONTEXT *context, |
543 |
|
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap) |
544 |
|
|
{ |
545 |
|
31557 |
GX_BOOL drawn = GX_FALSE; |
546 |
|
31557 |
GX_UBYTE brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha; |
547 |
|
|
|
548 |
✓✓ |
31557 |
if (brush_alpha == 0) |
549 |
|
|
{ |
550 |
|
|
/* Nothing to draw here. Just return. */ |
551 |
|
13 |
return; |
552 |
|
|
} |
553 |
|
|
|
554 |
✓✓ |
31544 |
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_8BIT_PACKED_PIXEL) |
555 |
|
|
{ |
556 |
|
20 |
return; |
557 |
|
|
} |
558 |
|
|
|
559 |
✓✓ |
31524 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
560 |
|
|
{ |
561 |
✓✓ |
19516 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
562 |
|
|
{ |
563 |
|
537 |
_gx_display_driver_332rgb_pixelmap_compressed_alpha_write(context, xpos, ypos, pixelmap); |
564 |
|
537 |
drawn = GX_TRUE; |
565 |
|
|
} |
566 |
|
|
else |
567 |
|
|
{ |
568 |
✓✓ |
18979 |
if (brush_alpha == 0xff) |
569 |
|
|
{ |
570 |
|
18964 |
_gx_display_driver_332rgb_pixelmap_alpha_write(context, xpos, ypos, pixelmap); |
571 |
|
18964 |
drawn = GX_TRUE; |
572 |
|
|
} |
573 |
|
|
} |
574 |
|
|
} |
575 |
|
|
else |
576 |
|
|
{ |
577 |
✓✓ |
12008 |
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
578 |
|
|
{ |
579 |
|
92 |
_gx_display_driver_332rgb_pixelmap_compressed_write(context, xpos, ypos, pixelmap); |
580 |
|
92 |
drawn = GX_TRUE; |
581 |
|
|
} |
582 |
|
|
else |
583 |
|
|
{ |
584 |
✓✓ |
11916 |
if (brush_alpha == 0xff) |
585 |
|
|
{ |
586 |
|
11907 |
_gx_display_driver_332rgb_pixelmap_raw_write(context, xpos, ypos, pixelmap); |
587 |
|
11907 |
drawn = GX_TRUE; |
588 |
|
|
} |
589 |
|
|
} |
590 |
|
|
} |
591 |
|
|
|
592 |
✓✓ |
31524 |
if (!drawn) |
593 |
|
|
{ |
594 |
|
24 |
_gx_display_driver_8bpp_pixelmap_blend(context, xpos, ypos, pixelmap, brush_alpha); |
595 |
|
|
} |
596 |
|
|
|
597 |
|
31524 |
return; |
598 |
|
|
} |
599 |
|
|
|