static void _glitz_agl_add_format (glitz_agl_thread_info_t *thread_info, glitz_int_drawable_format_t *format, AGLPixelFormat pixel_format) { if (!glitz_drawable_format_find (thread_info->formats, thread_info->n_formats, GLITZ_DRAWABLE_FORMAT_ALL_EXCEPT_ID_MASK, format, 0)) { int n = thread_info->n_formats; thread_info->formats = realloc (thread_info->formats, sizeof (glitz_int_drawable_format_t) * (n + 1)); thread_info->pixel_formats = realloc (thread_info->pixel_formats, sizeof (AGLPixelFormat) * (n + 1)); if (thread_info->formats && thread_info->pixel_formats) { thread_info->formats[n] = *(glitz_int_drawable_format_t*)format; thread_info->formats[n].d.id = n; thread_info->pixel_formats[n] = pixel_format; thread_info->n_formats++; } } }
glitz_drawable_format_t * glitz_agl_find_pbuffer_format (unsigned long mask, const glitz_drawable_format_t *templ, int count) { glitz_int_drawable_format_t itempl; glitz_agl_thread_info_t *thread_info = glitz_agl_thread_info_get (); glitz_drawable_format_copy (templ, &itempl.d, mask); itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK; mask |= GLITZ_INT_FORMAT_PBUFFER_MASK; return glitz_drawable_format_find (thread_info->formats, thread_info->n_formats, mask, &itempl, count); }
glitz_drawable_format_t * glitz_wgl_find_window_format (unsigned long mask, const glitz_drawable_format_t *templ, int count) { glitz_int_drawable_format_t itempl; glitz_wgl_screen_info_t *screen_info = glitz_wgl_screen_info_get (); glitz_drawable_format_copy (templ, &itempl.d, mask); itempl.types = GLITZ_DRAWABLE_TYPE_WINDOW_MASK; mask |= GLITZ_INT_FORMAT_WINDOW_MASK; return glitz_drawable_format_find (screen_info->formats, screen_info->n_formats, mask, &itempl, count); }
/** * glitz_glx_find_pbuffer_format: * @display: an X Display * @screen: X Screen number where the window will be displayed * @mask: Format mask value * @templ: Format template which is be used in matching the drawable format * @count: Index number of found matching drawable format * * This function return the drawable format for a pixel buffer object that best * meets template format. The sort order of founds format follow GLX 1.3 * specification, you can safely choose the first format found (0). * * Return value: The @count index format drawable which matches template or nil * if no format matches. **/ glitz_drawable_format_t * glitz_glx_find_pbuffer_format (Display *display, int screen, unsigned long mask, const glitz_drawable_format_t *templ, int count) { glitz_int_drawable_format_t itempl; glitz_glx_screen_info_t *screen_info = glitz_glx_screen_info_get (display, screen); glitz_drawable_format_copy (templ, &itempl.d, mask); itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK; mask |= GLITZ_INT_FORMAT_PBUFFER_MASK; return glitz_drawable_format_find (screen_info->formats, screen_info->n_formats, mask, &itempl, count); }