Commit graph

6228 commits

Author SHA1 Message Date
Sam Lantinga
22b55373e7 Check the parameters to SDL_UpdateTexture() 2013-07-11 22:04:16 -07:00
Sam Lantinga
b5145bcf7f Fixed bug 1958 - Cocoa SwapWindow doesn't swap the specified window
Ryan C. Gordon

We have this in Cocoa_GL_SwapWindow()...

    /* FIXME: Do we need to get the context for the window? */
    [[NSOpenGLContext currentContext] flushBuffer];

...which means if the current GL context is not the one in (window), we swap a different one than requested.

Right now, we don't store information about which context is assigned to which window, and the OS doesn't give you a way to retrieve it from an NSView. We would have to track this per-window during SDL_GL_MakeCurrent() (and SDL_GL_CreateContext) calls.
2013-07-11 21:51:09 -07:00
Ryan C. Gordon
ca37b8fd83 Whoops, missed a part of that last commit.
Actually fixes Bugzilla #1857.
2013-07-11 23:59:09 -04:00
Ryan C. Gordon
37c7e9ad24 Explicitly write silence to the audio device while it is paused.
This is what SDL 1.2 did; we'll do this properly (add a method for the target
 driver to pause) when I rewrite all this code after the official 2.0 release.

Fixes Bugzilla #1857.
2013-07-11 23:53:00 -04:00
Ryan C. Gordon
a5362aa7e7 Attempt to fix a compiler warning on Haiku.
(if this works...Haiku generates no warnings. I know, right?!?)
2013-07-11 23:17:52 -04:00
Ryan C. Gordon
8ff1d6b620 Fixed compiler warnings on Haiku. 2013-07-11 12:44:03 -04:00
Ryan C. Gordon
e46b85c7b1 Removed some unused variables. 2013-07-11 12:27:39 -04:00
Ryan C. Gordon
09d6ed6d88 Fixed compiler warning. 2013-07-11 12:26:18 -04:00
Ryan C. Gordon
ad5f0c68a5 Cleaned up WGL_ACCELERATION_ARB usage.
We now do FULL or NO accel based on the app's preference. If the app didn't
 specify, we do FULL then fall back to NO.

(Not specifying anything--a true "don't care" scenario--breaks some ATI
 drivers, so we try to keep to the spirit of it while forcing a specific
 state.)

Previously, it would always do FULL, and try NO if it failed and the app
 had requested NO or DONTCARE.

This is a transplant of hg changesets a04171d6fa11 and d0b7c45e982e from the
 SDL-1.2 branch.

Fixes Bugzilla #1254.

--HG--
extra : rebase_source : db951d96e685e17a4d71fe2aa3d65043661ccccc
2013-07-11 12:17:13 -04:00
Ryan C. Gordon
bcef7dbe16 Added src/thread/pthread/SDL_systls.c to the CMake scripts.
--HG--
extra : rebase_source : 53362426e55c8271f8ea19d2e74997d1f01ea52b
2013-07-11 01:09:45 -04:00
Sam Lantinga
8d546288b9 Catch out of memory errors creating a window 2013-07-10 22:13:19 -07:00
Sam Lantinga
08738a32fb Fixed compile 2013-07-10 22:06:11 -07:00
Sam Lantinga
a6d24b3875 Fixed bug 1949 - Pulseaudio 32 bit audio formats support
Matt Scheirer

Pulse has supported (since version 0.8, at least) 32 bit audio formats that are now becoming available in SDL2. This patch adds those format conversions to the switch clause in the pulseaudio backend.
2013-07-10 22:01:24 -07:00
Sam Lantinga
5b03803ab3 Fixed bug 1953 - Crash at memcpy X11_DispatchEvent(_THIS) Function
Nitz

In Function X11_DispatchEvent(_THIS), case SelectionNotify :
static void
X11_DispatchEvent(_THIS)
{
 // Some Code
  case SelectionNotify: {
  //Some Code
  SDL_bool expect_lf = SDL_FALSE;
                    char *start = NULL; // Initialised with NULL
                    char *scan = (char*)p.data;
                    char *fn;
                    char *uri;
                    int length = 0;
                    while (p.count--) {
                        if (!expect_lf) {
                            if (*scan==0x0D) {
                                expect_lf = SDL_TRUE;
                            } else if(start == NULL) {
                                start = scan;
                                length = 0;
                            }
                            length++;
                        } else {
                            if (*scan==0x0A && length>0) {
                                uri = malloc(length--);

                                memcpy(uri, start, length); // Problem is Here, start is still NULL if control comes to else statement without initialising the start pointer, which is wrong

                                uri[length] = 0;
                                fn = X11_URIToLocal(uri);
                                if (fn) SDL_SendDropFile(fn);
                                free(uri);
                            }
                            expect_lf = SDL_FALSE;
                            start = NULL;
                        }
                        scan++;
                    }
                }
As shown above how start pointer remains NULL, Patch for this issue would be:
                            if (*scan==0x0D) {
                                expect_lf = SDL_TRUE;
                            }
                            if(start == NULL) {
                                start = scan;
                                length = 0;
                            }
Just replace else if statement with if.
2013-07-10 21:57:31 -07:00
Ryan C. Gordon
fcc6274a81 Added src/thread/windows/SDL_systls.c to CMakeLists.txt (thanks, Charles!).
Fixes Bugzilla #1955.
2013-07-10 23:43:35 -04:00
Sam Lantinga
f80a6e7ee5 Added PowerPC and ARM versions of the memory barrier functions. 2013-07-10 20:17:20 -07:00
Sam Lantinga
557bbf3fe6 Added release/acquire memory barriers to the atomic API
* Added a destructor to clean up TLS memory at thread shutdown
* Refactored the TLS code to have platform independent code and a small platform dependent core with a fallback to generic code if platform dependent functions fail.
* Fixed recursion issues with SDL_GetErrBuf()
2013-07-10 18:31:17 -07:00
Sam Lantinga
086ecc9949 Fixed Haiku build 2013-07-10 02:37:57 -07:00
Sam Lantinga
bfcb08d569 Implemented an API for thread-local storage: SDL_TLSCreate(), SDL_TLSSet(), SDL_TLSGet() 2013-07-10 02:32:04 -07:00
Jørgen P. Tjernø
ab91b4ce14 SDL_GL_MakeCurrent: Only no-op redundant calls on *same* thread.
This ensures that we only no-op redundant calls if they're made on the
same thread as the last MakeCurrent with those arguments. This should
maek SDL behave better with multithreaded environments.
2013-07-09 12:58:54 -07:00
Jørgen P. Tjernø
ea36ba4f4e Mac: Remove dead FULLSCREEN_TOGGLEABLE code.
This code was written almost 2 years ago, and the flag hasn't been
changed since. Cleaning up the code by removing the conditional blocks,
so that they behave the same way they have for the past two years.

FULLSCREEN_TOGGLEABLE used to cause us to use
-[NSOpenGLContext setFullScreen] and a pixel format with
NSOpenGLPFAFullScreen.
2013-07-09 12:57:12 -07:00
Gabriel Jacobo
4601ab6894 Removing video/uikit/*.c from configure's iOS sources
Unexplicable computer sciences phenomenon: Instead of returning an empty set,
*.c in an folder with no .c files produces the "*.c" string to be added as
a source. I'm sorry future generations, we are doing the best we can :)
2013-07-09 13:54:29 -03:00
Ryan C. Gordon
2740a12ae3 Backout hg changset 898992405fa7; lots of things still use SDL_types.h. :/
Will remove this again at some point in the future, though.
2013-07-09 11:57:32 -04:00
Sam Lantinga
9c43b29ef9 Made the SDL_memset4() comment even clearer so we don't accidentally replace it with memset() in the future. 2013-07-09 08:01:40 -07:00
Sam Lantinga
98053e8a85 Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect() 2013-07-09 07:13:58 -07:00
Gabriel Jacobo
b2d7f92773 Adds Input Focus handling on Android to improve pausing/resuming behavior
Ref: http://android-developers.blogspot.com/2011/11/making-android-games-that-play-nice.html
2013-07-09 10:25:16 -03:00
Ryan C. Gordon
7afed3e5ae Removed deprecated SDL_types.h header.
Fixes Bugzilla #1945.
2013-07-08 23:37:00 -04:00
Ryan C. Gordon
287d2529bd Replaced SDL_memset4() implementation with a call to SDL_memset().
The implementation was slower than the C runtime on Mac OS X, Linux, and
 Windows...quite a bit slower when using the C fallback instead of the inline
 asm, too.

Fixes Bugzilla #1755.
2013-07-08 23:22:36 -04:00
Edward Rudd
6f3b5c3641 change fsaa argument for testgl to accept a # of samples for FSAA 2013-07-08 17:51:17 -04:00
Ryan C. Gordon
40e8b24572 Disable OSS and BSD audio targets on OpenBSD.
--HG--
extra : rebase_source : f724ffb3927c2331c888eba6f55b71d114269bf4
2013-07-08 13:26:59 -04:00
Sam Lantinga
c6348f33e7 Make sure that srcdir has a full pathname so source indexing works. 2013-07-08 09:21:54 -07:00
Sam Lantinga
435103b3d9 Fixed bug 1943 - Wrong handling of legacy 32bpp BMP files
Kang Seonghoon

While BMP format supports alpha channel, it is enabled only when the header is at least 56 bytes long (BITMAPV3INFOHEADER and later). For very common 40-byte-long header (BITMAPINFOHEADER) 32bpp format should be interpreted as BGRX format, but currently SDL interprets them as BGRA format and causes a significant compatibility problem as many 32bpp files use a padding byte of 0 ("transparent" in BGRA interpretation).

---

I fixed this by checking to see if the alpha channel is all 0, and if so, setting it opaque.
2013-07-07 18:23:04 -07:00
Ryan C. Gordon
0ed61eba4b sndio dynamic loading fix. 2013-07-07 20:06:08 -04:00
Sam Lantinga
6255f7f9a8 Backed out changeset c8b16b3a3c9b 2013-07-07 14:08:07 -07:00
Sam Lantinga
274d4eeec2 Fixed bug 1943 - Wrong handling of legacy 32bpp BMP files
Kang Seonghoon

While BMP format supports alpha channel, it is enabled only when the header is at least 56 bytes long (BITMAPV3INFOHEADER and later). For very common 40-byte-long header (BITMAPINFOHEADER) 32bpp format should be interpreted as BGRX format, but currently SDL interprets them as BGRA format and causes a significant compatibility problem as many 32bpp files use a padding byte of 0 ("transparent" in BGRA interpretation).
2013-07-07 12:53:21 -07:00
Sam Lantinga
30553ceb5b Added automated test to validate conversion between all supported formats. 2013-07-07 12:34:26 -07:00
Sam Lantinga
235df7949e Added surface conversion support for ARGB2101010 formats 2013-07-07 12:34:21 -07:00
Sam Lantinga
becaf62d10 Fixed converting ARGB2101010 surfaces to 8-bit surfaces
It's not like this is very useful, but it fixes a crash in this case.
2013-07-07 10:31:01 -07:00
Sam Lantinga
4fed764ac6 Updated configure with the sndio audio backend 2013-07-07 10:15:10 -07:00
Philipp Wiesemann
764d957232 Corrected name of constant in header file comment. 2013-07-07 16:15:21 +02:00
Philipp Wiesemann
c8c3817b12 Changed include directive to standard header. 2013-07-07 16:13:17 +02:00
Philipp Wiesemann
0586d55560 Fixed SDL_RWread() returning -1 as unsigned instead of 0 if error on Android.
Found by Cppcheck (pointed out check of unsigned < 0 which was left in place).
2013-07-07 16:11:29 +02:00
Ryan C. Gordon
bbe065f50f Added an SDL2 OpenBSD sndio(7) audio target.
--HG--
extra : rebase_source : 5ad387265cff73c1635ca4f2c3635848ba722614
2013-07-07 02:03:07 -04:00
Ryan C. Gordon
fdca15860f Disk audio target was using this->hidden->mixlen before we set it.
--HG--
extra : rebase_source : 0ca3a2c97a59010e12df6a144757b6cadb4232c5
2013-07-07 02:04:19 -04:00
Ryan C. Gordon
13b57b17fd Minor ALSA tweaks (include-once macro name, len for memset() more clear).
--HG--
extra : rebase_source : 44c8b456ce5867d127b8e307c7854d1bab882a50
2013-07-07 02:03:50 -04:00
Sam Lantinga
c9acdd87a7 Added 8-bit RGB source surface support to NtoN blitters 2013-07-06 21:17:09 -07:00
Sam Lantinga
185f93a7a9 Fixed bug 1923 - Crash with SDL_SetColorKey
Sylvain

1/ Load an Image XPM with IMG_ReadXPMFromArray()
2/ Try to set a ColorKey on it.

I notice that :
- the SDL_Surface that is created from XPM has a palette !
- the colorkey is a RBG.

it crashes (SIGSEGV) inside the SDL_SetColorKey function:
"surface->format->palette->colors[surface->map->info.colorkey].a"
2013-07-06 20:29:40 -07:00
Sam Lantinga
91452f6355 Fixed bug 1911 - enable HAVE_GCC_ATOMICS for android platform 2013-07-06 12:39:56 -07:00
David Gow
4921d1b526 Remove full-desktop Xinerama mode when using XRandR 2013-06-25 21:36:36 +08:00
Sam Lantinga
156a8638f0 Make it possible to use SDL events separately from the video subsystem. 2013-07-06 12:28:57 -07:00