예제 #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());
}
예제 #2
0
bool PvrEglWindowSurface::move(const QPoint &offset)
{
    QRect rect = geometry().translated(offset); 
    if (drawable) {
        PvrQwsRect pvrRect;
        pvrRect.x = rect.x();
        pvrRect.y = rect.y();
        pvrRect.width = rect.width();
        pvrRect.height = rect.height();
        pvrQwsSetGeometry(drawable, &pvrRect);
    }
    return QWSGLWindowSurface::move(offset);
}
예제 #3
0
void PvrEglWindowSurface::setGeometry(const QRect &rect)
{
    if (drawable) {
        // XXX: adjust for the screen offset.
        PvrQwsRect pvrRect;
        pvrRect.x = rect.x();
        pvrRect.y = rect.y();
        pvrRect.width = rect.width();
        pvrRect.height = rect.height();
        pvrQwsSetGeometry(drawable, &pvrRect);
    }
    QWSGLWindowSurface::setGeometry(rect);
}