summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/powervr/QWSWSEGL
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-16 06:45:55 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-16 06:52:19 (GMT)
commit75719e4e06882825fe056935d782b4153bf0ac5b (patch)
treead85ada002fda88d31afefb18c36b03a567de338 /src/plugins/gfxdrivers/powervr/QWSWSEGL
parent8e4fa6e87f74cfb3457e8270a361cf30ca7d3593 (diff)
downloadQt-75719e4e06882825fe056935d782b4153bf0ac5b.zip
Qt-75719e4e06882825fe056935d782b4153bf0ac5b.tar.gz
Qt-75719e4e06882825fe056935d782b4153bf0ac5b.tar.bz2
Make screen rotation work properly with the PowerVR screen driver
Task-number: QT-2261 Reviewed-by: Tom
Diffstat (limited to 'src/plugins/gfxdrivers/powervr/QWSWSEGL')
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c10
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h3
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h1
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c14
4 files changed, 26 insertions, 2 deletions
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
index ac9dc8d..c1b655a 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
@@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect)
*rect = drawable->rect;
}
+void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle)
+{
+ if (drawable->rotationAngle != angle) {
+ drawable->rotationAngle = angle;
+
+ /* Force the buffers to be recreated if the rotation angle changes */
+ pvrQwsInvalidateBuffers(drawable);
+ }
+}
+
int pvrQwsGetStride(PvrQwsDrawable *drawable)
{
if (drawable->backBuffersValid)
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
index 952ff6f..b9e035f 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
@@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect);
/* Get the current geometry for a drawable */
void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect);
+/* Set the rotation angle in degrees */
+void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle);
+
/* Get the line stride for a drawable. Returns zero if the buffers
are not allocated or have been invalidated */
int pvrQwsGetStride(PvrQwsDrawable *drawable);
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
index cf80a90..dcd4e4f 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
@@ -114,6 +114,7 @@ struct _PvrQwsDrawable
int isFullScreen;
int strideBytes;
int stridePixels;
+ int rotationAngle;
PvrQwsSwapFunction swapFunction;
void *userData;
PvrQwsDrawable *nextWinId;
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
index 253f39f..28b2251 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
@@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display)
return WSEGL_SUCCESS;
}
+static WSEGLRotationAngle wseglRotationValue(int degrees)
+{
+ switch (degrees) {
+ case 90: return WSEGL_ROTATE_90;
+ case 180: return WSEGL_ROTATE_180;
+ case 270: return WSEGL_ROTATE_270;
+ default: return WSEGL_ROTATE_0;
+ }
+}
+
/* Create the WSEGL drawable version of a native window */
static WSEGLError wseglCreateWindowDrawable
(WSEGLDisplayHandle display, WSEGLConfig *config,
@@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable
*drawable = (WSEGLDrawableHandle)screen;
if (!pvrQwsAllocBuffers(screen))
return WSEGL_OUT_OF_MEMORY;
- *rotationAngle = WSEGL_ROTATE_0;
+ *rotationAngle = wseglRotationValue(screen->rotationAngle);
return WSEGL_SUCCESS;
}
@@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable
/* The drawable is ready to go */
*drawable = (WSEGLDrawableHandle)draw;
- *rotationAngle = WSEGL_ROTATE_0;
+ *rotationAngle = wseglRotationValue(draw->rotationAngle);
if (!pvrQwsAllocBuffers(draw))
return WSEGL_OUT_OF_MEMORY;
return WSEGL_SUCCESS;