GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_8bpp_pixelmap_rotate.c Lines: 184 184 100.0 %
Date: 2026-03-06 19:21:09 Branches: 70 70 100.0 %

Line Branch Exec Source
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
#define GX_SOURCE_CODE
22
23
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_display.h"
27
#include "gx_context.h"
28
#include "gx_utility.h"
29
#include "gx_system.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_display_driver_8bpp_pixelmap_raw_rotate         PORTABLE C      */
36
/*                                                           6.1.10       */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    Internal helper function that rotate an uncompressed pixelmap       */
44
/*      without alpha.                                                    */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    context                               Drawing context               */
49
/*    xpos                                  x-coord of top-left draw point*/
50
/*    ypos                                  y-coord of top-left draw point*/
51
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
52
/*    angle                                 The angle to rotate           */
53
/*    cx                                    x-coord of rotate center      */
54
/*    cy                                    y-coord of rotate center      */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_utility_math_cos                  Compute the cosine value      */
63
/*    _gx_utility_math_sin                  Compute the sine value        */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    _gx_display_driver_8bpp_pixelmap_rotate                             */
68
/*                                                                        */
69
/**************************************************************************/
70
712
static VOID _gx_display_driver_8bpp_pixelmap_raw_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
71
                                                        INT angle, INT cx, INT cy)
72
{
73
GX_UBYTE     *putrow;
74
GX_UBYTE     *put;
75
GX_UBYTE     *get;
76
INT           srcxres;
77
INT           srcyres;
78
INT           cosv;
79
INT           sinv;
80
INT           idxminx;
81
INT           idxmaxx;
82
INT           idxmaxy;
83
712
INT           mx[] = {-1, 1, 1, -1};
84
712
INT           my[] = {1, 1, -1, -1};
85
INT           xres;
86
INT           yres;
87
INT           x;
88
INT           y;
89
INT           xx;
90
INT           yy;
91
GX_RECTANGLE *clip;
92
INT           newxpos;
93
INT           newypos;
94
95
712
    clip = context -> gx_draw_context_clip;
96
97
    /* Set transparent color.  */
98
712
    idxminx = (angle / 90) & 0x3;
99
712
    idxmaxx = (idxminx + 2) & 0x3;
100
712
    idxmaxy = (idxminx + 1) & 0x3;
101
102
    /* Calculate the source x and y center. */
103
712
    srcxres = pixelmap -> gx_pixelmap_width >> 1;
104
712
    srcyres = pixelmap -> gx_pixelmap_height >> 1;
105
106
712
    cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
107
712
    sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
108
109
712
    xres = GX_FIXED_VAL_TO_INT((mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv));
110
712
    yres = GX_FIXED_VAL_TO_INT((my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv));
111
112
712
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
113
712
    putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
114
712
    putrow += clip -> gx_rectangle_left;
115
116
    /* Calculate the new rotation axis. */
117
712
    xres = GX_FIXED_VAL_TO_INT((cx - srcxres) * cosv - (cy - srcyres) * sinv) + xres;
118
712
    yres = GX_FIXED_VAL_TO_INT((cy - srcyres) * cosv + (cx - srcxres) * sinv) + yres;
119
120
712
    newxpos = xpos + cx - xres;
121
712
    newypos = ypos + cy - yres;
122
123
    /* For every pixel in destination bitmap, find its position in source bitmap,
124
       and set the pixel with the value in source bitmap.  */
125
149753
    for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
126
    {
127
149041
        put = putrow;
128
129
33809071
        for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
130
        {
131
33660030
            xx = GX_FIXED_VAL_TO_INT((x - xres) * cosv + (y - yres) * sinv) + cx;
132
33660030
            yy = GX_FIXED_VAL_TO_INT((y - yres) * cosv - (x - xres) * sinv) + cy;
133
134

33660030
            if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_width) &&
135
25139653
                (yy >= 0) && (yy < pixelmap -> gx_pixelmap_height))
136
            {
137
18853275
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
138
18853275
                get += yy * pixelmap -> gx_pixelmap_width;
139
18853275
                get += xx;
140
141
18853275
                *put = *get;
142
            }
143
144
33660030
            put++;
145
        }
146
149041
        putrow += context -> gx_draw_context_pitch;
147
    }
148
712
}
149
150
/**************************************************************************/
151
/*                                                                        */
152
/*  FUNCTION                                               RELEASE        */
153
/*                                                                        */
154
/*    _gx_display_driver_8bpp_pixelmap_transparent_rotate PORTABLE C      */
155
/*                                                           6.1.10       */
156
/*  AUTHOR                                                                */
157
/*                                                                        */
158
/*    Kenneth Maxwell, Microsoft Corporation                              */
159
/*                                                                        */
160
/*  DESCRIPTION                                                           */
161
/*                                                                        */
162
/*    Internal helper function that rotate an uncompressed pixelmap       */
163
/*      without alpha.                                                    */
164
/*                                                                        */
165
/*  INPUT                                                                 */
166
/*                                                                        */
167
/*    context                               Drawing context               */
168
/*    xpos                                  x-coord of top-left draw point*/
169
/*    ypos                                  y-coord of top-left draw point*/
170
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
171
/*    angle                                 The angle to rotate           */
172
/*    cx                                    x-coord of rotate center      */
173
/*    cy                                    y-coord of rotate center      */
174
/*                                                                        */
175
/*  OUTPUT                                                                */
176
/*                                                                        */
177
/*    None                                                                */
178
/*                                                                        */
179
/*  CALLS                                                                 */
180
/*                                                                        */
181
/*    _gx_utility_math_cos                  Compute the cosine value      */
182
/*    _gx_utility_math_sin                  Compute the sine value        */
183
/*                                                                        */
184
/*  CALLED BY                                                             */
185
/*                                                                        */
186
/*    GUIX Internal Code                                                  */
187
/*                                                                        */
188
/**************************************************************************/
189
712
static VOID _gx_display_driver_8bpp_pixelmap_transparent_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
190
                                                                INT angle, INT cx, INT cy)
191
{
192
GX_UBYTE     *putrow;
193
GX_UBYTE     *put;
194
GX_UBYTE     *get;
195
INT           srcxres;
196
INT           srcyres;
197
INT           cosv;
198
INT           sinv;
199
INT           idxminx;
200
INT           idxmaxx;
201
INT           idxmaxy;
202
712
INT           mx[] = {-1, 1, 1, -1};
203
712
INT           my[] = {1, 1, -1, -1};
204
INT           xres;
205
INT           yres;
206
INT           x;
207
INT           y;
208
INT           xx;
209
INT           yy;
210
GX_RECTANGLE *clip;
211
INT           newxpos;
212
INT           newypos;
213
214
712
    clip = context -> gx_draw_context_clip;
215
216
    /* Set transparent color.  */
217
712
    idxminx = (angle / 90) & 0x3;
218
712
    idxmaxx = (idxminx + 2) & 0x3;
219
712
    idxmaxy = (idxminx + 1) & 0x3;
220
221
    /* Calculate the source x and y center. */
222
712
    srcxres = pixelmap -> gx_pixelmap_width >> 1;
223
712
    srcyres = pixelmap -> gx_pixelmap_height >> 1;
224
225
712
    cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
226
712
    sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
227
228
712
    xres = GX_FIXED_VAL_TO_INT((mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv));
229
712
    yres = GX_FIXED_VAL_TO_INT((my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv));
230
231
712
    putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
232
712
    putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
233
712
    putrow += clip -> gx_rectangle_left;
234
235
    /* Calculate the new rotation axis. */
236
712
    x = (cx - srcxres) * cosv - (cy - srcyres) * sinv;
237
712
    y = (cy - srcyres) * cosv + (cx - srcxres) * sinv;
238
239
712
    xres = GX_FIXED_VAL_TO_INT(x) + xres;
240
712
    yres = GX_FIXED_VAL_TO_INT(y) + yres;
241
242
712
    newxpos = xpos + cx - xres;
243
712
    newypos = ypos + cy - yres;
244
245
    /* For every pixel in destination bitmap, find its position in source bitmap,
246
       and set the pixel with the value in source bitmap.  */
247
166985
    for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
248
    {
249
166273
        put = putrow;
250
251
47657057
        for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
252
        {
253
47490784
            xx = GX_FIXED_VAL_TO_INT((x - xres) * cosv + (y - yres) * sinv) + cx;
254
47490784
            yy = GX_FIXED_VAL_TO_INT((y - yres) * cosv - (x - xres) * sinv) + cy;
255
256

47490784
            if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_width) &&
257
32244461
                (yy >= 0) && (yy < pixelmap -> gx_pixelmap_height))
258
            {
259
28538157
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
260
28538157
                get += yy * pixelmap -> gx_pixelmap_width;
261
28538157
                get += xx;
262
263
28538157
                if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
264
                {
265
20094500
                    *put = *get;
266
                }
267
            }
268
47490784
            put++;
269
        }
270
166273
        putrow += context -> gx_draw_context_pitch;
271
    }
272
712
}
273
274
/**************************************************************************/
275
/*                                                                        */
276
/*  FUNCTION                                               RELEASE        */
277
/*                                                                        */
278
/*    _gx_display_driver_8bpp_pixelmap_simple_rotate      PORTABLE C      */
279
/*                                                           6.1.7        */
280
/*  AUTHOR                                                                */
281
/*                                                                        */
282
/*    Kenneth Maxwell, Microsoft Corporation                              */
283
/*                                                                        */
284
/*  DESCRIPTION                                                           */
285
/*                                                                        */
286
/*    Internal help function that hangles 90, 180 and 270 degree pixelmap */
287
/*    rotation.                                                           */
288
/*                                                                        */
289
/*  INPUT                                                                 */
290
/*                                                                        */
291
/*    context                               Drawing context               */
292
/*    xpos                                  x-coord of top-left draw point*/
293
/*    ypos                                  y-coord of top-left draw point*/
294
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
295
/*    angle                                 The angle to rotate           */
296
/*    cx                                    x-coord of rotate center      */
297
/*    cy                                    y-coord of rotate center      */
298
/*                                                                        */
299
/*  OUTPUT                                                                */
300
/*                                                                        */
301
/*    None                                                                */
302
/*                                                                        */
303
/*  CALLS                                                                 */
304
/*                                                                        */
305
/*    None                                                                */
306
/*                                                                        */
307
/*  CALLED BY                                                             */
308
/*                                                                        */
309
/*    _gx_display_driver_8bpp_pixelmap_rotate                             */
310
/*                                                                        */
311
/**************************************************************************/
312
12
VOID _gx_display_driver_8bpp_pixelmap_simple_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
313
                                                           INT angle, INT cx, INT cy)
314
{
315
GX_UBYTE     *putrow;
316
GX_UBYTE     *put;
317
GX_UBYTE     *get;
318
INT           width;
319
INT           height;
320
INT           x;
321
INT           y;
322
GX_RECTANGLE *clip;
323
INT           newxpos;
324
INT           newypos;
325
326
12
    clip = context -> gx_draw_context_clip;
327
328
12
    if (angle == 90)
329
    {
330
4
        width = pixelmap -> gx_pixelmap_height;
331
4
        height = pixelmap -> gx_pixelmap_width;
332
333
4
        newxpos = xpos + cx - (width - 1 - cy);
334
4
        newypos = ypos + cy - cx;
335
336
4
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
337
4
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
338
4
        putrow += clip -> gx_rectangle_left;
339
340
943
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
341
        {
342
939
            put = putrow;
343
344
119253
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
345
            {
346
118314
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
347
118314
                get += (width - 1 - x) * height;
348
118314
                get += y;
349
350
118314
                *put++ = *get;
351
            }
352
353
939
            putrow += context -> gx_draw_context_pitch;
354
        }
355
    }
356
8
    else if (angle == 180)
357
    {
358
359
4
        width = pixelmap -> gx_pixelmap_width;
360
4
        height = pixelmap -> gx_pixelmap_height;
361
362
4
        newxpos = xpos + cx - (width - 1 - cx);
363
4
        newypos = ypos + cy - (height - 1 - cy);
364
365
4
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
366
4
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
367
4
        putrow += clip -> gx_rectangle_left;
368
369
468
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
370
        {
371
464
            put = putrow;
372
96015
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
373
            {
374
95551
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
375
95551
                get += (height - 1 - y) * width;
376
95551
                get += width - 1 - x;
377
378
95551
                *put++ = *get;
379
            }
380
381
464
            putrow += context -> gx_draw_context_pitch;
382
        }
383
    }
384
    else
385
    {
386
4
        height = pixelmap -> gx_pixelmap_width;
387
388
4
        newxpos = xpos + cx - cy;
389
4
        newypos = ypos + cx - (height - 1 - cy);
390
391
4
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
392
4
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
393
4
        putrow += clip -> gx_rectangle_left;
394
395
696
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
396
        {
397
692
            put = putrow;
398
399
87884
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
400
            {
401
87192
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
402
87192
                get += x * height;
403
87192
                get += height - 1 - y;
404
405
87192
                *put++ = *get;
406
            }
407
408
692
            putrow += context -> gx_draw_context_pitch;
409
        }
410
    }
411
12
}
412
413
/**************************************************************************/
414
/*                                                                        */
415
/*  FUNCTION                                               RELEASE        */
416
/*                                                                        */
417
/*    _gx_display_driver_8bpp_pixelmap_simple_transparent_rotate          */
418
/*                                                        PORTABLE C      */
419
/*                                                           6.1.7        */
420
/*  AUTHOR                                                                */
421
/*                                                                        */
422
/*    Kenneth Maxwell, Microsoft Corporation                              */
423
/*                                                                        */
424
/*  DESCRIPTION                                                           */
425
/*                                                                        */
426
/*    Internal help function that hangles 90, 180 and 270 degree pixelmap */
427
/*    rotation.                                                           */
428
/*                                                                        */
429
/*  INPUT                                                                 */
430
/*                                                                        */
431
/*    context                               Drawing context               */
432
/*    xpos                                  x-coord of top-left draw point*/
433
/*    ypos                                  y-coord of top-left draw point*/
434
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
435
/*    angle                                 The angle to rotate           */
436
/*    cx                                    x-coord of rotate center      */
437
/*    cy                                    y-coord of rotate center      */
438
/*                                                                        */
439
/*  OUTPUT                                                                */
440
/*                                                                        */
441
/*    None                                                                */
442
/*                                                                        */
443
/*  CALLS                                                                 */
444
/*                                                                        */
445
/*    None                                                                */
446
/*                                                                        */
447
/*  CALLED BY                                                             */
448
/*                                                                        */
449
/*    _gx_display_driver_8bpp_pixelmap_rotate                             */
450
/*                                                                        */
451
/**************************************************************************/
452
6
static VOID _gx_display_driver_8bpp_pixelmap_simple_transparent_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
453
                                                                       INT angle, INT cx, INT cy)
454
{
455
GX_UBYTE     *putrow;
456
GX_UBYTE     *put;
457
GX_UBYTE     *get;
458
INT           width;
459
INT           height;
460
INT           x;
461
INT           y;
462
GX_RECTANGLE *clip;
463
INT           newxpos;
464
INT           newypos;
465
466
6
    clip = context -> gx_draw_context_clip;
467
468
6
    if (angle == 90)
469
    {
470
2
        width = pixelmap -> gx_pixelmap_height;
471
2
        height = pixelmap -> gx_pixelmap_width;
472
473
2
        newxpos = xpos + cx - (width - 1 - cy);
474
2
        newypos = ypos + cy - cx;
475
476
2
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
477
2
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
478
2
        putrow += clip -> gx_rectangle_left;
479
480
392
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
481
        {
482
390
            put = putrow;
483
484
90675
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
485
            {
486
90285
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
487
90285
                get += (width - 1 - x) * height;
488
90285
                get += y;
489
490
90285
                if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
491
                {
492
67962
                    *put = *get;
493
                }
494
90285
                put++;
495
            }
496
390
            putrow += context -> gx_draw_context_pitch;
497
        }
498
    }
499
4
    else if (angle == 180)
500
    {
501
502
2
        width = pixelmap -> gx_pixelmap_width;
503
2
        height = pixelmap -> gx_pixelmap_height;
504
505
2
        newxpos = xpos + cx - (width - 1 - cx);
506
2
        newypos = ypos + cy - (height - 1 - cy);
507
508
2
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
509
2
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
510
2
        putrow += clip -> gx_rectangle_left;
511
512
303
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
513
        {
514
301
            put = putrow;
515
58996
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
516
            {
517
58695
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
518
58695
                get += (height - 1 - y) * width;
519
58695
                get += width - 1 - x;
520
521
58695
                if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
522
                {
523
41070
                    *put = *get;
524
                }
525
58695
                put++;
526
            }
527
528
301
            putrow += context -> gx_draw_context_pitch;
529
        }
530
    }
531
    else
532
    {
533
2
        height = pixelmap -> gx_pixelmap_width;
534
535
2
        newxpos = xpos + cx - cy;
536
2
        newypos = ypos + cx - (height - 1 - cy);
537
538
2
        putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
539
2
        putrow += clip -> gx_rectangle_top * context -> gx_draw_context_pitch;
540
2
        putrow += clip -> gx_rectangle_left;
541
542
231
        for (y = clip -> gx_rectangle_top - newypos; y <= clip -> gx_rectangle_bottom - newypos; y++)
543
        {
544
229
            put = putrow;
545
546
61372
            for (x = clip -> gx_rectangle_left - newxpos; x <= clip -> gx_rectangle_right - newxpos; x++)
547
            {
548
61143
                get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
549
61143
                get += x * height;
550
61143
                get += height - 1 - y;
551
552
61143
                if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
553
                {
554
40639
                    *put = *get;
555
                }
556
61143
                put++;
557
            }
558
559
229
            putrow += context -> gx_draw_context_pitch;
560
        }
561
    }
562
6
}
563
564
/**************************************************************************/
565
/*                                                                        */
566
/*  FUNCTION                                               RELEASE        */
567
/*                                                                        */
568
/*    _gx_display_driver_8bpp_pixelmap_rotate             PORTABLE C      */
569
/*                                                           6.1          */
570
/*  AUTHOR                                                                */
571
/*                                                                        */
572
/*    Kenneth Maxwell, Microsoft Corporation                              */
573
/*                                                                        */
574
/*  DESCRIPTION                                                           */
575
/*                                                                        */
576
/*    This service rotate a pixelmap directly to canvas memory.           */
577
/*                                                                        */
578
/*  INPUT                                                                 */
579
/*                                                                        */
580
/*    context                               Drawing context               */
581
/*    xpos                                  x-coord of top-left draw point*/
582
/*    ypos                                  y-coord of top-left draw point*/
583
/*    pixelmap                              Pointer to GX_PIXELMAP struct */
584
/*    angle                                 The angle to rotate           */
585
/*    rot_cx                                x-coord of rotating center.   */
586
/*    rot_cy                                y-coord of rotationg center.  */
587
/*                                                                        */
588
/*  OUTPUT                                                                */
589
/*                                                                        */
590
/*    status                                Completion status             */
591
/*                                                                        */
592
/*  CALLS                                                                 */
593
/*                                                                        */
594
/*    _gx_display_driver_8bpp_pixelmap_simple_transparent_rotate          */
595
/*                                          Real display driver pixelmap  */
596
/*                                            roate function              */
597
/*    _gx_display_driver_8bpp_pixelmap_simple_rotate                      */
598
/*                                          Real display driver pixelmap  */
599
/*                                            roate function              */
600
/*    _gx_display_driver_8bpp_pixelmap_transparent_rotate                 */
601
/*                                          Real display driver pixelmap  */
602
/*                                            roate function              */
603
/*    _gx_display_driver_8bpp_pixelmap_raw_rotate                         */
604
/*                                          Real display driver pixelmap  */
605
/*                                            roate function              */
606
/*                                                                        */
607
/*  CALLED BY                                                             */
608
/*                                                                        */
609
/*    Application Code                                                    */
610
/*    GUIX Internal Code                                                  */
611
/*                                                                        */
612
/**************************************************************************/
613
1436
VOID _gx_display_driver_8bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
614
                                             INT angle, INT rot_cx, INT rot_cy)
615
{
616
1436
    if (angle % 90 == 0)
617
    {
618
        /* Simple angle rotate: 90 degree, 180 degree and 270 degree.  */
619
12
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
620
        {
621
6
            _gx_display_driver_8bpp_pixelmap_simple_transparent_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
622
        }
623
        else
624
        {
625
6
            _gx_display_driver_8bpp_pixelmap_simple_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
626
        }
627
    }
628
    else
629
    {
630
1424
        if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
631
        {
632
            /* no compression or alpha */
633
712
            _gx_display_driver_8bpp_pixelmap_transparent_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
634
        }
635
        else
636
        {
637
            /* no compression or alpha */
638
712
            _gx_display_driver_8bpp_pixelmap_raw_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
639
        }
640
    }
641
642
1436
    return;
643
}
644