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_circle_32bpp", /* Test name */
10 28, 24, 400, 425 /* 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 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
60
61 static int radius_value[]={1, 100, 200, 210};
62
63 static int brush_value[]={0, 1, 10};
64
65
66 static int fill_color_value[]={GX_COLOR_ID_CANVAS, GX_COLOR_ID_SCROLL_BUTTON};
67
68 static int wallpaper_value[] = {GX_NULL, GX_PIXELMAP_ID_CHECKBOX_OFF};
69
70 static int brush_alpha_value[] = {0, 155, 255};
71
72 static int pixelmap_fill_value[] = {GX_FALSE, GX_TRUE};
73
74 char test_comment[256];
75
76 /* This thread simulates user input. Its priority is lower
77 than the GUIX thread, so that GUIX finishes an operation
78 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)79 static VOID control_thread_entry(ULONG input)
80 {
81 int b_index,r_index, wallpaper_index, fill_color_index, brush_alpha_index, pixelmap_fill_index, pixelmap_id_index, a_index;
82 int frame_id = 1;
83 GX_SLIDER *slider_b;
84 GX_SLIDER *slider_r;
85 int index;
86
87 gx_widget_find(pMainWin, ID_RADIUS_SLIDER, 0, &slider_r);
88 gx_widget_find(pMainWin, ID_BRUSH_WIDTH, 0, &slider_b);
89
90 draw_shape = CIRCLE;
91
92 for(wallpaper_index = 0; wallpaper_index < (INT)(sizeof(wallpaper_value)/sizeof(INT)); wallpaper_index++)
93 {
94 for(brush_alpha_index = 0; brush_alpha_index < (INT)(sizeof(brush_alpha_value)/sizeof(INT)); brush_alpha_index++)
95 {
96 brush_alpha = brush_alpha_value[brush_alpha_index];
97
98 for(fill_color_index = 0; fill_color_index < (INT)(sizeof(fill_color_value)/sizeof(INT)); fill_color_index++ )
99 {
100 fill_color = fill_color_value[fill_color_index];
101 for(b_index = 0; b_index < (INT)(sizeof(brush_value) / sizeof(int)); b_index++)
102 {
103 gx_slider_value_set(slider_b, &slider_b -> gx_slider_info, brush_value[b_index]);
104
105 for(r_index = 0; r_index < (INT)(sizeof(radius_value) / sizeof(int)); r_index++)
106 {
107 for(pixelmap_fill_index = 0; pixelmap_fill_index < (INT)(sizeof(pixelmap_fill_value)/sizeof(INT)); pixelmap_fill_index++)
108 {
109 pixelmap_fill = pixelmap_fill_value[pixelmap_fill_index];
110 for(a_index = 0; a_index < 2; a_index++)
111 {
112 anti_aliased = (GX_BOOL)a_index;
113 if(pixelmap_fill)
114 {
115 for(pixelmap_id_index = 0; pixelmap_id_index < (INT)(sizeof(pixelmap_id)/sizeof(INT)); pixelmap_id_index++)
116 {
117 pixelmap_index = pixelmap_id_index;
118
119 /* Inform the validation system
120 (1) Frame ID, which identifies a specific test configuration;
121 (2) Start recording frame on the next toggle operation.
122 */
123 gx_validation_set_frame_id(frame_id);
124
125 /* Set the vertical slider value */
126 gx_slider_value_set(slider_r, &slider_r -> gx_slider_info, radius_value[r_index]);
127
128 sprintf(test_comment, "brush width %d, brush_alpha:%d, radius %d, pixelmap_index: %d", brush_value[b_index], brush_alpha, radius_value[r_index], pixelmap_index);
129
130 gx_validation_set_frame_comment(test_comment);
131
132 /* Mark the window "dirty" */
133 gx_system_dirty_mark(pGraphicsWin);
134
135 /* Force a screen refresh. */
136 gx_validation_screen_refresh();
137
138 /* Increment frame ID */
139 frame_id ++;
140
141
142 }
143 }
144 else
145 {
146 /* Inform the validation system
147 (1) Frame ID, which identifies a specific test configuration;
148 (2) Start recording frame on the next toggle operation.
149 */
150 gx_validation_set_frame_id(frame_id);
151
152 /* Set the vertical slider value */
153 gx_slider_value_set(slider_r, &slider_r -> gx_slider_info, radius_value[r_index]);
154
155 sprintf(test_comment, "brush width %d, brush_alpha:%d, radius %d, ", brush_value[b_index], brush_alpha, radius_value[r_index]);
156
157 gx_validation_set_frame_comment(test_comment);
158
159 /* Mark the window "dirty" */
160 gx_system_dirty_mark(pGraphicsWin);
161
162 /* Force a screen refresh. */
163 gx_validation_screen_refresh();
164
165 /* Increment frame ID */
166 frame_id ++;
167
168 }
169 }
170 }
171 }
172 }
173 }
174 }
175
176 }
177
178 brush_alpha = 255;
179 anti_aliased = GX_TRUE;
180
181 for(index = 0; index < 4; index++)
182 {
183 switch(index)
184 {
185 case 0:
186 brush_width = 1;
187 radius = 300;
188 sprintf(test_comment, "brush_width = 1, radius = 300");
189 break;
190
191 case 1:
192 brush_width = 2;
193 sprintf(test_comment, "brush_width = 2, radius = 300");
194 break;
195
196 case 2:
197 brush_width = 1;
198 root->gx_window_root_canvas->gx_canvas_display->gx_display_driver_pixel_blend = GX_NULL;
199 sprintf(test_comment, "brush_width = 1, pixel_blend = null");
200 break;
201
202 case 3:
203 brush_width = 2;
204 sprintf(test_comment, "brush_width = 2, pixel_blend = null");
205 break;
206 }
207
208 gx_validation_set_frame_id(frame_id++);
209 gx_validation_set_frame_comment(test_comment);
210 gx_validation_screen_refresh();
211 }
212
213 /* Signal the end of the test case. Verify the output. */
214 gx_validation_end();
215
216 exit(0);
217 }
218
219
220
221
222
223