Example #1
0
PvrEglWindowSurface::PvrEglWindowSurface
        (QWidget *widget, PvrEglScreen *screen, int screenNum)
    : QWSGLWindowSurface(widget)
{
    setSurfaceFlags(QWSWindowSurface::Opaque);

    this->widget = widget;
    this->screen = screen;
    this->pdevice = 0;

    QPoint pos = offset(widget);
    QSize size = widget->size();

    PvrQwsRect pvrRect;
    pvrRect.x = pos.x();
    pvrRect.y = pos.y();
    pvrRect.width = size.width();
    pvrRect.height = size.height();
    transformRects(&pvrRect, 1);

    // Try to recover a previous PvrQwsDrawable object for the widget
    // if there is one.  This can happen when a PvrEglWindowSurface
    // is created for a widget, bound to a EGLSurface, and then destroyed.
    // When a new PvrEglWindowSurface is created for the widget, it will
    // pick up the previous PvrQwsDrawable if the EGLSurface has not been
    // destroyed in the meantime.
    drawable = pvrQwsFetchWindow((long)widget);
    if (drawable)
        pvrQwsSetGeometry(drawable, &pvrRect);
    else
        drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect);
    pvrQwsSetRotation(drawable, screen->transformation());
}
Example #2
0
/* Create the WSEGL drawable version of a native window */
static WSEGLError wseglCreateWindowDrawable
    (WSEGLDisplayHandle display, WSEGLConfig *config,
     WSEGLDrawableHandle *drawable, NativeWindowType nativeWindow,
     WSEGLRotationAngle *rotationAngle)
{
    PvrQwsDrawable *draw;

    WSEGL_UNUSED(display);
    WSEGL_UNUSED(config);

    /* Check for special handles that indicate framebuffer screens */
    if (nativeWindow >= (NativeWindowType)0 &&
            nativeWindow < (NativeWindowType)PVRQWS_MAX_SCREENS) {
        PvrQwsDrawable *screen = pvrQwsScreenWindow((int)nativeWindow);
        if (!screen)
            return WSEGL_OUT_OF_MEMORY;
        *drawable = (WSEGLDrawableHandle)screen;
        if (!pvrQwsAllocBuffers(screen))
            return WSEGL_OUT_OF_MEMORY;
        *rotationAngle = wseglRotationValue(screen->rotationAngle);
        return WSEGL_SUCCESS;
    }

    /* The native window is the winId - fetch the underlying drawable */
    draw = pvrQwsFetchWindow((long)nativeWindow);
    if (!draw)
        return WSEGL_BAD_DRAWABLE;

    /* The drawable is ready to go */
    *drawable = (WSEGLDrawableHandle)draw;
    *rotationAngle = wseglRotationValue(draw->rotationAngle);
    if (!pvrQwsAllocBuffers(draw))
        return WSEGL_OUT_OF_MEMORY;
    return WSEGL_SUCCESS;
}