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_shape_fill", /* Test name */
10     28, 24, 400, 430  /* 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_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 #include "demo_guix_graphics_32bpp.c"
57 
58 char test_comment[255];
59 
60 GX_CONST UINT test_pixelmap_data[256];
61 
62 GX_CONST GX_PIXELMAP test_pixelmap_1=
63 {
64     0x00000001,
65     0x00000000,
66     0,
67     GX_COLOR_FORMAT_32ARGB,
68     (GX_UBYTE *)test_pixelmap_data,
69     sizeof(test_pixelmap_data),
70     NULL,
71     0,
72     0x00,
73     16,
74     0
75 };
76 
77 GX_CONST GX_PIXELMAP test_pixelmap_2=
78 {
79     0x00000001,
80     0x00000000,
81     0,
82     GX_COLOR_FORMAT_32ARGB,
83     (GX_UBYTE *)test_pixelmap_data,
84     sizeof(test_pixelmap_data),
85     NULL,
86     0,
87     0x00,
88     0,
89     16
90 };
91 
92 GX_CONST GX_PIXELMAP *test_pixelmap_table[]=
93 {
94     GX_NULL,
95     &test_pixelmap_1,
96     &test_pixelmap_2
97 };
98 
99 #define TEST_MAP_ID_1 1
100 #define TEST_MAP_ID_2 2
101 
102 INT shape_ids[]=
103 {
104 CIRCLE,
105 ARC,
106 PIE,
107 POLYGON,
108 ELLIPSE
109 };
110 
111 /* This thread simulates user input.  Its priority is lower
112    than the GUIX thread, so that GUIX finishes an operation
113    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)114 static VOID control_thread_entry(ULONG input)
115 {
116 INT  frame_id = 1;
117 UINT index;
118 
119     gx_display_pixelmap_table_set(root->gx_window_root_canvas->gx_canvas_display, (GX_PIXELMAP **)test_pixelmap_table, 3);
120 
121     pixelmap_id[0] = TEST_MAP_ID_1;
122     pixelmap_id[1] = TEST_MAP_ID_2;
123 
124     solid_fill = GX_TRUE;
125     pixelmap_fill = GX_TRUE;
126 
127     for(pixelmap_index = 0; pixelmap_index < 2; pixelmap_index++)
128     {
129         for(index = 0; index < sizeof(shape_ids)/sizeof(int); index++)
130         {
131             draw_shape = shape_ids[index];
132 
133             sprintf(test_comment, "pixelmap id = %d, shape id = %d", pixelmap_index, draw_shape);
134 
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 output. */
142     gx_validation_end();
143 
144     exit(0);
145 }
146