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_line_8bpp", /* Test name */
10 25, 17, 344, 336 /* Define the coordinates of the capture area.
11 In this test, we only need to capture the line
12 drawing area. */
13 };
14
15
16 static VOID control_thread_entry(ULONG);
main(int argc,char ** argv)17 int main(int argc, char ** argv)
18 {
19 /* Parse the command line argument. */
20 gx_validation_setup(argc, argv);
21
22 /* Start ThreadX system */
23 tx_kernel_enter();
24 return(0);
25 }
26
tx_application_define(void * first_unused_memory)27 VOID tx_application_define(void *first_unused_memory)
28 {
29
30 /* Create a dedicated thread to perform various operations
31 on the line drawing example. These operations simulate
32 user input. */
33 gx_validation_control_thread_create(control_thread_entry);
34
35 /* Termiante the test if it runs for more than 100 ticks */
36 /* This function is not implemented yet. */
37 gx_validation_watchdog_create(100);
38
39 /* Call the actual line example routine. */
40 gx_validation_application_define(first_unused_memory);
41
42 }
43
44
45 /* Replace the default graphics driver with the validation driver. */
46 #ifdef win32_graphics_driver_setup_8bit_palette
47 #undef win32_graphics_driver_setup_8bit_palette
48 #endif
49 #define win32_graphics_driver_setup_8bit_palette gx_validation_graphics_driver_setup_8bit_palette
50
51
52 #ifdef WIN32
53 #undef WIN32
54 #endif
55
56 #include "gx_validation_wrapper.h"
57
58 #include "demo_guix_line_8bpp.c"
59 /* Define the angles values for the line. */
60 static int angle_value[] = {0, 1, 23, 30, 45, 60, 75, 89, 90, 135};
61
62 /* Define the width values for the line.*/
63 static int width_value[] = {1, 2, 3, 5, 10};
64
65 /* Define the anti-alias settings. */
66 static int aa_value[] = {GX_TRUE, GX_FALSE};
67
68 /* Define the line end settings. */
69 static int rounded_value[] = {GX_TRUE, GX_FALSE};
70
71 char test_comment[256];
72 extern GX_STUDIO_DISPLAY_INFO lines_8bpp_display_table[];
73
74 /* This thread simulates user input. Its priority is lower
75 than the GUIX thread, so that GUIX finishes an operation
76 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)77 static VOID control_thread_entry(ULONG input)
78 {
79
80 int angle_index, width_index, aa_index, rounded_index, color_index;
81 int frame_id = 1;
82 GX_CONST GX_THEME *theme_ptr;
83
84 /*Save palette. */
85 theme_ptr = lines_8bpp_display_table[DISPLAY_1].theme_table[0];
86 gx_validation_write_palette(theme_ptr -> theme_palette, theme_ptr->theme_palette_size);
87
88 for(color_index = 0; color_index < (INT)(sizeof(color_list) / sizeof(COLOR_LIST)); color_index ++)
89 {
90 /* Set line color. */
91 line_color = color_list[color_index].color_id;
92
93 for(aa_index = 0; aa_index < 2; aa_index++)
94 {
95 anti_aliased = aa_value[aa_index];
96 for(rounded_index = 0; rounded_index < 2; rounded_index++)
97 {
98 rounded = rounded_value[rounded_index];
99 for(width_index = 0; width_index < (INT)(sizeof(width_value) / sizeof(int)); width_index++)
100 {
101 line_width = width_value[width_index];
102 for(angle_index = 0; angle_index < (INT)(sizeof(angle_value) / sizeof(int)); angle_index++)
103 {
104
105 /* Inform the validation system
106 (1) Frame ID, which identifies a specific test configuration;
107 (2) Start recording frame on the next toggle operation.
108 */
109 gx_validation_set_frame_id(frame_id);
110
111 /* Set the line angle value */
112 line_angle = angle_value[angle_index];
113
114 sprintf(test_comment, "color: %d width %d angle %d", color_index, line_width, line_angle);
115 if(anti_aliased)
116 strcat(test_comment, "anti-aliased ");
117 if(rounded)
118 strcat(test_comment, "round end ");
119
120 gx_validation_set_frame_comment(test_comment);
121
122 /* Mark the window "dirty" */
123 gx_system_dirty_mark(pLineWin);
124
125 /* Force a screen refresh. */
126 gx_validation_screen_refresh();
127
128 /* Increment frame ID */
129 frame_id ++;
130 }
131 }
132 }
133 }
134 }
135 /* Signal the end of the test case. Verify the output. */
136 gx_validation_end();
137
138 exit(0);
139 }
140
141
142
143
144
145