1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "tx_api.h"
5 #include "gx_api.h"
6 #include "gx_validation_utility.h"
7 
8 TEST_PARAM test_parameter = {
9     "guix_graphics_arc_draw", /* Test name */
10     24, 43, 370, 402  /* Define the coordinates of the capture area.
11                          In this test, we only need to capture the graphics
12                          drawing area.  */
13 };
14 
15 static VOID      control_thread_entry(ULONG);
main(int argc,char ** argv)16 int main(int argc, char ** argv)
17 {
18     /* Parse the command line argument. */
19     gx_validation_setup(argc, argv);
20 
21     /* Start ThreadX system */
22     tx_kernel_enter();
23     return(0);
24 }
25 
tx_application_define(void * first_unused_memory)26 VOID tx_application_define(void *first_unused_memory)
27 {
28 
29     /* Create a dedicated thread to perform various operations
30        on the pixelmap drawing example. These operations simulate
31        user input. */
32     gx_validation_control_thread_create(control_thread_entry);
33 
34     /* Termiante the test if it runs for more than 100 ticks */
35     /* This function is not implemented yet. */
36     gx_validation_watchdog_create(100);
37 
38     /* Call the actual line example routine. */
39     gx_validation_application_define(first_unused_memory);
40 
41 }
42 
43 
44 /* Replace the default graphics driver with the validation driver. */
45 #ifdef win32_graphics_driver_setup_24xrgb
46 #undef win32_graphics_driver_setup_24xrgb
47 #endif
48 #define win32_graphics_driver_setup_24xrgb  gx_validation_graphics_driver_setup_24xrgb
49 
50 
51 #ifdef WIN32
52 #undef WIN32
53 #endif
54 
55 #include "gx_validation_wrapper.h"
56 
57 #include "demo_guix_graphics_32bpp.c"
58 
59 char test_comment[256];
60 
61 
62 /* This thread simulates user input.  Its priority is lower
63    than the GUIX thread, so that GUIX finishes an operation
64    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)65 static VOID control_thread_entry(ULONG input)
66 {
67 INT frame_id = 1;
68 int index;
69 int alias;
70 
71     draw_shape = ARC;
72     pixelmap_fill = GX_FALSE;
73     brush_width = 5;
74 
75     for(alias = 0; alias < 2; alias ++)
76     {
77         if(alias)
78         {
79             anti_aliased = GX_TRUE;
80         }
81         else
82         {
83             anti_aliased = GX_FALSE;
84         }
85 
86         for(index = 0; index < 6; index ++)
87         {
88             switch(index)
89             {
90             case 0:
91                 xcenter = 213;
92                 ycenter = 230;
93                 start_angle = 90;
94                 end_angle = 270;
95                 radius = 213;
96                 break;
97 
98             case 1:
99                 start_angle = 90;
100                 end_angle = 330;
101                 radius = 254;
102                 break;
103 
104             case 2:
105                 start_angle = 38;
106                 end_angle = 360;
107                 radius = 1792;
108                 break;
109 
110             case 3:
111                 start_angle = 326;
112                 end_angle = 124;
113                 radius = 400;
114                 break;
115 
116             case 4:
117                 xcenter = 400;
118                 ycenter = 500;
119                 start_angle = 0;
120                 end_angle = 83;
121                 radius = 88;
122                 break;
123 
124             case 5:
125                 xcenter = 213;
126                 ycenter = 230;
127                 start_angle = 350;
128                 end_angle = 640;
129                 radius = 254;
130                 break;
131             }
132 
133             sprintf(test_comment, "alias = %d, xcenter = %d, ycenter = %d, start_angle = %d, end_angle = %d, radius = %d",
134                     alias, xcenter, ycenter, start_angle, end_angle, radius);
135             gx_validation_set_frame_id(frame_id++);
136             gx_validation_set_frame_comment(test_comment);
137             gx_validation_screen_refresh();
138         }
139     }
140 
141     /* Signal the end of the test case, Verify the outout.  */
142     gx_validation_end();
143 
144     exit(0);
145 }
146