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