summaryrefslogtreecommitdiff
path: root/GL/glx/glxutil.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-06-28 17:00:23 -0400
committerKristian Høgsberg <krh@redhat.com>2006-07-06 00:28:53 -0400
commit7cf3ec7b59223f15314a0629f122ecb796678421 (patch)
tree7ff91618027625ed203a11c05738cd614a92c327 /GL/glx/glxutil.c
parenteea8efe4516750b2505b52ebc9f769f5e8a6f94c (diff)
Move createDrawable from __GLXcontext to __GLXscreen.
Diffstat (limited to 'GL/glx/glxutil.c')
-rw-r--r--GL/glx/glxutil.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
index f1f9c06c5..ed5bafa34 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -140,12 +140,14 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
GLboolean
__glXDrawableInit(__GLXdrawable *drawable,
- __GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
+ __GLXscreen *screen, DrawablePtr pDraw, XID drawId,
+ __GLcontextModes *modes)
{
drawable->type = pDraw->type;
drawable->pDraw = pDraw;
drawable->drawId = drawId;
drawable->refCount = 1;
+ drawable->modes = modes;
/* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
drawable->pGlxPixmap = (__GLXpixmap *)
@@ -167,13 +169,31 @@ __glXFindDrawable(XID drawId)
__GLXdrawable *
__glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
{
+ __GLXscreen *pGlxScreen = ctx->pGlxScreen;
__GLXdrawable *glxPriv;
+ __GLcontextModes *modes;
glxPriv = __glXFindDrawable(drawId);
if (glxPriv == NULL)
{
- glxPriv = ctx->createDrawable(ctx, pDraw, drawId);
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ VisualID vid = wVisual((WindowPtr)pDraw);
+
+ modes = _gl_context_modes_find_visual(pGlxScreen->modes, vid);
+ } else {
+ __GLXpixmap *pGlxPixmap =
+ (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
+
+ /* We never get here without a valid pixmap.
+ * GetDrawableOrPixmap weeds out X Pixmaps without GLX
+ * pixmaps for us. */
+
+ modes = pGlxPixmap->modes;
+ }
+
+ glxPriv =
+ pGlxScreen->createDrawable(ctx->pGlxScreen, pDraw, drawId, modes);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, glxPriv))