summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp')
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
index 09c0ace..4a3787f 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
@@ -46,14 +46,13 @@
#include <QWSDisplay>
PvrEglWindowSurface::PvrEglWindowSurface
- (QWidget *widget, QScreen *screen, int screenNum)
+ (QWidget *widget, PvrEglScreen *screen, int screenNum)
: QWSGLWindowSurface(widget)
{
setSurfaceFlags(QWSWindowSurface::Opaque);
this->widget = widget;
this->screen = screen;
- this->holder = 0;
this->pdevice = 0;
QPoint pos = offset(widget);
@@ -64,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface
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
@@ -76,9 +76,10 @@ PvrEglWindowSurface::PvrEglWindowSurface
pvrQwsSetGeometry(drawable, &pvrRect);
else
drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
-PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder)
+PvrEglWindowSurface::PvrEglWindowSurface()
: QWSGLWindowSurface()
{
setSurfaceFlags(QWSWindowSurface::Opaque);
@@ -86,9 +87,6 @@ PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder)
widget = 0;
screen = 0;
pdevice = 0;
-
- this->holder = holder;
- holder->addSurface();
}
PvrEglWindowSurface::~PvrEglWindowSurface()
@@ -100,8 +98,6 @@ PvrEglWindowSurface::~PvrEglWindowSurface()
if (drawable && pvrQwsReleaseWindow(drawable))
pvrQwsDestroyDrawable(drawable);
- if (holder)
- holder->removeSurface();
delete pdevice;
}
@@ -119,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect)
pvrRect.y = rect.y();
pvrRect.width = rect.width();
pvrRect.height = rect.height();
+ transformRects(&pvrRect, 1);
pvrQwsSetGeometry(drawable, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
QWSGLWindowSurface::setGeometry(rect);
}
@@ -133,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset)
pvrRect.y = rect.y();
pvrRect.width = rect.width();
pvrRect.height = rect.height();
+ transformRects(&pvrRect, 1);
pvrQwsSetGeometry(drawable, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
return QWSGLWindowSurface::move(offset);
}
@@ -206,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
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 {
@@ -219,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
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;
}
}
+
+void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const
+{
+ switch (screen->transformation()) {
+ case 0: break;
+
+ case 90:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = rects[index].y;
+ int y = screen->height() - (rects[index].x + rects[index].width);
+ rects[index].x = x;
+ rects[index].y = y;
+ qSwap(rects[index].width, rects[index].height);
+ }
+ }
+ break;
+
+ case 180:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = screen->width() - (rects[index].x + rects[index].width);
+ int y = screen->height() - (rects[index].y + rects[index].height);
+ rects[index].x = x;
+ rects[index].y = y;
+ }
+ }
+ break;
+
+ case 270:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = screen->width() - (rects[index].y + rects[index].height);
+ int y = rects[index].x;
+ rects[index].x = x;
+ rects[index].y = y;
+ qSwap(rects[index].width, rects[index].height);
+ }
+ }
+ break;
+ }
+}