MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / best_accum_mode

Function best_accum_mode

platform/mac/pixelformat.cpp:273–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271
272
273static unsigned int best_accum_mode(GLint modes, GLint accum_size) {
274 int best = -1;
275
276 for (int i = 0; i < ARRAY_SIZE(color_modes); i++) {
277 if ((modes & color_modes[i].mode) && color_modes[i].color_bits >= accum_size) {
278 /* Prefer the fewest color bits, then prefer more alpha bits, then
279 prefer more bits per pixel. */
280 if (best < 0) {
281 best = i;
282 } else if (color_modes[i].color_bits < color_modes[best].color_bits) {
283 best = i;
284 } else if (color_modes[i].color_bits == color_modes[best].color_bits) {
285 if (color_modes[i].alpha_bits > color_modes[best].alpha_bits) {
286 best = i;
287 } else if (color_modes[i].alpha_bits == color_modes[best].alpha_bits && color_modes[i].bits_per_pixel > color_modes[best].bits_per_pixel) {
288 best = i;
289 }
290 }
291 }
292 }
293
294 if (best < 0) {
295 /* Couldn't find a match. Return last one that renderer supports. */
296 for (int i = ARRAY_SIZE(color_modes) - 1; i >= 0; i--) {
297 if (modes & color_modes[i].mode) {
298 return i;
299 }
300 }
301 }
302
303 return best;
304}
305
306
307static void enum_renderer_pixel_formats(renderer_properties renderer, CFMutableArrayRef pixel_format_array, CFMutableSetRef pixel_format_set)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected