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_display_driver_simple_line_alpha_draw", /* Test name */
10 25, 14, 344, 333 /* Define the coordinates of the capture area.
11 In this test, we only need to capture the line
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_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_lines.c"
58 /* Define the angles values for the line. */
59 static int angle_value[] = {0, 1, 23, 75, 89, 90, 135, 244, 345};
60 static GX_RECTANGLE size_list[] =
61 {
62 {25, 14, 344, 333},
63 {25, 14, 185, 174},
64 {25, 14, 160, 150}
65 };
66
67 char test_comment[256];
68
69 /* This thread simulates user input. Its priority is lower
70 than the GUIX thread, so that GUIX finishes an operation
71 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)72 static VOID control_thread_entry(ULONG input)
73 {
74
75 int angle_index, size_index;
76 int frame_id = 1;
77
78 brush_alpha = 155;
79 anti_aliased = GX_FALSE;
80 rounded = GX_FALSE;
81 line_width = 1;
82 line_color = GX_COLOR_ID_RED;
83
84 for(size_index = 0; size_index < (int)(sizeof(size_list)/ sizeof(GX_RECTANGLE)); size_index++)
85 {
86 gx_widget_resize(pLineWin, &size_list[size_index]);
87 for(angle_index = 0; angle_index < (INT)(sizeof(angle_value) / sizeof(int)); angle_index++)
88 {
89 /* Inform the validation system
90 (1) Frame ID, which identifies a specific test configuration;
91 (2) Start recording frame on the next toggle operation.
92 */
93 gx_validation_set_frame_id(frame_id);
94
95 /* Set the line angle value */
96 line_angle = angle_value[angle_index];
97
98 sprintf(test_comment, "width 1, angle %d, brush_alpha: 155", line_angle);
99
100 gx_validation_set_frame_comment(test_comment);
101
102 /* Mark the window "dirty" */
103 gx_system_dirty_mark(pLineWin);
104
105 /* Force a screen refresh. */
106 gx_validation_screen_refresh();
107
108 /* Increment frame ID */
109 frame_id ++;
110 }
111 }
112
113 gx_widget_resize(pLineWin, &size_list[0]);
114 gx_validation_set_frame_id(frame_id);
115
116 /* Set the line angle value */
117 line_angle = 30;
118 root->gx_window_root_canvas->gx_canvas_display->gx_display_driver_pixel_blend = GX_NULL;
119
120 sprintf(test_comment, "Set pixel blend function to GX_NULL. width 1, angle %d, brush_alpha: 155", line_angle);
121
122 gx_validation_set_frame_comment(test_comment);
123
124 /* Mark the window "dirty" */
125 gx_system_dirty_mark(pLineWin);
126
127 /* Force a screen refresh. */
128 gx_validation_screen_refresh();
129
130 /* Signal the end of the test case. Verify the output. */
131 gx_validation_end();
132
133 exit(0);
134 }
135
136
137
138
139
140