SDL Qtopia problem with landscape mode

Hello,

I have some problem with the landscape mode of the SDL Qtopia version.
I try to open a 320x240 screen with 8 bit. I also tried it with 16 bit, but
the same problem occurs.

If I set the environment variable SDL_QT_INVERT_ROTATION to 1 the program
works, if I don’t set this variable it segfaults. I have checked with a
debugger where it segfaults in the SDL. See commented code below:

// Sharp Zaurus SL-5500 etc
bool SDL_QWin::repaintRotation3(const QRect& rect)
{
if(my_image->width() == width())
{
// widget width equal image width: portrait mode
ushort fb = (ushort)my_painter->frameBuffer();
ushort buf = (ushort)my_image->bits();
gs_fastRotateBlit_3(fb, buf, rect);
}
else
{
// widget width not equal image width: landscape mode
if (screenRotation == SDL_QT_ROTATION_90)
{
uchar fb = (uchar)my_painter->frameBuffer();
uchar buf = (uchar)my_image->bits();
if(rect == my_image->rect())
{
memcpy(fb, buf, width()*height()*2);
}
else
{
// Rect size when it segfaults: x1: 0, y1: 301, x2: 239, y2:
319
int h = rect.height(); // h = 19
int wd = rect.width()<<1; // wd = 480
int fblineadd = my_painter->lineStep(); // fblineadd = 640
int buflineadd = my_image->bytesPerLine();
fb += (rect.left()<<1) + rect.top() * my_painter->lineStep();
buf += (rect.left()<<1) + rect.top() * my_image->bytesPerLine();
while(h–)
{
memcpy(fb, buf, wd); // <-- segfault happens
fb += fblineadd;
buf += buflineadd;
}
}
}
else if (screenRotation == SDL_QT_ROTATION_270)
{

Maybe someone who better knows the code (David :wink: ) can help. Maybe the
problem is with the rect dimensions? Or must the rect be rotated too? I will
check this later (hopefully I have time in the next days), by making a test
version which alwas calls memcpy for the complete screen.–
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte l?cheln! Fotogalerie online mit GMX ohne eigene Homepage!