MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / doTest

Function doTest

util/fbxvtest.c:94–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94static int doTest(int id, char *name)
95{
96 int iter = 0, i, retval = 0;
97 double elapsed = 0., t;
98 FILE *file = NULL;
99
100 printf("Testing %s format (ID=0x%.8x) %s...\n", name, id,
101 useShm ? "[SHM] " : "");
102
103 memset(&s, 0, sizeof(s));
104 memset(&s1, 0, sizeof(s));
105 TRY_FBXV(fbxv_init(&s, dpy, win, width / scale, height / scale, id, useShm));
106 if(!filename)
107 {
108 TRY_FBXV(fbxv_init(&s1, dpy, win, width / scale, height / scale, id,
109 useShm));
110 }
111 printf("Image:\n");
112 printf(" Data size: %d\n", s.xvi->data_size);
113 printf(" Dimensions: %d x %d\n", s.xvi->width, s.xvi->height);
114 printf(" Planes: %d\n", s.xvi->num_planes);
115 printf(" Pitches: [");
116 for(i = 0; i < s.xvi->num_planes; i++)
117 {
118 printf("%d", s.xvi->pitches[i]);
119 if(i != s.xvi->num_planes - 1) printf(", ");
120 }
121 printf("]\n");
122 printf(" Offsets: [");
123 for(i = 0; i < s.xvi->num_planes; i++)
124 {
125 printf("%d", s.xvi->offsets[i]);
126 if(i != s.xvi->num_planes - 1) printf(", ");
127 }
128 printf("]\n");
129 printf("XV Port = %d\n", s.port);
130
131 if(filename)
132 {
133 file = fopen(filename, "rb");
134 if(!file)
135 {
136 printf("Could not open %s\n", filename);
137 exit(-1);
138 }
139 if(fread(s.xvi->data, s.xvi->data_size, 1, file) != 1)
140 {
141 printf("Could not read %s\n", filename);
142 exit(-1);
143 }
144 fclose(file);
145 }
146
147 if(!filename)
148 {
149 initBuf(&s, id, 0);
150 initBuf(&s1, id, 128);
151 }

Callers 1

mainFunction · 0.70

Calls 5

fbxv_initFunction · 0.85
GetTimeFunction · 0.85
fbxv_writeFunction · 0.85
fbxv_termFunction · 0.85
initBufFunction · 0.70

Tested by

no test coverage detected