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_palette_ellipse", /* Test name */
10      28, 24, 370, 402  /* Define the coordinates of the capture area.
11                          In this test, we only need to capture the pixelmap
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 line 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_8bit_palette
46 #undef win32_graphics_driver_setup_8bit_palette
47 #endif
48 #define win32_graphics_driver_setup_8bit_palette  gx_validation_graphics_driver_setup_8bit_palette
49 
50 
51 #ifdef WIN32
52 #undef WIN32
53 #endif
54 
55 #include "gx_validation_wrapper.h"
56 #include "demo_guix_graphics_palette.c"
57 
58 char test_comment[255];
59 extern GX_STUDIO_DISPLAY_INFO graphics_palette_display_table[];
60 
61 GX_BOOL style_status[2] = {GX_TRUE, GX_FALSE};
62 INT     brush_width_value[] = {0, 1, 9, 13};
63 GX_RESOURCE_ID fill_pixelmap_id[] = {GX_PIXELMAP_ID_RAW, GX_PIXELMAP_ID_COMPRESSED, GX_PIXELMAP_ID_TRANSPARENT, GX_PIXELMAP_ID_CMOPRESSED_TRANSPARENT};
64 /* This thread simulates user input.  Its priority is lower
65    than the GUIX thread, so that GUIX finishes an operation
66    before this thread is able to issue the next command. */
67 
control_thread_entry(ULONG input)68 static VOID control_thread_entry(ULONG input)
69 {
70 int frame_id = 1;
71 GX_CONST GX_THEME *theme_ptr;
72 INT anti_aliased_index, solid_fill_index;
73 INT radius_index, brush_width_index;
74 INT compressed, transparent;
75 
76     draw_shape = ELLIPSE;
77 
78     /* Save palette info. */
79     theme_ptr = graphics_palette_display_table[DISPLAY_1].theme_table[DISPLAY_1_DEFAULT_THEME];
80     gx_validation_write_palette(theme_ptr -> theme_palette, theme_ptr->theme_palette_size);
81 
82     for(anti_aliased_index = 0; anti_aliased_index < (INT)(sizeof(style_status)/sizeof(INT)); anti_aliased_index++)
83     {
84         anti_aliased = style_status[anti_aliased_index];
85         for(solid_fill_index = 0; solid_fill_index < (INT)(sizeof(style_status)/sizeof(INT)); solid_fill_index++)
86         {
87             solid_fill = style_status[solid_fill_index];
88             for(pixelmap_fill = 0; pixelmap_fill < (INT)(sizeof(style_status)/sizeof(INT)); pixelmap_fill++)
89             {
90                 for(radius_index = 5; radius_index <= 100; radius_index += 33)
91                 {
92                     a = radius_index;
93                     b = 100 - radius_index;
94                     for(brush_width_index = 0; brush_width_index < (INT)(sizeof(brush_width_value)/sizeof(INT)); brush_width_index ++ )
95                     {
96                         brush_width = brush_width_value[brush_width_index];
97 
98 
99                         sprintf(test_comment, "a:%d, b:%d, brush_width:%d, ",  a, b, brush_width);
100 
101                         if(anti_aliased)
102                         {
103                             strcat(test_comment, "anti_aliased, ");
104                         }
105                         else
106                         {
107                             strcat(test_comment, "No anti_aliased, ");
108                         }
109 
110                         if(pixelmap_fill)
111                         {
112                             strcat(test_comment, "pixelmap fill: ");
113 
114                             for(compressed = 0; compressed <= 1; compressed++)
115                             {
116                                 for(transparent = 0; transparent <= 2; transparent+=2)
117                                 {
118                                     pixelmap_id = compressed + transparent;
119 
120                                     if(compressed)
121                                     {
122                                         strcat(test_comment, "compressed: true, ");
123                                     }
124                                     else
125                                     {
126                                         strcat(test_comment, "compressed: false, ");
127                                     }
128 
129                                     if(transparent)
130                                     {
131                                         strcat(test_comment, "transparent: true, ");
132                                     }
133                                     else
134                                     {
135                                         strcat(test_comment, "transparent: false, ");
136                                     }
137                                      gx_validation_set_frame_id(frame_id);
138 
139                                      gx_validation_set_frame_comment(test_comment);
140 
141                                      /* Mark the window "dirty" */
142                                      gx_system_dirty_mark(pMainWin);
143 
144                                      /* Force a screen refresh. */
145                                      gx_validation_screen_refresh();
146 
147                                      /* Increment frame ID */
148                                      frame_id ++;
149 
150                                 }
151                             }
152 
153                         }
154                         else
155                         {
156                             if(solid_fill)
157                             {
158                                 strcat(test_comment, "Solid fill ");
159                             }
160                             else
161                             {
162                                 strcat(test_comment, "No solid fill, ");
163                             }
164 
165                              gx_validation_set_frame_id(frame_id);
166 
167                              gx_validation_set_frame_comment(test_comment);
168 
169                              /* Mark the window "dirty" */
170                              gx_system_dirty_mark(pMainWin);
171 
172                              /* Force a screen refresh. */
173                              gx_validation_screen_refresh();
174 
175                              /* Increment frame ID */
176                              frame_id ++;
177                         }
178 
179                     }
180                 }
181             }
182         }
183     }
184 
185 
186     /* Signal the end of the test case.  Verify the output. */
187     gx_validation_end();
188 
189     exit(0);
190 }
191 
192