Bug with 320x200 fullscreen mode in 1.27. under OS X

First, I believe that the archive SDL-1.2.7.sea.bin
has missing files, namely
src/cdrom/macosx/SDL_syscdrom_c.h, src/cdrom/CAGuard.h
and src/cdrom/AudioFilePlayer.h.

Next, there is a problem with using 320x200 fullscreen
mode using SDL library v. 1.2.7. A program requesting
320x200 fullscreen mode should put a 320x200 image in
the center of the screen, but it actually only
displays the upper-left corner of the image!

The problem seems to be in SDL_ThreadFlip() in the
file src/video/quartz/SDL_QuartzVideo.m

The lines
dst = CGDisplayBaseAddress (display_id);
src = current_buffer;
len = SDL_VideoSurface->w *
SDL_VideoSurface->format->BytesPerPixel;

Should be something like
dst = CGDisplayBaseAddress (display_id);
src = current_buffer;
src += current_video->offset_x *
SDL_VideoSurface->format->BytesPerPixel +
current_video->offset_y * SDL_VideoSurface->pitch;
dst += current_video->offset_x *
SDL_VideoSurface->format->BytesPerPixel +
current_video->offset_y * SDL_VideoSurface->pitch;
len = SDL_VideoSurface->w *
SDL_VideoSurface->format->BytesPerPixel;

The problem is that SDL_VideoSurface->h and
SDL_VideoSurface->w refer to the size of the displayed
image, not the size of the actual screen. Thus, you
need to calculate the offset in order to copy the
right pixels.

It works as far as I can tell.

There is another problem though. If the mouse pointer
is not over the display image when the program starts
up in 320x200x8bit fullscreen mode, it will leave a
square that will not disappear!

A test program is available upon request.__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com

I probably should have mentioned that the bug occurs
when using the double-buffered fullscreen 320x200
mode. (Double buffering seems to work fine in 640x480,
though)

The test program I mentioned earlier is attached. It
is based on testbitmap.c from the SDL test suite. It
needs no additional files, though. Just compile and
run it.

— John Tanner <@John_Tanner> wrote:> Next, there is a problem with using 320x200

fullscreen
mode using SDL library v. 1.2.7. A program
requesting
320x200 fullscreen mode should put a 320x200 image
in
the center of the screen, but it actually only
displays the upper-left corner of the image!

A test program is available upon request.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed…
Name: testscreen.c
Type: application/octet-stream
Size: 2291 bytes
Desc: testscreen.c
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041013/23e80363/attachment.obj

320x200 seems like an odd mode to me. maybe thats the problem. why dont you use a standard mode like 320x240?

John Tanner wrote:> I probably should have mentioned that the bug occurs

when using the double-buffered fullscreen 320x200
mode. (Double buffering seems to work fine in 640x480,
though)

The test program I mentioned earlier is attached. It
is based on testbitmap.c from the SDL test suite. It
needs no additional files, though. Just compile and
run it.

— John Tanner wrote:

Next, there is a problem with using 320x200
fullscreen
mode using SDL library v. 1.2.7. A program
requesting
320x200 fullscreen mode should put a 320x200 image
in
the center of the screen, but it actually only
displays the upper-left corner of the image!

A test program is available upon request.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

— Florian Hufsky wrote:

320x200 seems like an odd mode to me. maybe thats the problem. why dont you use a standard mode like 320x240?

320x200x8 bit is good ol’ 256 color VGA on PCs. I ran
into this when porting a PC program (namely, an
Intellivision emulator) to Mac OS X. Besides, my Mac’s
smallest screen resolution is 640x480. 320x240 would
produce the same bug. You see, the problem lies in
trying to get a double-buffered fullscreen mode that
is smaller than the smallest mode the Mac provides.

As I have said before, I believe I have isolated the
problem in QZ_ThreadFlip(), and tweaked the SDL source
code to fix SDL, as far as I can tell. See my earlier
posts.

Until the official SDL is patched, there is another
workaround for OS X programs. Simply request only
screen resolutions that are exactly supported, and
handle the offsets, clippings, and such yourself.

John Tanner_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com