예제 #1
0
void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
{
    QWSGLWindowSurface::setDirectRegion(r, id);

    if (!drawable)
        return;

    // Clip the region to the window boundaries in case the child
    // is partially outside the geometry of the parent.
    QWidget *window = widget->window();
    QRegion region = r;
    if (widget != window) {
	QRect rect = window->geometry();
        rect.moveTo(window->mapToGlobal(QPoint(0, 0)));
        region = region.intersect(rect);
    }

    if (region.isEmpty()) {
        pvrQwsClearVisibleRegion(drawable);
    } else if (region.rectCount() == 1) {
        QRect rect = region.boundingRect();
        PvrQwsRect pvrRect;
        pvrRect.x = rect.x();
        pvrRect.y = rect.y();
        pvrRect.width = rect.width();
        pvrRect.height = rect.height();
        transformRects(&pvrRect, 1);
        pvrQwsSetVisibleRegion(drawable, &pvrRect, 1);
        pvrQwsSetRotation(drawable, screen->transformation());
        if (!pvrQwsSwapBuffers(drawable, 1))
            screen->solidFill(QColor(0, 0, 0), region);
    } else {
        QVector<QRect> rects = region.rects();
        PvrQwsRect *pvrRects = new PvrQwsRect [rects.size()];
        for (int index = 0; index < rects.size(); ++index) {
            QRect rect = rects[index];
            pvrRects[index].x = rect.x();
            pvrRects[index].y = rect.y();
            pvrRects[index].width = rect.width();
            pvrRects[index].height = rect.height();
        }
        transformRects(pvrRects, rects.size());
        pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size());
        pvrQwsSetRotation(drawable, screen->transformation());
        if (!pvrQwsSwapBuffers(drawable, 1))
            screen->solidFill(QColor(0, 0, 0), region);
        delete [] pvrRects;
    }
}
예제 #2
0
/* Swap the contents of a drawable to the screen */
static WSEGLError wseglSwapDrawable
    (WSEGLDrawableHandle _drawable, unsigned long data)
{
    WSEGL_UNUSED(data);
    PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable;
    if (drawable->type != PvrQwsPixmap && !pvrQwsSwapBuffers(drawable, 0))
        return WSEGL_BAD_DRAWABLE;
    else
        return WSEGL_SUCCESS;
}