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_pie_32bpp", /* Test name */
10     24, 43, 370, 402  /* Define the coordinates of the capture area.
11                          In this test, we only need to capture the graphics
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 typedef struct PIE_PROPS_STRUCT{
60 INT start_angle;
61 INT end_angle;
62 INT brush_width;
63 INT solid_fill;
64 INT pixelmap_fill;
65 INT alpha_mode;
66 INT compress_mode;
67 }PIE_PROPS;
68 
69 PIE_PROPS pie_props[]={
70     {0, 90, 1, 0, 0, 0, 0},
71     {10, 30, 2, 1, 0, 0, 0},
72     {10, 65, 3, 0, 1, 0, 0},
73     {100, 115, 5, 0, 1, 0, 1},
74     {110, 175, 7, 0, 1, 2, 0},
75     {180, 190, 9, 0, 1, 2, 1},
76     {185, -115, 10, 1, 0, 0, 0},
77     {-10, -55, 12, 1, 0, 0, 0},
78     {15, 175, 13, 1, 0, 0, 0},
79     {16, 260, 14, 1, 0, 0, 0},
80     {25, 335, 15, 1, 0, 0, 0},
81     {115, 200, 16, 1, 0, 0, 0},
82     {160, 300, 17, 1, 0, 0, 0},
83     {210, 355, 18, 1, 0, 0, 0},
84     {80, 355, 18, 1, 0, 0, 0},
85     {80, 380, 18, 1, 0, 0, 0},
86     {210, 380, 18, 1, 0, 0, 0}
87 };
88 
89 char test_comment[256];
90 
91 static INT brush_alpha_value[] = {0, 155, 255};
92 
93 /* This thread simulates user input.  Its priority is lower
94    than the GUIX thread, so that GUIX finishes an operation
95    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)96 static VOID control_thread_entry(ULONG input)
97 {
98 INT index, brush_alpha_index;
99 INT frame_id = 1;
100 
101     draw_shape = PIE;
102 
103     /* Loop radius from 5 to 200. */
104     for(radius = 1; radius < 200; radius += 50)
105     {
106         for(brush_alpha_index = 0; brush_alpha_index < (INT)(sizeof(brush_alpha_value)/sizeof(INT)); brush_alpha_index++)
107         {
108             brush_alpha = brush_alpha_value[brush_alpha_index];
109 
110             for(index = 0; index < (INT)(sizeof(pie_props)/sizeof(PIE_PROPS)); index++)
111             {
112                 start_angle = pie_props[index].start_angle;
113                 end_angle = pie_props[index].end_angle;
114 
115                 if(radius < 30)
116                 {
117                     brush_width = 1;
118                 }
119                 else
120                 {
121                     brush_width = pie_props[index].brush_width;
122                 }
123 
124                 solid_fill = pie_props[index].solid_fill;
125                 pixelmap_fill = pie_props[index].pixelmap_fill;
126                 alpha = pie_props[index].alpha_mode;
127                 compress = pie_props[index].compress_mode;
128                 pixelmap_index = alpha + compress;
129 
130                /* Set frame id. */
131                gx_validation_set_frame_id(frame_id);
132 
133                frame_id++;
134 
135                /* Set test comments. */
136                sprintf(test_comment, "radius:%d, start_angle:%d, end_angle:%d, brush_width %d, solid_fill:%d, pixelmap_fill:%d, alpha:%d, compress: %d, brush_alpha: %d", radius, start_angle, end_angle, brush_width, solid_fill, pixelmap_fill, alpha, compress, brush_alpha);
137 
138                 gx_validation_set_frame_comment(test_comment);
139 
140                 /* Mark graphics window dirty. */
141                 gx_system_dirty_mark(pGraphicsWin);
142 
143                 /* Force a screen refresh.  */
144                 gx_validation_screen_refresh();
145             }
146         }
147     }
148 
149     /* Signal the end of the test case, Verify the outout.  */
150     gx_validation_end();
151 
152     exit(0);
153 }
154