We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 673

Summary: X11 renderer texture bad position and VisualStudio compiling problems
Product: SDL Reporter: wictor <viktor.bachraty>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.0   
Hardware: x86   
OS: All   

Description wictor 2009-01-07 18:18:52 UTC
Hi,
I am playing around with SDL 1.3-4341 snapshot under Linux and Windows. I found a couple of bugs:
In VisualStudio 2005 the source does not compile:

1. Missing #include "SDL.h" in sdl_video.c
sdl_video.c(184) : error C2065: 'SDL_INIT_EVENTTHREAD' : undeclared identifier

2.In the Release configuration couple of errors like this pops-up:

error C2169: 'sin' : intrinsic function, cannot be defined

I fixed this by defining  #pragma function(sin,cos,floor,fabs) in SDL_config_win32.h, but maybe there could be a better place in some internal header, because now it causes warnings when compiling programs with SDL.

Under Linux:
Everything compiled fine, but the example testsprite2.c ended with error: "Texture format doesn't match window format". SDL_CreateTextureFromSurface with format set to 0 tries to create a texture of the same format as the Surface, but this isn't supported by the x11 driver. Fixed this by adding in testsprite2.c:65:

SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(&mode);        
sprites[i] = SDL_CreateTextureFromSurface(mode.format, temp);

After that the demo shows the pixmap always on the position (0,0). This is a bug in the X11 driver SDL_x11renderer.c line 685 and 766, where on the place of dest_x and dest_y was srcrect->x and srcrect->y. The fixed line:

XCopyArea(data->display, texturedata->pixmap, data->drawable,
                  data->gc, srcrect->x, srcrect->y, dstrect->w, dstrect->h,
                  dstrect->x, dstrect->y);

Hope I helped a bit, thanks for this useful library. I really like the new features of the 1.3 version.

Viktor Bachraty
Comment 1 Sam Lantinga 2009-02-16 21:41:06 UTC
These should be fixed in the latest snapshot.  Please let me know if you find any other problems.

Thanks!