PRBool
nsGLPbufferGLX::Resize(PRInt32 width, PRInt32 height)
{
    if (mWidth == width &&
        mHeight == height)
    {
        return PR_TRUE;
    }

    Destroy();

    mThebesSurface = new gfxImageSurface(gfxIntSize(width, height), gfxASurface::ImageFormatARGB32);
    if (mThebesSurface->CairoStatus() != 0) {
        fprintf (stderr, "image surface failed\n");
        return PR_FALSE;
    }

    // clear the surface
    memset (mThebesSurface->Data(),
            0,
            height * mThebesSurface->Stride());

    int attrib[] = { GLX_PBUFFER_WIDTH, width,
                     GLX_PBUFFER_HEIGHT, height,
                     None };

    mPbuffer = gGLXWrap.fCreatePbuffer(mDisplay, mFBConfig, attrib);
    gGLXWrap.fMakeContextCurrent(mDisplay, mPbuffer, mPbuffer, mPbufferContext);

    mWidth = width;
    mHeight = height;

    fprintf (stderr, "Resize: %d %d\n", width, height);
    return PR_TRUE;
}
void
nsGLPbufferGLX::MakeContextCurrent()
{
    if (gGLXWrap.fGetCurrentContext() != mPbufferContext)
        gGLXWrap.fMakeContextCurrent(mDisplay, mPbuffer, mPbuffer, mPbufferContext);
}