static CoglHandle _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) { CoglHandle tex; int i; /* We try getting the texture twice, once without flushing the updates and once with. If pre_paint has been called already then we should have a good idea of which texture to use so we don't want to mess with that by ensuring the updates. However, if we couldn't find a texture then we'll just make a best guess by flushing without expecting mipmap support and try again. This would happen for example if an application calls get_gl_texture before the first paint */ for (i = 0; i < 2; i++) { #ifdef COGL_HAS_GLX_SUPPORT if (tex_pixmap->use_glx_texture) tex = tex_pixmap->glx_tex; else #endif tex = tex_pixmap->tex; if (tex) return tex; _cogl_texture_pixmap_x11_update (tex_pixmap, FALSE); } g_assert_not_reached (); return COGL_INVALID_HANDLE; }
static void _cogl_texture_pixmap_x11_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) { CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); CoglTexture *child_tex; _cogl_texture_pixmap_x11_update (tex_pixmap, !!(flags & COGL_TEXTURE_NEEDS_MIPMAP)); child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); _cogl_texture_pre_paint (child_tex, flags); }
static CoglTexture * _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) { CoglTexturePixmapX11 *original_pixmap = tex_pixmap; CoglTexture *tex; int i; CoglTexturePixmapStereoMode stereo_mode = tex_pixmap->stereo_mode; if (stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) tex_pixmap = tex_pixmap->left; /* We try getting the texture twice, once without flushing the updates and once with. If pre_paint has been called already then we should have a good idea of which texture to use so we don't want to mess with that by ensuring the updates. However, if we couldn't find a texture then we'll just make a best guess by flushing without expecting mipmap support and try again. This would happen for example if an application calls get_gl_texture before the first paint */ for (i = 0; i < 2; i++) { if (tex_pixmap->use_winsys_texture) { const CoglWinsysVtable *winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); tex = winsys->texture_pixmap_x11_get_texture (tex_pixmap, stereo_mode); } else tex = tex_pixmap->tex; if (tex) return tex; _cogl_texture_pixmap_x11_update (original_pixmap, FALSE); } g_assert_not_reached (); return NULL; }