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_system.h" |
28 |
|
|
#include "gx_utility.h" |
29 |
|
|
#include "gx_display.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_display_driver_generic_pie_fill PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* Display driver to fill a pie. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* context Drawing context */ |
49 |
|
|
/* xcenter x-coord of center of circle */ |
50 |
|
|
/* ycenter y-coord of center of circle */ |
51 |
|
|
/* r Radius of circle */ |
52 |
|
|
/* start_angle The start angle of circle arc */ |
53 |
|
|
/* end_angle The end angle of circle arc */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* None */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* _gx_display_driver_generic_simple_pie_fill */ |
62 |
|
|
/* Real display driver draw */ |
63 |
|
|
/* filled-pie function */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* _gx_canvas_pie_draw */ |
68 |
|
|
/* */ |
69 |
|
|
/* RELEASE HISTORY */ |
70 |
|
|
/* */ |
71 |
|
|
/* DATE NAME DESCRIPTION */ |
72 |
|
|
/* */ |
73 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
74 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
75 |
|
|
/* resulting in version 6.1 */ |
76 |
|
|
/* */ |
77 |
|
|
/**************************************************************************/ |
78 |
|
|
#if defined(GX_ARC_DRAWING_SUPPORT) |
79 |
|
|
|
80 |
|
1817 |
VOID _gx_display_driver_generic_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle) |
81 |
|
|
{ |
82 |
|
|
/* The function fills a pie.*/ |
83 |
|
|
|
84 |
|
|
|
85 |
✓✓ |
1817 |
if (start_angle < 180) |
86 |
|
|
{ |
87 |
✓✓ |
1036 |
if (end_angle < 180) |
88 |
|
|
{ |
89 |
|
612 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, end_angle, GX_FALSE); |
90 |
|
|
} |
91 |
✓✓ |
424 |
else if (end_angle < 360) |
92 |
|
|
{ |
93 |
|
|
/* Skip-end parameter should only be set when drawing the above area. |
94 |
|
|
It would be set to GX_TRUE to skip the bottom line to avoid case that this line will be drawn twice, which |
95 |
|
|
is not correct, when brush alpha is set. */ |
96 |
|
412 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 180, GX_TRUE); |
97 |
|
412 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 180, end_angle, GX_FALSE); |
98 |
|
|
} |
99 |
|
|
else |
100 |
|
|
{ |
101 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 180, GX_TRUE); |
102 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 180, 360, GX_FALSE); |
103 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 0, end_angle - 360, GX_TRUE); |
104 |
|
|
} |
105 |
|
|
} |
106 |
|
|
else |
107 |
|
|
{ |
108 |
✓✓ |
781 |
if (end_angle < 360) |
109 |
|
|
{ |
110 |
|
383 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, end_angle, GX_FALSE); |
111 |
|
|
} |
112 |
✓✓ |
398 |
else if (end_angle < 540) |
113 |
|
|
{ |
114 |
|
386 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 360, GX_FALSE); |
115 |
|
386 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 0, end_angle - 360, GX_TRUE); |
116 |
|
|
} |
117 |
|
|
else |
118 |
|
|
{ |
119 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 360, GX_FALSE); |
120 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 0, 180, GX_TRUE); |
121 |
|
12 |
_gx_display_driver_generic_simple_pie_fill(context, xcenter, ycenter, r, 180, end_angle - 360, GX_FALSE); |
122 |
|
|
} |
123 |
|
|
} |
124 |
|
1817 |
} |
125 |
|
|
|
126 |
|
|
#endif |
127 |
|
|
|