diff --git a/project/jni/sdl-1.3/COPYING b/project/jni/sdl-1.3/COPYING index 15639581a..81e520977 100644 --- a/project/jni/sdl-1.3/COPYING +++ b/project/jni/sdl-1.3/COPYING @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2011 Sam Lantinga +Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/NOTES b/project/jni/sdl-1.3/NOTES deleted file mode 100644 index 49dd2d058..000000000 --- a/project/jni/sdl-1.3/NOTES +++ /dev/null @@ -1,172 +0,0 @@ - -Sam - Mon Aug 6 23:02:37 PDT 2007 ------- -Add color modulation to blitting -Blit convert format X -> format Y (needed for texture upload) -Blit copy / blend / modulate format X -> format X (needed for software renderer) - -Create full software renderer for framebuffer interfaces. - -Create texture for surface, keep surface around as pixel source, allow -copying / blending / modulating from surface to display (automatically -generate texture?) - -At that point, should anyone be using anything besides textures for display? - -IRC - Mon Aug 6 23:50:44 PDT 2007 ------ -[11:07pm] icculus: so we're clear, "textures" replace "surfaces" from 1.2 when you want to get stuff to the screen? So you have a definitely point where it stops being pixels in memory and starts being an object on the graphics card? -[11:07pm] icculus: Upload once, blit many -[11:07pm] icculus: something like that? -[11:07pm] slouken: That's the idea, yes -[11:07pm] icculus: ok, just making sure -[11:08pm] slouken: Many drivers retain the "texture" as a surface and blit to opaque bits which then get copied into a framebuffer. -[11:08pm] slouken: retain -> would retain -[11:08pm] icculus: yeah, I figured -[11:08pm] slouken: That's why the features for surface blitting need to match the features for texture display. -[11:08pm] icculus: But it gives an abstraction where the app has to make a conscious action: the upload is slow, but then the blit is fast. -[11:09pm] icculus: This couldn't just map to LockSurface, though? -[11:09pm] slouken: Yes, exactly. I wasn't sure whether to make that clear, e.g. can you display any surface, and automatically generate a texture (if necessary)? -[11:09pm] slouken: If not, it simplifies the framebuffer case. -[11:10pm] slouken: But even the framebuffer case will probably still want to convert the bits to the optimal format. -[11:10pm] slouken: And at that point, the non-optimal bits can be thrown away. -[11:11pm] slouken: e.g. SDL_DisplayFormat() -[11:10pm] icculus: oh, that's a good point. -[11:10pm] icculus: hmm -[11:11pm] icculus: yeah, okay -[11:11pm] icculus: I was thinking about if the separation is really necessary, or if LockSurface would imply a texture creation (and you just have much more strict locking requirements than most 1.2 targets had) -[11:11pm] slouken: That's also why I separated the conversion blits from the copy / blend / modulate blits. -[11:12pm] icculus: But I like that the app has to be conscious of when that's happening -[11:12pm] slouken: Yeah, I was really leaning towards making it implicit, but the memory savings is pretty significant for artwork. -[11:12pm] icculus: SDL_compat can wrap the difference for people that can't get their head around it. -[11:13pm] icculus: At the performance cost, that can be a totally external layer that manages it like 1.2's locking. -[11:13pm] slouken: Well, SDL_compat is entirely software on top of a single texture that represents the screen. -[11:14pm] slouken: Yeah, that's the way it's implemented right now. -[11:14pm] slouken: a HWSURFACE is one that is backed by a texture, and lock/unlock is used to synchronize the bits. -[11:14pm] slouken: I'm not sure if that's worth keeping though, if SDL_compat is software only. -[11:15pm] slouken: It would minimize code migration though. -[11:15pm] icculus: yeah -[11:15pm] icculus: I expect SDL_compat to be a complete cesspool -[11:15pm] icculus: just a black box that no one touches or looks at more than necessary -[11:15pm] slouken: more or less, but it's actually pretty clean right now... I think as a side effect of the new API being pretty clean. -[11:15pm] slouken: I'm just unsure how much to use texture vs HWSURFACE -[11:16pm] icculus: Besides, you'd be surprised how quickly you can get people to move if you flag functions as deprecated so that GCC bitches when you use them. -[11:16pm] slouken: -[11:16pm] icculus: how much to use texture vs HWSURFACE in 1.3, or in SDL_compat? -[11:16pm] slouken: in 1.3 -[11:17pm] icculus: Pick one or the other, I would say. -[11:17pm] icculus: I don't think it's good to confuse people with both terms -[11:17pm] slouken: yeah -[11:17pm] icculus: Everything is software until it's a texture. -[11:17pm] slouken: I'm just not sure which -[11:17pm] slouken: that's certainly cleanest. -[11:18pm] slouken: and what's currently implemented -[11:18pm] slouken: Let's think through the migration process... -[11:18pm] icculus: Plus dropping the term HWSURFACE gets the point across that a) this isn't 1.2 and b) this is probably going to a 3D api that you should be using anyhow. -[11:18pm] • slouken nods -[11:18pm] icculus: I mean, "texture" is what every API calls these things -[11:18pm] slouken: Yep -[11:19pm] slouken: So let's work through a migration case... -[11:19pm] icculus: ok -[11:19pm] slouken: FooBall loads a big background and a bunch of sprites. They are png, loaded into SDL_Surface with SDL_image, then converted with SDL_DisplayFormat() -[11:20pm] slouken: Then the background is blitted every frame and the sprites are blended on top. -[11:20pm] slouken: In the compat case: -[11:21pm] slouken: SDL_SetVideoMode() creates a single lockable texture for the display. DisplayFormat() converts the bits into the optimal format, all blitting is done in software, and SDL_UpdateRects() pushes the bits into the texture and the texture is rendered. -[11:21pm] slouken: In the 1.3 case: -[11:22pm] slouken: The background and sprites are converted to textures using SDL_CreateTextureFromSurface(), and the appropriate blending flags are set. Each frame copies the textures into place and then the display is presented. -[11:23pm] slouken: compat is software only, 1.3 can be 3D accelerated. -[11:23pm] icculus: wait, why does all blitting have to be done in software in the SDL_compat case? -[11:23pm] icculus: I don't understand why SDL_compat can't move things between surfaces and textures at Lock/Unlock time -[11:24pm] slouken: Because by default the screen isn't created with HWSURFACE, since apps expect to be able to munge the bits. Therefore, the blits to it have to be done locally. -[11:24pm] icculus: And all the surfaces are flagged HWSURFACE, so ->pixels is NULL until locked. -[11:24pm] icculus: oh -[11:24pm] icculus: It wasn't possible to have a HWSURFACE screen? -[11:25pm] slouken: Yes, it was, just nobody did it because alpha blending needs to read from video memory, and poking pixels across the bus is slow. -[11:25pm] slouken: Even in 1.3, the Xlib case needs to be software renderer if you want to do any alpha blending. -[11:26pm] icculus: But arguably there's no reason that can't all be HWSURFACE (that is, they need to get moved to a texture, even if that's still a software renderer on the backend) -[11:26pm] icculus: That sounds like it's only a problem when an app touches SDL_GetVideoSurface()->pixels without checking if they should lock it. -[11:26pm] icculus: Which might be quite common -[11:27pm] slouken: Yep, in 1.2 the app was able to specify it, and most explicitly don't because it's either not available or bad for alpha blending and direct pixel poking. -[11:27pm] icculus: hmm. -[11:28pm] slouken: You see why I've been going round and round for months on this? -[11:28pm] icculus: Well, we're talking about a compatibility layer; if it's going to crash without LockSurface() on the screen, make them lock it. If that makes it slow, so be it. -[11:29pm] icculus: The options are make small changes and take a performance hit, or make bigger changes and get a big performance win. -[11:29pm] icculus: (if touching the framebuffer directly, that is) -[11:29pm] slouken: Well, at that point it's a compatibility layer, why not just leave it software? (devil's advocate here) -[11:29pm] icculus: That's a good point. -[11:30pm] slouken: Unless we leave everything surfaces to get the best of both worlds... -[11:30pm] • slouken gets dizzy -[11:30pm] icculus: From a technical elegance viewpoint, I can see a good mapping between HWSURFACE and textures, but realistically, you want to motivate people to move away from old APIs. -[11:31pm] slouken: Yeah probably. There's a certain attraction to retaining the SDL_Surface usage even for hardware surfaces, simply because of code reuse. You don't have to have separate code for your software composition and your rendering. You also get to keep your old image loading code, etc. -[11:31pm] icculus: man, this really is a pain in the ass, I see what you mean. -[11:32pm] slouken: Yeah. -[11:32pm] icculus: hmm, let me think on this awhile. -[11:32pm] slouken: On the other hand, separating the Texture API for rendering is clearer and allows extension in the future. -[11:32pm] slouken: We could potentially allow you to create a software renderer pointed at an SDL surface.... -[11:32pm] slouken: Hmmm -[11:33pm] icculus: well, that's what you have now for something like Doom -[11:33pm] icculus: you render to a shadow surface, and throw a hail-mary with SDL_Flip() -[11:34pm] slouken: Yep. I mean a 1.3 "renderer" with an SDL_Surface or another texture as the target. -[11:34pm] icculus: More or less, that doesn't change. The only important thing there is not generating a new texture every time, but being able to discard what's currently in it for a fresh upload. -[11:34pm] slouken: Yep -[11:34pm] icculus: oh, I see -[11:35pm] icculus: render-to-surface -[11:35pm] slouken: lol -[11:35pm] slouken: yeah -[11:36pm] slouken: So... where to draw the line with surface vs texture... -[11:37pm] icculus: I don't know, I would think that basically you want to get out of surfaces as fast as possible -[11:37pm] icculus: (disregarding SDL_compat for the moment) -[11:37pm] slouken: Yeah, I think so. -[11:37pm] slouken: Load the bits up, throw them into a texture, and go -[11:37pm] icculus: And basically all you really need for that is an "upload" function. -[11:38pm] slouken: Yep -[11:38pm] icculus: I'd even be inclined to not allow "Locking," so there's no readback. -[11:38pm] icculus: well, I'm sure that would cause a fight -[11:38pm] • slouken thinks -[11:40pm] slouken: Let me see where I use SDL_LockTexture() right now. -[11:42pm] slouken: The only time that's useful is to avoid a buffer copy when you're already writing the bits in the correct format. -[11:42pm] slouken: e.g. lock -> software render into bits -> unlock (upload) -[11:43pm] slouken: that may already be taken care of by the upload though. -[11:43pm] slouken: e.g. software render into bits -> upload -[11:44pm] slouken: Oh yeah, there's probably a memory copy of the bits though, so it's: upload = copy into cached bits, copy cached bits to video memory as needed. In that case if you lock to get access to the cached bits directly that's a win. -[11:44pm] icculus: ah, okay -[11:47pm] icculus: I don't know, my head hurts. -[11:47pm] slouken: Yeah, mine too. -[11:47pm] slouken: I was pretty happy with the current setup until I noticed that it's really hard to write a framebuffer driver right now. -[11:49pm] slouken: I think maybe if I clean that up and separate conversion blit and copy / blend / modulate blit, then it may work pretty cleanly. -[11:49pm] icculus: yeah - -[11:54pm] slouken: So recapping... SDL_Surface is only used for loading and app composition. -[11:55pm] slouken: SDL surface blitting is enhanced to maintain parity with the renderer features, since it's used as the core of the software renderer. -[11:56pm] slouken: The software renderer is adapted to be a standalone module targeting either an SDL_Surface or an SDL_Texture. -[11:56pm] slouken: SDL_HWSURFACE goes away -[11:57pm] slouken: Anything I'm missing? -[11:58pm] icculus: no, sounds good -[11:58pm] slouken: This means we have the new 1.3 texture API pretty much as it stands. -[11:59pm] slouken: Right? -[11:59pm] icculus: yeah, I think so - -[12:00am] slouken: I was trying to see if it was possible to make a pluggable blit API, but I was going insane with trying to figure out how to make it fast. -[12:01am] slouken: If it were software only I could just say, write your own and register it here, but you'd have to maintain parity with the OpenGL and Direct3D renderers as well. -[12:01am] slouken: At that point you might as well be working in surfaces and uploading to texture. -[12:02am] icculus: yeah - -TODO ----- -Change textures to static/streaming. Static textures are not lockable, -streaming textures are lockable and may have system memory pixels available. -SDL_compat will use a streaming video texture, and will never be HWSURFACE, -but may be PREALLOC, if system memory pixels are available. -*** DONE Thu Aug 16 14:18:42 PDT 2007 - -The software renderer will be abstracted so the surface management can be -used by any renderer that provides functions to copy surfaces to the window. - -Blitters... ----- -Copy blit and fill rect are optimized with MMX and SSE now. - -Here are the pieces we still need: -- Merging SDL texture capabilities into the SDL surface system -- Generic fallback blitter architecture -- Custom fast path blitters diff --git a/project/jni/sdl-1.3/README b/project/jni/sdl-1.3/README index 48cc73f75..881f3cc28 100644 --- a/project/jni/sdl-1.3/README +++ b/project/jni/sdl-1.3/README @@ -3,7 +3,7 @@ (SDL) - Version 1.3 + Version 2.0 --- http://www.libsdl.org/ diff --git a/project/jni/sdl-1.3/README.BeOS b/project/jni/sdl-1.3/README.BeOS deleted file mode 100644 index ccdccf598..000000000 --- a/project/jni/sdl-1.3/README.BeOS +++ /dev/null @@ -1,13 +0,0 @@ - -SDL on BeOS R5 -============== - -You can build SDL on BeOS like any other GNU style package. -e.g. ./configure && make && make install -By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.} - -Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib, -so it can be found by the dynamic linker. - -Enjoy! - Sam Lantinga (slouken@libsdl.org) diff --git a/project/jni/sdl-1.3/README.Watcom b/project/jni/sdl-1.3/README.Watcom deleted file mode 100644 index b0ae8b898..000000000 --- a/project/jni/sdl-1.3/README.Watcom +++ /dev/null @@ -1,139 +0,0 @@ - -Using SDL 1.3 under Windows with the OpenWatcom compiler - -==================================================== - -Prerequisites -------------- - -I have done the port under Windows XP Professional with SP2 installed. -Windows 2000 should also be working. I'm not so sure about ancient Windows NT, -since only DirectX 3 is available there. Building should be possible, -but running the compiled applications will probalbly fail with -SDL_VIDEODRIVER=directx. The windib driver should work, though. - -To compile and use the SDL with Open Watcom you will need the following: -- Open Watcom compiler. I used version 1.8. The environment variables - PATH, WATCOM and INCLUDE need to be set appropriately - please consult - the OpenWatcom documentation and instructions given during the - installation of the compiler. - My setup looks like this in owvars.bat: - set WATCOM=C:\dev\ow18 - set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt - set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw -- A recent DirectX SDK. The library needs D3d9.h so at leat the - directx 9 sdk is to be used. I used DirectX 10 SDK from August 2009 - taken directly from the microsoft site. -- The SDL 1.3 sources from Subversion -- The file Watcom-Win32.zip (now available in Subversion) - - -Building the Library --------------------- - -1) In the SDL base directory extract the archive Watcom-Win32.zip. This - creates a subdirectory named 'watcom'. -2) The makefile expects the environment variable DXDIR to be set to the - base directory of a DirectX SDK. I have tried the August 2009 - DirectX SDK from Microsoft - You can also edit the makefile directly and hard code your path to - the SDK on your system. - I have this in my setup: - set DXDIR=..\dx10 -3) Enter the watcom directory and run - wmake sdl -4) All tests from the test directory are working and can be built by - running - wmake tests - -Notes: - - The makefile offers some options to tweak the way the library is built. - You have at your disposal the option to build a static (default) - library, or a DLL (with tgt=dll). You can also choose whether to build - a Release (default) or a Debug version (with build=debug) of the tests - and library. Please consult the usage comment at the top of the - makefile for usage instructions. - - If you specify a test target (i.e. 'wmake tests' for all tests, or - selected targets like 'wmake testgl testvidinfo testoverlay2'), the - tests are always freshly compiled and linked. This is done to - minimise hassle when switching between library versions (static vs. - DLL), because they require subtly different options. - Also, the test executables are put directly into the test directory, - so they can find their data files. The clean target of the makefile - removes the test executables and the SDL.dll file from the test - directory. - - To use the library in your own projects with Open Watcom, you can use - the way the tests are built as base of your own build environment. - - The library can also be built with the stack calling convention of the - compiler (-6s instead of -6r). - -Test applications ------------------ -$FixME: which test works ? which one compiles ? - -I've tried to make all tests work. The following table gives an overview -of the current status. - - Testname Status -~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -checkkeys + -graywin + -loopwave + -testalpha + -testbitmap + -testdyngl + -testerror + -testfile + -testgamma + -testgl + -testhread + -testiconv - (all failed) -testkeys + -testlock + -testoverlay + (needs 'set SDL_VIDEODRIVER=directx') -testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx') -testpalette + -testplatform + -testsem + -testsprite + -testtimer + -testver + -testvidinfo + -testwin ? (fading doesn't seem right) -testwm + -torturethread + -testcdrom + -testjoystick not tested -threadwin + -testcursor + - - -TODO ----- - -There is room for further improvement: -- Test joystick functionality. -- Investigate fading issue in 'testwin' test. -- Fix the UTF-8 support. -- Adapt the makefile/object file list to support more target systems -- Use "#pragma aux" syntax for the CPU info functions. - - -Questions and Comments ----------------------- - -Please direct any questions or comments to me: - - ow_sdl [at] digitalfantasy [dot] it - -The original porting to the open watcom compiler was made by -Marc Peter - - Happy Coding! - - Daniele Forghieri - diff --git a/project/jni/sdl-1.3/README.android b/project/jni/sdl-1.3/README.android index e556db074..70638ca77 100644 --- a/project/jni/sdl-1.3/README.android +++ b/project/jni/sdl-1.3/README.android @@ -39,7 +39,8 @@ src/main/android/SDL_android_main.cpp Instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. -2. Move this SDL directory into the /jni directory +2. Move this SDL directory into the /jni directory and then copy +SDL_config_android.h to SDL_config.h inside the include folder 3. Place your application source files in the /jni/src directory 4. Edit /jni/src/Android.mk to include your source files 5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source diff --git a/project/jni/sdl-1.3/README.ds b/project/jni/sdl-1.3/README.ds index 3b97144b3..40bf8823e 100644 --- a/project/jni/sdl-1.3/README.ds +++ b/project/jni/sdl-1.3/README.ds @@ -6,11 +6,8 @@ Simple DirectMedia Layer for Nintendo DS * The devkitpro SDK available at http://devkitpro.org. Read the information at http://devkitpro.org/wiki/Getting_Started/devkitARM The necessary packages are devkitARM, libnds, libfat and default arm7. -* The hardware renderer is using the libgl2d abstraction library that can be found at: - http://rel.phatcode.net/junk.php?id=117 - Build it, and install the library and the header where SDL can find them (ie. in - the libnds/lib and libnds/include directories). - +* Optionally, use a DS emulator, such as desmume (http://desmume.org/) + to program and debug. -Building SDL- @@ -18,23 +15,31 @@ After setting the devkitpro environment, cd into your SDL directory and type: make -f Makefile.ds This will compile and install the library and headers into the -devkitpro's portlibs directory. Additionnaly it will compile several -tests that you can run either on the DS or with desmume. For instance: +devkitpro's portlibs directory (../portlibs/arm/lib/ and +../portlibs/arm/include/). Additionally it will compile several tests +that you can run either on the DS or with desmume. For instance: + desmume --cflash-path=test/ test/nds-test-progs/testsprite2/testsprite2.nds + desmume --cflash-path=test/ test/nds-test-progs/testspriteminimal/testspriteminimal.nds + desmume --cflash-path=test/ test/nds-test-progs/testscale/testscale.nds desmume test/nds-test-progs/general/general.nds -Notes- * The renderer code is based on the gl like engine. It's not using the sprite engine. +* The hardware renderer is using the parts of the libgl2d abstraction library that can be found at: + http://rel.phatcode.net/junk.php?id=117 + Used with the author's permission. * The port is very basic and incomplete: - - SDL currently has to be compiled for either framebuffer mode or render mode. + - SDL currently has to be compiled for either framebuffer mode or renderer mode. See USE_HW_RENDERER in Makefile.ds. - some optional renderer functions are not implemented. + - no sound -Limitations- * in hardware renderer mode, don't load too many textures. The internal format is 2 bytes per pixel. And there is only 256KB reserved for the textures. For instance, testscale won't display sample.bmp, unless it's resized to a smaller picture. * the screen size is 256 x 384. Anything else won't work. -* there is no 8 bits/pixel mode because SDL 1.3 doesn't support palettes. +* there is no 8 bits/pixel mode because SDL 2.0 doesn't support palettes. -Joystick mapping- The Joystick presented to SDL has 2 axes and 8 buttons diff --git a/project/jni/sdl-1.3/README.iphoneos b/project/jni/sdl-1.3/README.iOS similarity index 84% rename from project/jni/sdl-1.3/README.iphoneos rename to project/jni/sdl-1.3/README.iOS index 39ff14da9..b55fb3baa 100644 --- a/project/jni/sdl-1.3/README.iphoneos +++ b/project/jni/sdl-1.3/README.iOS @@ -5,30 +5,31 @@ Building the Simple DirectMedia Layer for iPhone OS 2.0 Requirements: Mac OS X v10.5 or later and the iPhone SDK. Instructions: -1. Open SDLiPhoneOS.xcodeproj (located in Xcode-iPhoneOS/SDL) in XCode. -2. Set Project->Set Active SDK to "Use Project Settings" -3. Select your desired target, and hit build. +1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in XCode. +2. Select your desired target, and hit build. There are three build targets: -- StaticLibiPhoneOS: - Build SDL as a statically linked (armv6) library for iPhone OS 2.0. -- StaticLibSimulator: - Build SDL as a statically linked (x86) library for the iPhone Simulator +- libSDL.a: + Build SDL as a statically linked library +- testsdl + Build a test program (there are known test failures which are fine) - Template: Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers. The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen. ============================================================================== -Using the Simple DirectMedia Layer for iPhone OS 2.0 +Using the Simple DirectMedia Layer for iOS ============================================================================== +FIXME: This needs to be updated for the latest methods + Here is the easiest method: -1. Build the SDL libraries (libSDLiPhoneOS.a and libSDLSimulator.a) and the iPhone SDL Application template. -1. Install the iPhone SDL Application template by copying it to one of XCode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iPhoneOS.platform/Developer/Library/XCode/Project Templates/" and placing it there. +1. Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template. +1. Install the iPhone SDL Application template by copying it to one of XCode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there. 2. Start a new project using the template. The project should be immediately ready for use with SDL. Here is a more manual method: 1. Create a new iPhone view based application. -2. Build the SDL static libraries (libSDLiPhoneOS.a and libSDLSimulator.a) for iPhone and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator. +2. Build the SDL static libraries (libSDL.a and libSDLSimulator.a) for iPhone and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator. 3. Include the SDL header files in your project. 4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically. 5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code. @@ -86,7 +87,7 @@ MySDLApp Home/ When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences". More information on this subject is available here: -http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/chapter_6_section_3.html#//apple_ref/doc/uid/TP40007072-CH7-SW21 +http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html ============================================================================== Notes -- iPhone SDL limitations @@ -96,7 +97,7 @@ Windows: Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS). Presently, landscape mode is not supported. Video: - For real time frame-rates, you are advised to use strictly SDL 1.3 video calls. Using compatibility video calls uploads an OpenGL texture for each frame drawn, and this operation is excruciatingly slow. + For real time frame-rates, you are advised to use strictly SDL 2.0 video calls. Using compatibility video calls uploads an OpenGL texture for each frame drawn, and this operation is excruciatingly slow. Textures: SDL for iPhone Textures supports only SDL_PIXELFORMAT_ABGR8888 and SDL_PIXELFORMAT_RGB24 pixel formats. This is because texture support in SDL for iPhone is done through OpenGL ES, which supports fewer pixel formats than OpenGL, will not re-order pixel data for you, and has no support for color-paletted formats (without extensions). @@ -107,5 +108,3 @@ Audio: Loading Shared Objects: This is disabled by default since it seems to break the terms of the iPhone SDK agreement. It can be re-enabled in SDL_config_iphoneos.h. - - diff --git a/project/jni/sdl-1.3/README.pandora b/project/jni/sdl-1.3/README.pandora index 8f8f8a9c6..d360f84f3 100644 --- a/project/jni/sdl-1.3/README.pandora +++ b/project/jni/sdl-1.3/README.pandora @@ -1,7 +1,7 @@ -SDL 1.3 with open pandora console support ( http://openpandora.org/ ) +SDL 2.0 with open pandora console support ( http://openpandora.org/ ) ===================================================================== -- A pandora specific video driver was writed to allow SDL 1.3 with OpenGL ES +- A pandora specific video driver was writed to allow SDL 2.0 with OpenGL ES support to work on the pandora under the framebuffer. This driver do not have input support for now, so if you use it you will have to add your own control code. The video driver name is "pandora" so if you have problem running it from diff --git a/project/jni/sdl-1.3/TODO b/project/jni/sdl-1.3/TODO index 55af9fe61..2eeb02be2 100644 --- a/project/jni/sdl-1.3/TODO +++ b/project/jni/sdl-1.3/TODO @@ -1,35 +1,9 @@ -Eli Gottlieb's checklist for the GSOC shaped windows project. Dated July 9, 2010. -1. Enable proper linking of the X11 implementation and test it. ---> Find the place in the build system for platform-specific linking flags. STATUS: DONE ---> Add a linker flag to bring in libXext.a. STATUS: DONE. -2. Build the Win32 implementation of shaped-windows functionality. ---> Add driver functions to the SDL_ShapeDriver in the Win32 driver's SDL_DisplayDevice at the proper point in the code. STATUS: CHECK. ---> Add a hook in the Windows resize-window code to call Win32_ResizeWindowShape(). STATUS: CHECK. ---> Get the Windows code to build and run properly. STATUS: IN PROGRESS. -3. Enable building the testeyes program. ---> Reprogram it to use the latest shaped-windows API. STATUS: CHECK. ---> Get it, along with the rest of the test suite in my branch, building successfully. STATUS: DONE. ---> Debug testeyes and the platform-specific shaped-window implementations in tandem. STATUS: IN PROGRESS. -4. Implement the SDL shaped-windows API for Mac OS X using Cocoa. STATUS: IN PROGRESS ---> Locate (once more) the API documentation for shaped windows under Cocoa. STATUS: NEARLY FINISHED. ---> Design and encode a version of SDL_ShapeData for Cocoa. STATUS: IN PROGRESS. ---> Write Cocoa_CreateShaper(). STATUS: MOSTLY DONE, AFAIK. ---> Write Cocoa_ResizeWindowShape(). STATUS: DONE, AFAIK. ---> Write Cocoa_SetWindowShape(). STATUS: IN PROGRESS. ---> If necessary, implement functionality adjunct to SDL_CalculateShapeBitmap() for Cocoa usage. -5. Use testeyes to debug all implementations. STATUS: SPRINT + 2. ---> Debug Cocoa implementation. ---> Debug Win32 implementation. ---> Debug X11 implementation (again). - -1.3 release checklist: +2.0 release checklist: * http://wiki.libsdl.org/moin.cgi/Roadmap * See why windows are being rearranged. Is the shield window not up? * Make sure you can create and show a fullscreen window in one step - * Figure out how to handle OpenGL context lost on Mac OS X (does it happen?) * Write automated test case for multi-draw APIs - * Make sure you can build SDL without the renderer to slim it down a bunch * Implement assertion code on iPhone * Add __WINDOWS__ in addition to __WIN32__ diff --git a/project/jni/sdl-1.3/WhatsNew b/project/jni/sdl-1.3/WhatsNew index 64f669284..a54ab0abb 100644 --- a/project/jni/sdl-1.3/WhatsNew +++ b/project/jni/sdl-1.3/WhatsNew @@ -1,709 +1,3 @@ This is a list of API changes in SDL's version history. -1.3.0: - Added SDL_GetNumVideoDrivers() and SDL_GetVideoDriver(). - Replaced SDL_VideoDriverName() with SDL_GetCurrentVideoDriver() - Added SDL_GetNumAudioDrivers() and SDL_GetAudioDriver(). - Replaced SDL_AudioDriverName() with SDL_GetCurrentAudioDriver() - -1.2.10: - If SDL_OpenAudio() is passed zero for the desired format - fields, the following environment variables will be used - to fill them in: - SDL_AUDIO_FREQUENCY - SDL_AUDIO_FORMAT - SDL_AUDIO_CHANNELS - SDL_AUDIO_SAMPLES - If an environment variable is not specified, it will be set - to a reasonable default value. - - Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment - variable, currently supported on X11 Xinerama configurations. - - Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications. - - Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration. - - Added current_w and current_h to the SDL_VideoInfo structure, - which is set to the desktop resolution during video intialization, - and then set to the current resolution when a video mode is set. - - SDL_SetVideoMode() now accepts 0 for width or height and will use - the current video mode (or the desktop mode if no mode has been set.) - - Added SDL_GetKeyRepeat() - - Added SDL_config.h, with defaults for various build environments. - -1.2.7: - Added CPU feature detection functions to SDL_cpuinfo.h: - SDL_HasRDTSC(), SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE(), - SDL_HasAltiVec() - Added function to create RWops from const memory: SDL_RWFromConstMem() - -1.2.6: - Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject() - - Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA - -1.2.5: - Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5) - - Added SDL_GL_STEREO for stereoscopic OpenGL contexts - -1.2.0: - Added SDL_VIDEOEXPOSE event to signal that the screen needs to - be redrawn. This is currently only delivered to OpenGL windows - on X11, though it may be delivered in the future when the video - memory is lost under DirectX. - -1.1.8: - You can pass SDL_NOFRAME to SDL_VideoMode() to create a window - that has no title bar or frame decoration. Fullscreen video - modes automatically have this flag set. - - Added a function to query the clipping rectangle for a surface: - void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect) - - Added a function to query the current event filter: - SDL_EventFilter SDL_GetEventFilter(void) - - If you pass -1 to SDL_ShowCursor(), it won't change the current - cursor visibility state, but will still return it. - - SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning - you can nest them as deep as you want, as long as each lock call - has a matching unlock call. The surface remains locked until the - last matching unlock call. - - Note that you may not blit to or from a locked surface. - -1.1.7: - The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take - arrays of Uint16 values instead of Uint8 values. For the most part, - you can just take your old values and shift them up 8 bits to get - new correct values for your gamma ramps. - - You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface() - and SDL will try to RLE accelerate colorkey and alpha blits in the - resulting surface. - -1.1.6: - Added a function to return the thread ID of a specific thread: - Uint32 SDL_GetThreadID(SDL_Thread *thread) - If 'thread' is NULL, this function returns the id for this thread. - -1.1.5: - The YUV overlay structure has been changed to use an array of - pitches and pixels representing the planes of a YUV image, to - better enable hardware acceleration. The YV12 and IYUV formats - each have three planes, corresponding to the Y, U, and V portions - of the image, while packed pixel YUV formats just have one plane. - - For palettized mode (8bpp), the screen colormap is now split in - a physical and a logical palette. The physical palette determines - what colours the screen pixels will get when displayed, and the - logical palette controls the mapping from blits to/from the screen. - A new function, SDL_SetPalette() has been added to change - logical and physical palettes separately. SDL_SetColors() works - just as before, and is equivalent to calling SDL_SetPalette() with - a flag argument of (SDL_LOGPAL|SDL_PHYSPAL). - - SDL_BlitSurface() no longer modifies the source rectangle, only the - destination rectangle. The width/height members of the destination - rectangle are ignored, only the position is used. - - The old source clipping function SDL_SetClipping() has been replaced - with a more useful function to set the destination clipping rectangle: - SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect) - - Added a function to see what subsystems have been initialized: - Uint32 SDL_WasInit(Uint32 flags) - - The Big Alpha Flip: SDL now treats alpha as opacity like everybody - else, and not as transparency: - - A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255 - A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0 - Values between 0 and 255 vary from fully transparent to fully opaque. - - New functions: - SDL_DisplayFormatAlpha() - Returns a surface converted to a format with alpha-channel - that can be blit efficiently to the screen. (In other words, - like SDL_DisplayFormat() but the resulting surface has - an alpha channel.) This is useful for surfaces with alpha. - SDL_MapRGBA() - Works as SDL_MapRGB() but takes an additional alpha parameter. - SDL_GetRGBA() - Works as SDL_GetRGB() but also returns the alpha value - (SDL_ALPHA_OPAQUE for formats without an alpha channel) - - Both SDL_GetRGB() and SDL_GetRGBA() now always return values in - the [0..255] interval. Previously, SDL_GetRGB() would return - (0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format. - (N.B.: This is broken for bit fields < 3 bits.) - - SDL_MapRGB() returns pixels in which the alpha channel is set opaque. - - SDL_SetAlpha() can now be used for both setting the per-surface - alpha, using the new way of thinking of alpha, and also to enable - and disable per-pixel alpha blending for surfaces with an alpha - channel: - To disable alpha blending: - SDL_SetAlpha(surface, 0, 0); - To re-enable alpha blending: - SDL_SetAlpha(surface, SDL_SRCALPHA, 0); - Surfaces with an alpha channel have blending enabled by default. - - SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests - RLE acceleration of blits, just as like with SDL_SetColorKey(). - This flag can be set for both surfaces with an alpha channel - and surfaces with an alpha value set by SDL_SetAlpha(). - As always, RLE surfaces must be locked before pixel access is - allowed, and unlocked before any other SDL operations are done - on it. - - The blit semantics for surfaces with and without alpha and colorkey - have now been defined: - - RGBA->RGB: - SDL_SRCALPHA set: - alpha-blend (using alpha-channel). - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy RGB. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value); - set destination alpha to opaque. - SDL_SRCALPHA not set: - copy RGB, set destination alpha to opaque. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - RGBA->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source alpha channel) the RGB values; - leave destination alpha untouched. [Note: is this correct?] - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy all of RGBA to the destination. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGB: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value). - SDL_SRCALPHA not set: - copy RGB. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - As a special case, blits from surfaces with per-surface alpha - value of 128 (50% transparency) are optimised and much faster - than other alpha values. This does not apply to surfaces with - alpha channels (per-pixel alpha). - - New functions for manipulating the gamma of the display have - been added: - int SDL_SetGamma(float red, float green, float blue); - int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); - int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); - Gamma ramps are tables with 256 entries which map the screen color - components into actually displayed colors. For an example of - implementing gamma correction and gamma fades, see test/testgamma.c - Gamma control is not supported on all hardware. - -1.1.4: - The size of the SDL_CDtrack structure changed from 8 to 12 bytes - as the size of the length member was extended to 32 bits. - - You can now use SDL for 2D blitting with a GL mode by passing the - SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or - 32 bpp, and the data in the framebuffer is put into the GL scene - when you call SDL_UpdateRects(), and the scene will be visible - when you call SDL_GL_SwapBuffers(). - - Run the "testgl" test program with the -logo command line option - to see an example of this blending of 2D and 3D in SDL. - -1.1.3: - Added SDL_FreeRW() to the API, to complement SDL_AllocRW() - - Added resizable window support - just add SDL_RESIZABLE to the - SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events. - See SDL_events.h for details on the new SDL_ResizeEvent structure. - - Added condition variable support, based on mutexes and semaphores. - SDL_CreateCond() - SDL_DestroyCond() - SDL_CondSignal() - SDL_CondBroadcast() - SDL_CondWait() - SDL_CondTimedWait() - The new function prototypes are in SDL_mutex.h - - Added counting semaphore support, based on the mutex primitive. - SDL_CreateSemaphore() - SDL_DestroySemaphore() - SDL_SemWait() - SDL_SemTryWait() - SDL_SemWaitTimeout() - SDL_SemPost() - SDL_SemValue() - The new function prototypes are in SDL_mutex.h - - Added support for asynchronous blitting. To take advantage of this, - you must set the SDL_ASYNCBLIT flag when setting the video mode and - creating surfaces that you want accelerated in this way. You must - lock surfaces that have this flag set, and the lock will block until - any queued blits have completed. - - Added YUV video overlay support. - The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU. - This function creates an overlay surface: - SDL_CreateYUVOverlay() - You must lock and unlock the overlay to get access to the data: - SDL_LockYUVOverlay() SDL_UnlockYUVOverlay() - You can then display the overlay: - SDL_DisplayYUVOverlay() - You must free the overlay when you are done using it: - SDL_FreeYUVOverlay() - See SDL_video.h for the full function prototypes. - - The joystick hat position constants have been changed: - Old constant New constant - ------------ ------------ - 0 SDL_HAT_CENTERED - 1 SDL_HAT_UP - 2 SDL_HAT_RIGHTUP - 3 SDL_HAT_RIGHT - 4 SDL_HAT_RIGHTDOWN - 5 SDL_HAT_DOWN - 6 SDL_HAT_LEFTDOWN - 7 SDL_HAT_LEFT - 8 SDL_HAT_LEFTUP - The new constants are bitmasks, so you can check for the - individual axes like this: - if ( hat_position & SDL_HAT_UP ) { - } - and you'll catch left-up, up, and right-up. - -1.1.2: - Added multiple timer support: - SDL_AddTimer() and SDL_RemoveTimer() - - SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL. - -1.1.0: - Added initial OpenGL support. - First set GL attributes (such as RGB depth, alpha depth, etc.) - SDL_GL_SetAttribute() - Then call SDL_SetVideoMode() with the SDL_OPENGL flag. - Perform all of your normal GL drawing. - Finally swap the buffers with the new SDL function: - SDL_GL_SwapBuffers() - See the new 'testgl' test program for an example of using GL with SDL. - - You can load GL extension functions by using the function: - SDL_GL_LoadProcAddress() - - Added functions to initialize and cleanup specific SDL subsystems: - SDL_InitSubSystem() and SDL_QuitSubSystem() - - Added user-defined event type: - typedef struct { - Uint8 type; - int code; - void *data1; - void *data2; - } SDL_UserEvent; - This structure is in the "user" member of an SDL_Event. - - Added a function to push events into the event queue: - SDL_PushEvent() - - Example of using the new SDL user-defined events: - { - SDL_Event event; - - event.type = SDL_USEREVENT; - event.user.code = my_event_code; - event.user.data1 = significant_data; - event.user.data2 = 0; - SDL_PushEvent(&event); - } - - Added a function to get mouse deltas since last query: - SDL_GetRelativeMouseState() - - Added a boolean datatype to SDL_types.h: - SDL_bool = { SDL_TRUE, SDL_FALSE } - - Added a function to get the current audio status: - SDL_GetAudioState(); - It returns one of: - SDL_AUDIO_STOPPED, - SDL_AUDIO_PLAYING, - SDL_AUDIO_PAUSED - - Added an AAlib driver (ASCII Art) - by Stephane Peter. - -1.0.6: - The input grab state is reset after each call to SDL_SetVideoMode(). - The input is grabbed by default in fullscreen mode, and ungrabbed in - windowed mode. If you want to set input grab to a particular value, - you should set it after each call to SDL_SetVideoMode(). - -1.0.5: - Exposed SDL_AudioInit(), SDL_VideoInit() - Added SDL_AudioDriverName() and SDL_VideoDriverName() - - Added new window manager function: - SDL_WM_ToggleFullScreen() - This is currently implemented only on Linux - - The ALT-ENTER code has been removed - it's not appropriate for a - lib to bind keys when they aren't even emergency escape sequences. - - ALT-ENTER functionality can be implemented with the following code: - - int Handle_AltEnter(const SDL_Event *event) - { - if ( event->type == SDL_KEYDOWN ) { - if ( (event->key.keysym.sym == SDLK_RETURN) && - (event->key.keysym.mod & KMOD_ALT) ) { - SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); - return(0); - } - } - return(1); - } - SDL_SetEventFilter(Handle_AltEnter); - -1.0.3: - Under X11, if you grab the input and hide the mouse cursor, - the mouse will go into a "relative motion" mode where you - will always get relative motion events no matter how far in - each direction you move the mouse - relative motion is not - bounded by the edges of the window (though the absolute values - of the mouse positions are clamped by the size of the window). - The SVGAlib, framebuffer console, and DirectInput drivers all - have this behavior naturally, and the GDI and BWindow drivers - never go into "relative motion" mode. - -1.0.2: - Added a function to enable keyboard repeat: - SDL_EnableKeyRepeat() - - Added a function to grab the mouse and keyboard input - SDL_WM_GrabInput() - - Added a function to iconify the window. - SDL_WM_IconifyWindow() - If this function succeeds, the application will receive an event - signaling SDL_APPACTIVE event - -1.0.1: - Added constants to SDL_audio.h for 16-bit native byte ordering: - AUDIO_U16SYS, AUDIO_S16SYS - -1.0.0: - New public release - -0.11.5: - A new function SDL_GetVideoSurface() has been added, and returns - a pointer to the current display surface. - - SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and - a new function SDL_CreateRGBSurfaceFrom() has been added to allow - creating an SDL surface from an existing pixel data buffer. - - Added SDL_GetRGB() to the headers and documentation. - -0.11.4: - SDL_SetLibraryPath() is no longer meaningful, and has been removed. - -0.11.3: - A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from - installing fatal signal handlers on operating systems that support - them. - -0.9.15: - SDL_CreateColorCursor() has been removed. Color cursors should - be implemented as sprites, blitted by the application when the - cursor moves. To get smooth color cursor updates when the app - is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This - allows you to handle the mouse motion in another thread from an - event filter function, but is currently only supported by Linux - and BeOS. Note that you'll have to protect the display surface - from multi-threaded access by using mutexes if you do this. - - Thread-safe surface support has been removed from SDL. - This makes blitting somewhat faster, by removing SDL_MiddleBlit(). - Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead. - You can make your surfaces thread-safe by allocating your own - mutex and making lock/unlock calls around accesses to your surface. - -0.9.14: - SDL_GetMouseState() now takes pointers to int rather than Uint16. - - If you set the SDL_WINDOWID environment variable under UNIX X11, - SDL will use that as the main window instead of creating it's own. - This is an unsupported extension to SDL, and not portable at all. - -0.9.13: - Added a function SDL_SetLibraryPath() which can be used to specify - the directory containing the SDL dynamic libraries. This is useful - for commercial applications which ship with particular versions - of the libraries, and for security on multi-user systems. - If this function is not used, the default system directories are - searched using the native dynamic object loading mechanism. - - In order to support C linkage under Visual C++, you must declare - main() without any return type: - main(int argc, char *argv[]) { - /* Do the program... */ - return(0); - } - C++ programs should also return a value if compiled under VC++. - - The blit_endian member of the SDL_VideoInfo struct has been removed. - - SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there - is now no longer any function to translate a keysym to a character. - - The SDL_keysym structure has been extended with a 'scancode' and - 'unicode' member. The 'scancode' is a hardware specific scancode - for the key that was pressed, and may be 0. The 'unicode' member - is a 16-bit UNICODE translation of the key that was pressed along - with any modifiers or compose keys that have been pressed. - If no UNICODE translation exists for the key, 'unicode' will be 0. - - Added a function SDL_EnableUNICODE() to enable/disable UNICODE - translation of character keypresses. Translation defaults off. - - To convert existing code to use the new API, change code which - uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(), - and change code which uses it to get the ASCII value of a sym to - use the 'unicode' member of the event keysym. - -0.9.12: - There is partial support for 64-bit datatypes. I don't recommend - you use this if you have a choice, because 64-bit datatypes are not - supported on many platforms. On platforms for which it is supported, - the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and - you can use the Uint64 and Sint64 datatypes. - - Added functions to SDL_endian.h to support 64-bit datatypes: - SDL_SwapLE64(), SDL_SwapBE64(), - SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64() - - A new member "len_ratio" has been added to the SDL_AudioCVT structure, - and allows you to determine either the original buffer length or the - converted buffer length, given the other. - - A new function SDL_FreeWAV() has been added to the API to free data - allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since - the gcc compiled DLL uses a different heap than VC++ compiled apps. - - SDL now has initial support for international keyboards using the - Latin character set. - If a particular mapping is desired, you can set the DEFAULT_KEYBOARD - compile-time variable, or you can set the environment variable - "SDL_KEYBOARD" to a string identifying the keyboard mapping you desire. - The valid values for these variables can be found in SDL_keyboard.c - - Full support for German and French keyboards under X11 is implemented. - -0.9.11: - The THREADED_EVENTS compile-time define has been replaced with the - SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(), - SDL will create a separate thread to perform input event handling. - If this flag is passed to SDL_Init(), and the OS doesn't support - event handling in a separate thread, SDL_Init() will fail. - Be sure to add calls to SDL_Delay() in your main thread to allow - the OS to schedule your event thread, or it may starve, leading - to slow event delivery and/or dropped events. - Currently MacOS and Win32 do not support this flag, while BeOS - and Linux do support it. I recommend that your application only - use this flag if absolutely necessary. - - The SDL thread function passed to SDL_CreateThread() now returns a - status. This status can be retrieved by passing a non-NULL pointer - as the 'status' argument to SDL_WaitThread(). - - The volume parameter to SDL_MixAudio() has been increased in range - from (0-8) to (0-128) - - SDL now has a data source abstraction which can encompass a file, - an area of memory, or any custom object you can envision. It uses - these abstractions, SDL_RWops, in the endian read/write functions, - and the built-in WAV and BMP file loaders. This means you can load - WAV chunks from memory mapped files, compressed archives, network - pipes, or anything else that has a data read abstraction. - - There are three built-in data source abstractions: - SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem() - along with a generic data source allocation function: - SDL_AllocRW() - These data sources can be used like stdio file pointers with the - following convenience functions: - SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose() - These functions are defined in the new header file "SDL_rwops.h" - - The endian swapping functions have been turned into macros for speed - and SDL_CalculateEndian() has been removed. SDL_endian.h now defines - SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on - the endianness of the host system. - - The endian read/write functions now take an SDL_RWops pointer - instead of a stdio FILE pointer, to support the new data source - abstraction. - - The SDL_*LoadWAV() functions have been replaced with a single - SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's - first parameter, and a flag whether or not to automatically - free it as the second parameter. SDL_LoadWAV() is a macro for - backward compatibility and convenience: - SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); - - The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced - with a single function that takes a SDL_RWops pointer as it's - first parameter, and a flag whether or not to automatically - free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP() - are macros for backward compatibility and convenience: - SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...); - SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...); - Note that these functions use SDL_RWseek() extensively, and should - not be used on pipes or other non-seekable data sources. - -0.9.10: - The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been - extended to support multiple types of display drivers, as well as - safe access to the X11 display when THREADED_EVENTS is enabled. - The new structures are documented in the SDL_syswm.h header file. - - Thanks to John Elliott , the UK keyboard - should now work properly, as well as the "Windows" keys on US - keyboards. - - The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab - instead of trying to open each block device on the system. - The CD must be listed in /etc/fstab as using the iso9660 filesystem. - - On Linux, if you define THREADED_EVENTS at compile time, a separate - thread will be spawned to gather X events asynchronously from the - graphics updates. This hasn't been extensively tested, but it does - provide a means of handling keyboard and mouse input in a separate - thread from the graphics thread. (This is now enabled by default.) - - A special access function SDL_PeepEvents() allows you to manipulate - the event queue in a thread-safe manner, including peeking at events, - removing events of a specified type, and adding new events of arbitrary - type to the queue (use the new 'user' member of the SDL_Event type). - - If you use SDL_PeepEvents() to gather events, then the main graphics - thread needs to call SDL_PumpEvents() periodically to drive the event - loop and generate input events. This is not necessary if SDL has been - compiled with THREADED_EVENTS defined, but doesn't hurt. - - A new function SDL_ThreadID() returns the identifier associated with - the current thread. - -0.9.9: - The AUDIO_STEREO format flag has been replaced with a new 'channels' - member of the SDL_AudioSpec structure. The channels are 1 for mono - audio, and 2 for stereo audio. In the future more channels may be - supported for 3D surround sound. - - The SDL_MixAudio() function now takes an additional volume parameter, - which should be set to SDL_MIX_MAXVOLUME for compatibility with the - original function. - - The CD-ROM functions which take a 'cdrom' parameter can now be - passed NULL, and will act on the last successfully opened CD-ROM. - -0.9.8: - No changes, bugfixes only. - -0.9.7: - No changes, bugfixes only. - -0.9.6: - Added a fast rectangle fill function: SDL_FillRect() - - Addition of a useful function for getting info on the video hardware: - const SDL_VideoInfo *SDL_GetVideoInfo(void) - This function replaces SDL_GetDisplayFormat(). - - Initial support for double-buffering: - Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode() - Update the screen with a new function: SDL_Flip() - - SDL_AllocSurface() takes two new flags: - SDL_SRCCOLORKEY means that the surface will be used for colorkey blits - and if the hardware supports hardware acceleration of colorkey blits - between two surfaces in video memory, to place the surface in video - memory if possible, otherwise it will be placed in system memory. - SDL_SRCALPHA means that the surface will be used for alpha blits and - if the hardware supports hardware acceleration of alpha blits between - two surfaces in video memory, to place the surface in video memory - if possible, otherwise it will be placed in system memory. - SDL_HWSURFACE now means that the surface will be created with the - same format as the display surface, since having surfaces in video - memory is only useful for fast blitting to the screen, and you can't - blit surfaces with different surface formats in video memory. - -0.9.5: - You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume - that the icon consists of the entire image. - - SDL_LowerBlit() is back -- but don't use it on the display surface. - It is exactly the same as SDL_MiddleBlit(), but doesn't check for - thread safety. - - Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take - a FILE pointer instead of a file name. - - Added CD-ROM audio control API: - SDL_CDNumDrives() - SDL_CDName() - SDL_CDOpen() - SDL_CDStatus() - SDL_CDPlayTracks() - SDL_CDPlay() - SDL_CDPause() - SDL_CDResume() - SDL_CDStop() - SDL_CDEject() - SDL_CDClose() - -0.9.4: - No changes, bugfixes only. - -0.9.3: - Mouse motion event now includes relative motion information: - Sint16 event->motion.xrel, Sint16 event->motion.yrel - - X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT - (Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile) - -0.9.2: - No changes, bugfixes only. - -0.9.1: - Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now - automatically mapped on blit. - -0.8.0: - SDL stable release diff --git a/project/jni/sdl-1.3/include/SDL b/project/jni/sdl-1.3/include/SDL deleted file mode 120000 index 945c9b46d..000000000 --- a/project/jni/sdl-1.3/include/SDL +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/project/jni/sdl-1.3/include/SDL.h b/project/jni/sdl-1.3/include/SDL.h index d6f130fca..6b584b7bd 100644 --- a/project/jni/sdl-1.3/include/SDL.h +++ b/project/jni/sdl-1.3/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,7 +90,6 @@ #include "SDL_timer.h" #include "SDL_version.h" #include "SDL_video.h" -#include "SDL_compat.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ diff --git a/project/jni/sdl-1.3/include/SDL_assert.h b/project/jni/sdl-1.3/include/SDL_assert.h index 19331232b..7c3887e21 100644 --- a/project/jni/sdl-1.3/include/SDL_assert.h +++ b/project/jni/sdl-1.3/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_atomic.h b/project/jni/sdl-1.3/include/SDL_atomic.h index 6a6a73f5b..a036b6d28 100644 --- a/project/jni/sdl-1.3/include/SDL_atomic.h +++ b/project/jni/sdl-1.3/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_audio.h b/project/jni/sdl-1.3/include/SDL_audio.h index 611084129..c443ac1f7 100644 --- a/project/jni/sdl-1.3/include/SDL_audio.h +++ b/project/jni/sdl-1.3/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,7 @@ extern "C" { 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 \endverbatim * - * There are macros in SDL 1.3 and later to query these bits. + * There are macros in SDL 2.0 and later to query these bits. */ typedef Uint16 SDL_AudioFormat; diff --git a/project/jni/sdl-1.3/include/SDL_blendmode.h b/project/jni/sdl-1.3/include/SDL_blendmode.h index 11d91bb1a..54b24ae9a 100644 --- a/project/jni/sdl-1.3/include/SDL_blendmode.h +++ b/project/jni/sdl-1.3/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_clipboard.h b/project/jni/sdl-1.3/include/SDL_clipboard.h index 7c60d6373..8a4d1b382 100644 --- a/project/jni/sdl-1.3/include/SDL_clipboard.h +++ b/project/jni/sdl-1.3/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** - * \brief Returns a flag indicating whether the clipboard exists and contains a text string that it non-empty + * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty * * \sa SDL_GetClipboardText() */ diff --git a/project/jni/sdl-1.3/include/SDL_compat.h b/project/jni/sdl-1.3/include/SDL_compat.h deleted file mode 100644 index c71022d80..000000000 --- a/project/jni/sdl-1.3/include/SDL_compat.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - - /** - * \defgroup Compatibility SDL 1.2 Compatibility API - */ -/*@{*/ - -/** - * \file SDL_compat.h - * - * This file contains functions for backwards compatibility with SDL 1.2. - */ - -/** - * \def SDL_NO_COMPAT - * - * #define SDL_NO_COMPAT to prevent SDL_compat.h from being included. - * SDL_NO_COMPAT is intended to make it easier to covert SDL 1.2 code to - * SDL 1.3/2.0. - */ - - /*@}*/ - -#ifdef SDL_NO_COMPAT -#define _SDL_compat_h -#endif - -#ifndef _SDL_compat_h -#define _SDL_compat_h - -#include "SDL_video.h" -#include "SDL_version.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -/** - * \addtogroup Compatibility - */ -/*@{*/ - -/* Platform */ -#ifdef __WIN32__ -#undef __WIN32__ -#define __WIN32__ 1 -#endif - -/** - * \name Surface flags - */ -/*@{*/ -#define SDL_SWSURFACE 0x00000000 /**< \note Not used */ -#define SDL_SRCALPHA 0x00010000 -#define SDL_SRCCOLORKEY 0x00020000 -#define SDL_ANYFORMAT 0x00100000 -#define SDL_HWPALETTE 0x00200000 -#define SDL_DOUBLEBUF 0x00400000 -#define SDL_FULLSCREEN 0x00800000 -#define SDL_RESIZABLE 0x01000000 -#define SDL_NOFRAME 0x02000000 -#define SDL_OPENGL 0x04000000 -#define SDL_HWSURFACE 0x08000001 /**< \note Not used */ -#define SDL_ASYNCBLIT 0x08000000 /**< \note Not used */ -#define SDL_RLEACCELOK 0x08000000 /**< \note Not used */ -#define SDL_HWACCEL 0x08000000 /**< \note Not used */ -/*@}*//*Surface flags*/ - -#define SDL_APPMOUSEFOCUS 0x01 -#define SDL_APPINPUTFOCUS 0x02 -#define SDL_APPACTIVE 0x04 - -#define SDL_LOGPAL 0x01 -#define SDL_PHYSPAL 0x02 - -#define SDL_ACTIVEEVENT SDL_EVENT_COMPAT1 -#define SDL_VIDEORESIZE SDL_EVENT_COMPAT2 -#define SDL_VIDEOEXPOSE SDL_EVENT_COMPAT3 -#define SDL_ACTIVEEVENTMASK SDL_ACTIVEEVENT, SDL_ACTIVEEVENT -#define SDL_VIDEORESIZEMASK SDL_VIDEORESIZE, SDL_VIDEORESIZE -#define SDL_VIDEOEXPOSEMASK SDL_VIDEOEXPOSE, SDL_VIDEOEXPOSE -#define SDL_WINDOWEVENTMASK SDL_WINDOWEVENT, SDL_WINDOWEVENT -#define SDL_KEYDOWNMASK SDL_KEYDOWN, SDL_KEYDOWN -#define SDL_KEYUPMASK SDL_KEYUP, SDL_KEYUP -#define SDL_KEYEVENTMASK SDL_KEYDOWN, SDL_KEYUP -#define SDL_TEXTEDITINGMASK SDL_TEXTEDITING, SDL_TEXTEDITING -#define SDL_TEXTINPUTMASK SDL_TEXTINPUT, SDL_TEXTINPUT -#define SDL_MOUSEMOTIONMASK SDL_MOUSEMOTION, SDL_MOUSEMOTION -#define SDL_MOUSEBUTTONDOWNMASK SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWN -#define SDL_MOUSEBUTTONUPMASK SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUP -#define SDL_MOUSEWHEELMASK SDL_MOUSEWHEEL, SDL_MOUSEWHEEL -#define SDL_MOUSEEVENTMASK SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP -#define SDL_JOYAXISMOTIONMASK SDL_JOYAXISMOTION, SDL_JOYAXISMOTION -#define SDL_JOYBALLMOTIONMASK SDL_JOYBALLMOTION, SDL_JOYBALLMOTION -#define SDL_JOYHATMOTIONMASK SDL_JOYHATMOTION, SDL_JOYHATMOTION -#define SDL_JOYBUTTONDOWNMASK SDL_JOYBUTTONDOWN, SDL_JOYBUTTONDOWN -#define SDL_JOYBUTTONUPMASK SDL_JOYBUTTONUP, SDL_JOYBUTTONUP -#define SDL_JOYEVENTMASK SDL_JOYAXISMOTION, SDL_JOYBUTTONUP -#define SDL_QUITMASK SDL_QUIT, SDL_QUIT -#define SDL_SYSWMEVENTMASK SDL_SYSWMEVENT, SDL_SYSWMEVENT -#define SDL_PROXIMITYINMASK SDL_PROXIMITYIN, SDL_PROXIMITYIN -#define SDL_PROXIMITYOUTMASK SDL_PROXIMITYOUT, SDL_PROXIMITYOUT -#define SDL_ALLEVENTS SDL_FIRSTEVENT, SDL_LASTEVENT - -#define SDL_BUTTON_WHEELUP 4 -#define SDL_BUTTON_WHEELDOWN 5 - -#define SDL_DEFAULT_REPEAT_DELAY 500 -#define SDL_DEFAULT_REPEAT_INTERVAL 30 - -typedef struct SDL_VideoInfo -{ - Uint32 hw_available:1; - Uint32 wm_available:1; - Uint32 UnusedBits1:6; - Uint32 UnusedBits2:1; - Uint32 blit_hw:1; - Uint32 blit_hw_CC:1; - Uint32 blit_hw_A:1; - Uint32 blit_sw:1; - Uint32 blit_sw_CC:1; - Uint32 blit_sw_A:1; - Uint32 blit_fill:1; - Uint32 UnusedBits3:16; - Uint32 video_mem; - - SDL_PixelFormat *vfmt; - - int current_w; - int current_h; -} SDL_VideoInfo; - -/** - * \name Overlay formats - * - * The most common video overlay formats. - * - * For an explanation of these pixel formats, see: - * http://www.webartz.com/fourcc/indexyuv.htm - * - * For information on the relationship between color spaces, see: - * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html - */ -/*@{*/ -#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */ -#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */ -#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ -#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ -#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ -/*@}*//*Overlay formats*/ - -/** - * The YUV hardware video overlay. - */ -typedef struct SDL_Overlay -{ - Uint32 format; /**< Read-only */ - int w, h; /**< Read-only */ - int planes; /**< Read-only */ - Uint16 *pitches; /**< Read-only */ - Uint8 **pixels; /**< Read-write */ - - /** - * \name Hardware-specific surface info - */ - /*@{*/ - struct private_yuvhwfuncs *hwfuncs; - struct private_yuvhwdata *hwdata; - /*@}*//*Hardware-specific surface info*/ - - /** - * \name Special flags - */ - /*@{*/ - Uint32 hw_overlay:1; /**< Flag: This overlay hardware accelerated? */ - Uint32 UnusedBits:31; - /*@}*//*Special flags*/ -} SDL_Overlay; - -typedef enum -{ - SDL_GRAB_QUERY = -1, - SDL_GRAB_OFF = 0, - SDL_GRAB_ON = 1 -} SDL_GrabMode; - -struct SDL_SysWMinfo; - -/** - * \name Obsolete or renamed key codes - */ -/*@{*/ - -#define SDL_keysym SDL_Keysym -#define SDL_KeySym SDL_Keysym -#define SDL_scancode SDL_Scancode -#define SDL_ScanCode SDL_Scancode -#define SDLKey SDL_Keycode -#define SDLMod SDL_Keymod - -/** - * \name Renamed keys - * - * These key constants were renamed for clarity or consistency. - */ -/*@{*/ -#define SDLK_KP0 SDLK_KP_0 -#define SDLK_KP1 SDLK_KP_1 -#define SDLK_KP2 SDLK_KP_2 -#define SDLK_KP3 SDLK_KP_3 -#define SDLK_KP4 SDLK_KP_4 -#define SDLK_KP5 SDLK_KP_5 -#define SDLK_KP6 SDLK_KP_6 -#define SDLK_KP7 SDLK_KP_7 -#define SDLK_KP8 SDLK_KP_8 -#define SDLK_KP9 SDLK_KP_9 -#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR -#define SDLK_SCROLLOCK SDLK_SCROLLLOCK -#define SDLK_PRINT SDLK_PRINTSCREEN -#define SDLK_LMETA SDLK_LGUI -#define SDLK_RMETA SDLK_RGUI -/*@}*//*Renamed keys*/ - -/** - * \name META modifier - * - * The META modifier is equivalent to the GUI modifier from the USB standard. - */ -/*@{*/ -#define KMOD_LMETA KMOD_LGUI -#define KMOD_RMETA KMOD_RGUI -#define KMOD_META KMOD_GUI -/*@}*//*META modifier*/ - -/** - * \name Not in USB - * - * These keys don't appear in the USB specification (or at least not under - * those names). I'm unsure if the following assignments make sense or if these - * codes should be defined as actual additional SDLK_ constants. - */ -/*@{*/ -#define SDLK_LSUPER SDLK_LMETA -#define SDLK_RSUPER SDLK_RMETA -#define SDLK_COMPOSE SDLK_APPLICATION -#define SDLK_BREAK SDLK_STOP -#define SDLK_EURO SDLK_2 -/*@}*//*Not in USB*/ - -/*@}*//*Obsolete or renamed key codes*/ - -#define SDL_SetModuleHandle(x) -#define SDL_AllocSurface SDL_CreateRGBSurface - -extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void); -extern DECLSPEC const char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); -extern DECLSPEC const char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); -extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void); -extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, - int height, - int bpp, Uint32 flags); -extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat * - format, Uint32 flags); -extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height, - int bpp, Uint32 flags); -extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void); -extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen, - int numrects, SDL_Rect * rects); -extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, - Sint32 x, - Sint32 y, Uint32 w, Uint32 h); -extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen); -extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, - Uint32 flag, Uint8 alpha); -extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface); -extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * - surface); -extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, - const char *icon); -extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, - const char **icon); -extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask); -extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); -extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface); -extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); -extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, - int flags, - const SDL_Color * colors, - int firstcolor, int ncolors); -extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface, - const SDL_Color * colors, - int firstcolor, int ncolors); -extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info); -extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); -extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); -extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width, - int height, - Uint32 format, - SDL_Surface * - display); -extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay); -extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay); -extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay, - SDL_Rect * dstrect); -extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay); -extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); -extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); -extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red, - const Uint16 * green, - const Uint16 * blue); -extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, - Uint16 * blue); -extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); -extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); -extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); - -typedef SDL_Window* SDL_WindowID; - -#define SDL_KillThread(X) - -/* The timeslice and timer resolution are no longer relevant */ -#define SDL_TIMESLICE 10 -#define TIMER_RESOLUTION 10 - -typedef Uint32 (SDLCALL * SDL_OldTimerCallback) (Uint32 interval); -extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback); - -extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); - -/*@}*//*Compatibility*/ - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif -#include "close_code.h" - -#endif /* _SDL_compat_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/include/SDL_config.h b/project/jni/sdl-1.3/include/SDL_config.h index 74ff4f2e3..03ff56f54 100644 --- a/project/jni/sdl-1.3/include/SDL_config.h +++ b/project/jni/sdl-1.3/include/SDL_config.h @@ -1,23 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Simple DirectMedia Layer + Copyright (C) 1997-2011 Sam Lantinga - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_config_h @@ -26,24 +25,27 @@ #include "SDL_platform.h" /** - * \file SDL_config.h.default - * - * SDL_config.h for any platform that doesn't build using the configure system. + * \file SDL_config.h */ /* Add any platform that doesn't build using the configure system. */ -#if defined(__NINTENDODS__) -#include "SDL_config_nintendods.h" -#elif defined(__IPHONEOS__) -#include "SDL_config_iphoneos.h" +#if defined(__WIN32__) +#include "SDL_config_windows.h" #elif defined(__MACOSX__) #include "SDL_config_macosx.h" -#elif defined(__WIN32__) -#include "SDL_config_win32.h" -#elif defined(ANDROID) +#elif defined(__IPHONEOS__) +#include "SDL_config_iphoneos.h" +#elif defined(__ANDROID__) #include "SDL_config_android.h" +#elif defined(__NINTENDODS__) +#include "SDL_config_nintendods.h" #else +/* This is a minimal configuration just to get SDL running on new platforms */ #include "SDL_config_minimal.h" #endif /* platform config */ +#ifdef USING_GENERATED_CONFIG_H +#error Wrong SDL_config.h, check your include path? +#endif + #endif /* _SDL_config_h */ diff --git a/project/jni/sdl-1.3/include/SDL_config.h.default b/project/jni/sdl-1.3/include/SDL_config.h.default deleted file mode 100644 index c6b17de41..000000000 --- a/project/jni/sdl-1.3/include/SDL_config.h.default +++ /dev/null @@ -1,49 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#ifndef _SDL_config_h -#define _SDL_config_h - -#include "SDL_platform.h" - -/** - * \file SDL_config.h.default - * - * SDL_config.h for any platform that doesn't build using the configure system. - */ - -/* Add any platform that doesn't build using the configure system. */ -#if defined(__NINTENDODS__) -#include "SDL_config_nintendods.h" -#elif defined(__ANDROID__) -#include "SDL_config_android.h" -#elif defined(__IPHONEOS__) -#include "SDL_config_iphoneos.h" -#elif defined(__MACOSX__) -#include "SDL_config_macosx.h" -#elif defined(__WIN32__) -#include "SDL_config_win32.h" -#else -#include "SDL_config_minimal.h" -#endif /* platform config */ - -#endif /* _SDL_config_h */ diff --git a/project/jni/sdl-1.3/include/SDL_config.h.in b/project/jni/sdl-1.3/include/SDL_config.h.in index 9eed823d7..0a9f40209 100644 --- a/project/jni/sdl-1.3/include/SDL_config.h.in +++ b/project/jni/sdl-1.3/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -151,6 +151,7 @@ #undef HAVE_ICONV #undef HAVE_PTHREAD_SETNAME_NP #undef HAVE_PTHREAD_SET_NAME_NP +#undef HAVE_SEM_TIMEDWAIT #else /* We may need some replacement for stdarg.h here */ @@ -271,6 +272,7 @@ #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_OGL #undef SDL_VIDEO_RENDER_OGL_ES +#undef SDL_VIDEO_RENDER_OGL_ES2 #undef SDL_VIDEO_RENDER_DIRECTFB /* Enable OpenGL support */ diff --git a/project/jni/sdl-1.3/include/SDL_config_iphoneos.h b/project/jni/sdl-1.3/include/SDL_config_iphoneos.h index f953efef7..a0fe5fc36 100644 --- a/project/jni/sdl-1.3/include/SDL_config_iphoneos.h +++ b/project/jni/sdl-1.3/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_config_macosx.h b/project/jni/sdl-1.3/include/SDL_config_macosx.h index 57e2f7458..4e9ef9ffa 100644 --- a/project/jni/sdl-1.3/include/SDL_config_macosx.h +++ b/project/jni/sdl-1.3/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_config_minimal.h b/project/jni/sdl-1.3/include/SDL_config_minimal.h index 2145d3ea8..7fef16442 100644 --- a/project/jni/sdl-1.3/include/SDL_config_minimal.h +++ b/project/jni/sdl-1.3/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #include #include -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) typedef unsigned int size_t; typedef signed char int8_t; typedef unsigned char uint8_t; @@ -44,7 +44,7 @@ typedef unsigned int uint32_t; typedef signed long long int64_t; typedef unsigned long long uint64_t; typedef unsigned long uintptr_t; -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ +#endif /* if (stdint.h isn't available) */ #ifdef __GNUC__ #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 diff --git a/project/jni/sdl-1.3/include/SDL_config_nintendods.h b/project/jni/sdl-1.3/include/SDL_config_nintendods.h index 859e8a6bc..97c2d0871 100644 --- a/project/jni/sdl-1.3/include/SDL_config_nintendods.h +++ b/project/jni/sdl-1.3/include/SDL_config_nintendods.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_config_pandora.h b/project/jni/sdl-1.3/include/SDL_config_pandora.h index 15292fcd5..a4ce2fb61 100644 --- a/project/jni/sdl-1.3/include/SDL_config_pandora.h +++ b/project/jni/sdl-1.3/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_config_win32.h b/project/jni/sdl-1.3/include/SDL_config_win32.h deleted file mode 100644 index 2ea0e37da..000000000 --- a/project/jni/sdl-1.3/include/SDL_config_win32.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2010 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#ifndef _SDL_config_win32_h -#define _SDL_config_win32_h - -#include "SDL_platform.h" - -/* This is a set of defines to configure the SDL features */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -#endif -#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) -#define LONG_PTR LONG -#endif -#else /* !__GNUC__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __GNUC__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -#ifdef _WIN64 -# define SIZEOF_VOIDP 8 -#else -# define SIZEOF_VOIDP 4 -#endif -#define SDL_HAS_64BIT_TYPE 1 - -/* Enabled for SDL 1.2 (binary compatibility) */ -//#define HAVE_LIBC 1 -#ifdef HAVE_LIBC -/* Useful headers */ -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#ifndef _WIN32_WCE -#define HAVE_SIGNAL_H 1 -#endif - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_ITOA 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE_SSCANF 1 -#define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#endif - -/* Enable various audio drivers */ -#ifndef _WIN32_WCE -#define SDL_AUDIO_DRIVER_DSOUND 1 -#endif -#define SDL_AUDIO_DRIVER_WINWAVEOUT 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#ifdef _WIN32_WCE -#define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DUMMY 1 -#else -#define SDL_JOYSTICK_DINPUT 1 -#define SDL_HAPTIC_DINPUT 1 -#endif - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WIN32 1 - -/* Enable various threading systems */ -#define SDL_THREAD_WIN32 1 - -/* Enable various timer systems */ -#ifdef _WIN32_WCE -#define SDL_TIMER_WINCE 1 -#else -#define SDL_TIMER_WIN32 1 -#endif - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WIN32 1 - -#define SDL_VIDEO_RENDER_D3D 1 -#define SDL_VIDEO_RENDER_GDI 1 - -/* Enable OpenGL support */ -#ifndef _WIN32_WCE -#define SDL_VIDEO_OPENGL 1 -#define SDL_VIDEO_OPENGL_WGL 1 -#define SDL_VIDEO_RENDER_OGL 1 -#endif - -/* Enable system power support */ -#define SDL_POWER_WINDOWS 1 - -/* Enable assembly routines (Win64 doesn't have inline asm) */ -#ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 -#endif - -#endif /* _SDL_config_win32_h */ diff --git a/project/jni/sdl-1.3/include/SDL_config_windows.h b/project/jni/sdl-1.3/include/SDL_config_windows.h index b980f0d1a..ac5b8a9dc 100644 --- a/project/jni/sdl-1.3/include/SDL_config_windows.h +++ b/project/jni/sdl-1.3/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_config_wiz.h b/project/jni/sdl-1.3/include/SDL_config_wiz.h index fa2e919ce..e2c675e0d 100644 --- a/project/jni/sdl-1.3/include/SDL_config_wiz.h +++ b/project/jni/sdl-1.3/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_copying.h b/project/jni/sdl-1.3/include/SDL_copying.h index 91049cd7c..189aceeb5 100644 --- a/project/jni/sdl-1.3/include/SDL_copying.h +++ b/project/jni/sdl-1.3/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_cpuinfo.h b/project/jni/sdl-1.3/include/SDL_cpuinfo.h index 7fb39edb4..3c5b94389 100644 --- a/project/jni/sdl-1.3/include/SDL_cpuinfo.h +++ b/project/jni/sdl-1.3/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_endian.h b/project/jni/sdl-1.3/include/SDL_endian.h index 5b23e78af..571fd994d 100644 --- a/project/jni/sdl-1.3/include/SDL_endian.h +++ b/project/jni/sdl-1.3/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,10 +91,10 @@ SDL_Swap16(Uint16 x) static __inline__ Uint16 SDL_Swap16(Uint16 x) { - Uint16 result; + int result; __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); - return result; + return (Uint16)result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) static __inline__ Uint16 diff --git a/project/jni/sdl-1.3/include/SDL_error.h b/project/jni/sdl-1.3/include/SDL_error.h index d28b41665..16e5f08d1 100644 --- a/project/jni/sdl-1.3/include/SDL_error.h +++ b/project/jni/sdl-1.3/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_events.h b/project/jni/sdl-1.3/include/SDL_events.h index 13559a883..39648af4d 100644 --- a/project/jni/sdl-1.3/include/SDL_events.h +++ b/project/jni/sdl-1.3/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -109,12 +109,6 @@ typedef enum /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ - /* Obsolete events */ - SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ - SDL_EVENT_COMPAT2, - SDL_EVENT_COMPAT3, - - /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, * and should be allocated with SDL_RegisterEvents() */ @@ -132,6 +126,7 @@ typedef enum typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ + Uint32 timestamp; Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; @@ -147,6 +142,7 @@ typedef struct SDL_WindowEvent typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ + Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ @@ -162,6 +158,7 @@ typedef struct SDL_KeyboardEvent typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ + Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ int start; /**< The start cursor of selected editing text */ @@ -176,6 +173,7 @@ typedef struct SDL_TextEditingEvent typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ + Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -186,6 +184,7 @@ typedef struct SDL_TextInputEvent typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 state; /**< The current button state */ Uint8 padding1; @@ -203,6 +202,7 @@ typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -218,6 +218,7 @@ typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ int x; /**< The amount scrolled horizontally */ int y; /**< The amount scrolled vertically */ @@ -229,6 +230,7 @@ typedef struct SDL_MouseWheelEvent typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ + Uint32 timestamp; Uint8 which; /**< The joystick device index */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; @@ -242,6 +244,7 @@ typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ + Uint32 timestamp; Uint8 which; /**< The joystick device index */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; @@ -256,6 +259,7 @@ typedef struct SDL_JoyBallEvent typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ + Uint32 timestamp; Uint8 which; /**< The joystick device index */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. @@ -274,6 +278,7 @@ typedef struct SDL_JoyHatEvent typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ + Uint32 timestamp; Uint8 which; /**< The joystick device index */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -288,6 +293,7 @@ typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION OR SDL_FINGERDOWN OR SDL_FINGERUP*/ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; @@ -309,6 +315,7 @@ typedef struct SDL_TouchFingerEvent typedef struct SDL_TouchButtonEvent { Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ SDL_TouchID touchId; /**< The touch device index */ Uint8 state; /**< The current button state */ @@ -324,6 +331,7 @@ typedef struct SDL_TouchButtonEvent typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ SDL_TouchID touchId; /**< The touch device index */ float dTheta; @@ -338,6 +346,7 @@ typedef struct SDL_MultiGestureEvent typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE */ + Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ SDL_TouchID touchId; /**< The touch device index */ SDL_GestureID gestureId; @@ -359,6 +368,7 @@ typedef struct SDL_DollarGestureEvent typedef struct SDL_DropEvent { Uint32 type; /**< ::SDL_DROPFILE */ + Uint32 timestamp; char *file; /**< The file name, which should be freed with SDL_free() */ } SDL_DropEvent; @@ -369,6 +379,7 @@ typedef struct SDL_DropEvent typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ + Uint32 timestamp; } SDL_QuitEvent; @@ -378,6 +389,7 @@ typedef struct SDL_QuitEvent typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */ + Uint32 timestamp; Uint32 windowID; /**< The associated window if any */ int code; /**< User defined event code */ void *data1; /**< User defined data pointer */ @@ -397,37 +409,10 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ + Uint32 timestamp; SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; -#ifndef SDL_NO_COMPAT -/** - * \addtogroup Compatibility - */ -/*@{*/ - -/** - * \name Typedefs for backwards compatibility - */ -/*@{*/ -typedef struct SDL_ActiveEvent -{ - Uint32 type; - Uint8 gain; - Uint8 state; -} SDL_ActiveEvent; - -typedef struct SDL_ResizeEvent -{ - Uint32 type; - int w; - int h; -} SDL_ResizeEvent; -/*@}*/ - -/*@}*//*Compatibility*/ -#endif - /** * \brief General event structure */ @@ -453,14 +438,6 @@ typedef union SDL_Event SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */ SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */ SDL_DropEvent drop; /**< Drag and drop event data */ - - /** Temporarily here for backwards compatibility */ - /*@{*/ -#ifndef SDL_NO_COMPAT - SDL_ActiveEvent active; - SDL_ResizeEvent resize; -#endif - /*@}*/ } SDL_Event; diff --git a/project/jni/sdl-1.3/include/SDL_gesture.h b/project/jni/sdl-1.3/include/SDL_gesture.h index 940d346ce..8ef2205ad 100644 --- a/project/jni/sdl-1.3/include/SDL_gesture.h +++ b/project/jni/sdl-1.3/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_haptic.h b/project/jni/sdl-1.3/include/SDL_haptic.h index 6b354a2d1..e0267007b 100644 --- a/project/jni/sdl-1.3/include/SDL_haptic.h +++ b/project/jni/sdl-1.3/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_hints.h b/project/jni/sdl-1.3/include/SDL_hints.h index 64323917a..7500ee701 100644 --- a/project/jni/sdl-1.3/include/SDL_hints.h +++ b/project/jni/sdl-1.3/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_input.h b/project/jni/sdl-1.3/include/SDL_input.h index 354d4d35e..95dc3b0fb 100644 --- a/project/jni/sdl-1.3/include/SDL_input.h +++ b/project/jni/sdl-1.3/include/SDL_input.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_joystick.h b/project/jni/sdl-1.3/include/SDL_joystick.h index e83726a7e..602206527 100644 --- a/project/jni/sdl-1.3/include/SDL_joystick.h +++ b/project/jni/sdl-1.3/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_keyboard.h b/project/jni/sdl-1.3/include/SDL_keyboard.h index 1f9a66df2..16c33b59d 100644 --- a/project/jni/sdl-1.3/include/SDL_keyboard.h +++ b/project/jni/sdl-1.3/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_keycode.h b/project/jni/sdl-1.3/include/SDL_keycode.h index 5be1f7157..a020b1610 100644 --- a/project/jni/sdl-1.3/include/SDL_keycode.h +++ b/project/jni/sdl-1.3/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_loadso.h b/project/jni/sdl-1.3/include/SDL_loadso.h index 821ca2d7d..7366ab856 100644 --- a/project/jni/sdl-1.3/include/SDL_loadso.h +++ b/project/jni/sdl-1.3/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_log.h b/project/jni/sdl-1.3/include/SDL_log.h index cd7358418..9f7e8b4f0 100644 --- a/project/jni/sdl-1.3/include/SDL_log.h +++ b/project/jni/sdl-1.3/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_main.h b/project/jni/sdl-1.3/include/SDL_main.h index 905fd53fb..b9d252b26 100644 --- a/project/jni/sdl-1.3/include/SDL_main.h +++ b/project/jni/sdl-1.3/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_mouse.h b/project/jni/sdl-1.3/include/SDL_mouse.h index de7d14149..1650794f5 100644 --- a/project/jni/sdl-1.3/include/SDL_mouse.h +++ b/project/jni/sdl-1.3/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_mutex.h b/project/jni/sdl-1.3/include/SDL_mutex.h index 0e8726702..6b5014900 100644 --- a/project/jni/sdl-1.3/include/SDL_mutex.h +++ b/project/jni/sdl-1.3/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_opengl.h b/project/jni/sdl-1.3/include/SDL_opengl.h index fad97447b..10474c981 100644 --- a/project/jni/sdl-1.3/include/SDL_opengl.h +++ b/project/jni/sdl-1.3/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_opengles.h b/project/jni/sdl-1.3/include/SDL_opengles.h index a2bb64bda..32ee2378f 100644 --- a/project/jni/sdl-1.3/include/SDL_opengles.h +++ b/project/jni/sdl-1.3/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_opengles2.h b/project/jni/sdl-1.3/include/SDL_opengles2.h index f750d3315..e034959ae 100644 --- a/project/jni/sdl-1.3/include/SDL_opengles2.h +++ b/project/jni/sdl-1.3/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_pixels.h b/project/jni/sdl-1.3/include/SDL_pixels.h index 5939d2c7c..50f80fae4 100644 --- a/project/jni/sdl-1.3/include/SDL_pixels.h +++ b/project/jni/sdl-1.3/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_platform.h b/project/jni/sdl-1.3/include/SDL_platform.h index ec29b06b8..736d1bfec 100644 --- a/project/jni/sdl-1.3/include/SDL_platform.h +++ b/project/jni/sdl-1.3/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_power.h b/project/jni/sdl-1.3/include/SDL_power.h index 6cc11978a..33413c4a8 100644 --- a/project/jni/sdl-1.3/include/SDL_power.h +++ b/project/jni/sdl-1.3/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_quit.h b/project/jni/sdl-1.3/include/SDL_quit.h index d6f11a80c..22262c676 100644 --- a/project/jni/sdl-1.3/include/SDL_quit.h +++ b/project/jni/sdl-1.3/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_rect.h b/project/jni/sdl-1.3/include/SDL_rect.h index a6576ac4b..6b4dde19d 100644 --- a/project/jni/sdl-1.3/include/SDL_rect.h +++ b/project/jni/sdl-1.3/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_render.h b/project/jni/sdl-1.3/include/SDL_render.h index 09ea53c47..dbbf83624 100644 --- a/project/jni/sdl-1.3/include/SDL_render.h +++ b/project/jni/sdl-1.3/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -65,8 +65,10 @@ typedef enum SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware acceleration */ - SDL_RENDERER_PRESENTVSYNC = 0x00000004 /**< Present is synchronized + SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized with the refresh rate */ + SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports + rendering to texture */ } SDL_RendererFlags; /** @@ -88,7 +90,8 @@ typedef struct SDL_RendererInfo typedef enum { SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ - SDL_TEXTUREACCESS_STREAMING /**< Changes frequently, lockable */ + SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ + SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ } SDL_TextureAccess; /** @@ -144,6 +147,22 @@ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info); +/** + * \brief Create a window and default renderer + * + * \param width The width of the window + * \param height The height of the window + * \param window_flags The flags used to create the window + * \param window A pointer filled with the window, or NULL on error + * \param renderer A pointer filled with the renderer, or NULL on error + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( + int width, int height, Uint32 window_flags, + SDL_Window **window, SDL_Renderer **renderer); + + /** * \brief Create a 2D rendering context for a window. * @@ -369,6 +388,25 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, */ extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); +/** + * \brief Determines whether a window supports the use of render targets + * + * \param renderer The renderer that will be checked + * + * \return SDL_TRUE if supported, SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); + +/** + * \brief Set a texture as the current rendering target. + * + * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, + SDL_Texture *texture); + /** * \brief Set the drawing area for rendering on the current target. * @@ -561,6 +599,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, const SDL_Rect * srcrect, const SDL_Rect * dstrect); + /** * \brief Read pixels from the current rendering target. * diff --git a/project/jni/sdl-1.3/include/SDL_revision.h b/project/jni/sdl-1.3/include/SDL_revision.h index f5eb3cceb..ef3a874ac 100644 --- a/project/jni/sdl-1.3/include/SDL_revision.h +++ b/project/jni/sdl-1.3/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-5868:33245988e8a2" -#define SDL_REVISION_NUMBER 5868 +#define SDL_REVISION "hg-6305:601b0e251822" +#define SDL_REVISION_NUMBER 6305 diff --git a/project/jni/sdl-1.3/include/SDL_rwops.h b/project/jni/sdl-1.3/include/SDL_rwops.h index d260f9599..fb03cea49 100644 --- a/project/jni/sdl-1.3/include/SDL_rwops.h +++ b/project/jni/sdl-1.3/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_scalemode.h b/project/jni/sdl-1.3/include/SDL_scalemode.h deleted file mode 100644 index a658c68bb..000000000 --- a/project/jni/sdl-1.3/include/SDL_scalemode.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2010 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/** - * \file SDL_scalemode.h - * - * Header file declaring the SDL_ScaleMode enumeration - */ - -#ifndef _SDL_scalemode_h -#define _SDL_scalemode_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -/** - * \brief The texture scale mode used in SDL_RenderCopy(). - */ -typedef enum -{ - SDL_SCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must - match dimensions */ - - SDL_SCALEMODE_FAST = 0x00000001, /**< Point sampling or - equivalent algorithm */ - - SDL_SCALEMODE_SLOW = 0x00000002, /**< Linear filtering or - equivalent algorithm */ - - SDL_SCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or - equivalent algorithm */ -} SDL_ScaleMode; - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif -#include "close_code.h" - -#endif /* _SDL_video_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/include/SDL_scancode.h b/project/jni/sdl-1.3/include/SDL_scancode.h index a9aea662e..f4f69fa9d 100644 --- a/project/jni/sdl-1.3/include/SDL_scancode.h +++ b/project/jni/sdl-1.3/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_screenkeyboard.h b/project/jni/sdl-1.3/include/SDL_screenkeyboard.h deleted file mode 100644 index e6cb5f619..000000000 --- a/project/jni/sdl-1.3/include/SDL_screenkeyboard.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#ifndef _SDL_screenkeyboard_h -#define _SDL_screenkeyboard_h - -#include "SDL_stdinc.h" -#include "SDL_video.h" -#if SDL_VERSION_ATLEAST(1,3,0) -#include "SDL_keycode.h" -#include "SDL_compat.h" -#else -#include "SDL_keysym.h" -#endif - -/* On-screen keyboard exposed to the application, it's yet available on Android platform only */ - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Button IDs */ -enum { - - SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */ - - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */ - SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, - SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, - SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, - SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, - SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, - - SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, /* Button to show screen keyboard */ - - SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM -}; - -/* All functions return 0 on failure and 1 on success, contrary to other SDL API */ - -extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); - -extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key); -/* Returns SDLK_UNKNOWN on failure */ -extern DECLSPEC SDLKey SDLCALL SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId); - -/* Buttons 0 and 1 may have auto-fire state */ -extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(); - -extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardShown(int shown); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(); - -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(); - -/* Show Android on-screen keyboard, and pass entered text back to application as SDL keypress events, -previousText is UTF-8 encoded, it may be NULL, only 256 first bytes will be used, and this call will not block */ -extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char * previousText); - -/* Show Android on-screen keyboard, and pass entered text back to application in a buffer, -using buffer contents as previous text (UTF-8 encoded), the buffer may be of any size - -this call will block until user typed all text. */ -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBuf, int textBufSize); - -/* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */ -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(); - -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif diff --git a/project/jni/sdl-1.3/include/SDL_shape.h b/project/jni/sdl-1.3/include/SDL_shape.h index fc56afac6..1208818fd 100644 --- a/project/jni/sdl-1.3/include/SDL_shape.h +++ b/project/jni/sdl-1.3/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_stdinc.h b/project/jni/sdl-1.3/include/SDL_stdinc.h index 89cbc3c58..aaef5020b 100644 --- a/project/jni/sdl-1.3/include/SDL_stdinc.h +++ b/project/jni/sdl-1.3/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_surface.h b/project/jni/sdl-1.3/include/SDL_surface.h index f8c95b275..656335423 100644 --- a/project/jni/sdl-1.3/include/SDL_surface.h +++ b/project/jni/sdl-1.3/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,6 +51,7 @@ extern "C" { * Used internally (read-only). */ /*@{*/ +#define SDL_SWSURFACE 0 /**< Just here for compatibility */ #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ #define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ @@ -208,10 +209,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, * \brief Sets the color key (transparent pixel) in a blittable surface. * * \param surface The surface to update - * \param flag Non-zero to enable colorkey and 0 to disable colorkey + * \param flag Non-zero to enable colorkey and 0 to disable colorkey * \param key The transparent pixel in the native surface format * * \return 0 on success, or -1 if the surface is not valid + * + * You can pass SDL_RLEACCEL to enable RLE accelerated blits. */ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); diff --git a/project/jni/sdl-1.3/include/SDL_syswm.h b/project/jni/sdl-1.3/include/SDL_syswm.h index 677e398b2..9d5a45e37 100644 --- a/project/jni/sdl-1.3/include/SDL_syswm.h +++ b/project/jni/sdl-1.3/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_thread.h b/project/jni/sdl-1.3/include/SDL_thread.h index 49b8b22ff..65a2253b4 100644 --- a/project/jni/sdl-1.3/include/SDL_thread.h +++ b/project/jni/sdl-1.3/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_timer.h b/project/jni/sdl-1.3/include/SDL_timer.h index bb1abaecd..031662854 100644 --- a/project/jni/sdl-1.3/include/SDL_timer.h +++ b/project/jni/sdl-1.3/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,7 @@ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, * * \warning It is not safe to remove a timer multiple times. */ -extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); /* Ends C function definitions when using C++ */ diff --git a/project/jni/sdl-1.3/include/SDL_touch.h b/project/jni/sdl-1.3/include/SDL_touch.h index 587efcbfb..727f82af8 100644 --- a/project/jni/sdl-1.3/include/SDL_touch.h +++ b/project/jni/sdl-1.3/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_types.h b/project/jni/sdl-1.3/include/SDL_types.h index 7b1217e11..35df00b13 100644 --- a/project/jni/sdl-1.3/include/SDL_types.h +++ b/project/jni/sdl-1.3/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/SDL_version.h b/project/jni/sdl-1.3/include/SDL_version.h index 3d7ce28fd..3c34ab109 100644 --- a/project/jni/sdl-1.3/include/SDL_version.h +++ b/project/jni/sdl-1.3/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,8 +59,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ -#define SDL_MAJOR_VERSION 1 -#define SDL_MINOR_VERSION 3 +#define SDL_MAJOR_VERSION 2 +#define SDL_MINOR_VERSION 0 #define SDL_PATCHLEVEL 0 /** diff --git a/project/jni/sdl-1.3/include/SDL_video.h b/project/jni/sdl-1.3/include/SDL_video.h index fcdc7788e..878c053f0 100644 --- a/project/jni/sdl-1.3/include/SDL_video.h +++ b/project/jni/sdl-1.3/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -182,9 +182,25 @@ typedef enum SDL_GL_ACCELERATED_VISUAL, SDL_GL_RETAINED_BACKING, SDL_GL_CONTEXT_MAJOR_VERSION, - SDL_GL_CONTEXT_MINOR_VERSION + SDL_GL_CONTEXT_MINOR_VERSION, + SDL_GL_CONTEXT_FLAGS, + SDL_GL_CONTEXT_PROFILE_MASK } SDL_GLattr; +typedef enum +{ + SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, + SDL_GL_CONTEXT_PROFILE_ES2 = 0x0004 +} SDL_GLprofile; + +typedef enum +{ + SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004 +} SDL_GLcontextFlag; + /* Function prototypes */ diff --git a/project/jni/sdl-1.3/include/begin_code.h b/project/jni/sdl-1.3/include/begin_code.h index 851fd9203..b45af55ea 100644 --- a/project/jni/sdl-1.3/include/begin_code.h +++ b/project/jni/sdl-1.3/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -87,7 +87,12 @@ #ifdef __BORLANDC__ #pragma nopackwarning #endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else #pragma pack(push,4) +#endif #endif /* Compiler needs structure packing set */ /* Set up compiler-specific options for inlining functions */ diff --git a/project/jni/sdl-1.3/include/close_code.h b/project/jni/sdl-1.3/include/close_code.h index 7ecf255fd..51586d911 100644 --- a/project/jni/sdl-1.3/include/close_code.h +++ b/project/jni/sdl-1.3/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/include/doxyfile b/project/jni/sdl-1.3/include/doxyfile index 103475527..3da0d56e8 100644 --- a/project/jni/sdl-1.3/include/doxyfile +++ b/project/jni/sdl-1.3/include/doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = SDL # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.3.0 +PROJECT_NUMBER = 2.0.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -635,7 +635,7 @@ EXCLUDE = ../doxy \ ../Xcode \ ../VisualC \ ../VisualCE \ - ../Xcode-iPhoneOS + ../Xcode-iOS # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded diff --git a/project/jni/sdl-1.3/src/SDL.c b/project/jni/sdl-1.3/src/SDL.c old mode 100644 new mode 100755 index 58d6f365c..9f8b2d4fc --- a/project/jni/sdl-1.3/src/SDL.c +++ b/project/jni/sdl-1.3/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,6 +49,25 @@ static Uint32 ticks_started = 0; int SDL_InitSubSystem(Uint32 flags) { +#if !SDL_TIMERS_DISABLED + /* Initialize the timer subsystem */ + if (!ticks_started) { + SDL_StartTicks(); + ticks_started = 1; + } + if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) { + if (SDL_TimerInit() < 0) { + return (-1); + } + SDL_initialized |= SDL_INIT_TIMER; + } +#else + if (flags & SDL_INIT_TIMER) { + SDL_SetError("SDL not built with timer support"); + return (-1); + } +#endif + #if !SDL_VIDEO_DISABLED /* Initialize the video/event subsystem */ if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) { @@ -79,25 +98,6 @@ SDL_InitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED - /* Initialize the timer subsystem */ - if (!ticks_started) { - SDL_StartTicks(); - ticks_started = 1; - } - if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) { - if (SDL_TimerInit() < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_TIMER; - } -#else - if (flags & SDL_INIT_TIMER) { - SDL_SetError("SDL not built with timer support"); - return (-1); - } -#endif - #if !SDL_JOYSTICK_DISABLED /* Initialize the joystick subsystem */ if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) { @@ -175,12 +175,6 @@ SDL_QuitSubSystem(Uint32 flags) SDL_initialized &= ~SDL_INIT_HAPTIC; } #endif -#if !SDL_TIMERS_DISABLED - if ((flags & SDL_initialized & SDL_INIT_TIMER)) { - SDL_TimerQuit(); - SDL_initialized &= ~SDL_INIT_TIMER; - } -#endif #if !SDL_AUDIO_DISABLED if ((flags & SDL_initialized & SDL_INIT_AUDIO)) { SDL_AudioQuit(); @@ -193,6 +187,12 @@ SDL_QuitSubSystem(Uint32 flags) SDL_initialized &= ~SDL_INIT_VIDEO; } #endif +#if !SDL_TIMERS_DISABLED + if ((flags & SDL_initialized & SDL_INIT_TIMER)) { + SDL_TimerQuit(); + SDL_initialized &= ~SDL_INIT_TIMER; + } +#endif } Uint32 diff --git a/project/jni/sdl-1.3/src/SDL_assert.c b/project/jni/sdl-1.3/src/SDL_assert.c old mode 100644 new mode 100755 index 9d6416253..7eebfe1c6 --- a/project/jni/sdl-1.3/src/SDL_assert.c +++ b/project/jni/sdl-1.3/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" #include "SDL.h" #include "SDL_atomic.h" @@ -254,9 +255,9 @@ static void SDL_GenerateAssertionReport(void) static void SDL_ExitProcess(int exitcode) { #ifdef __WIN32__ - ExitProcess(42); + ExitProcess(exitcode); #else - _exit(42); + _exit(exitcode); #endif } diff --git a/project/jni/sdl-1.3/src/SDL_assert_c.h b/project/jni/sdl-1.3/src/SDL_assert_c.h old mode 100644 new mode 100755 index 0be500235..d9d9ac341 --- a/project/jni/sdl-1.3/src/SDL_assert_c.h +++ b/project/jni/sdl-1.3/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_compat.c b/project/jni/sdl-1.3/src/SDL_compat.c deleted file mode 100644 index 44ae1379d..000000000 --- a/project/jni/sdl-1.3/src/SDL_compat.c +++ /dev/null @@ -1,1824 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_config.h" - -/* This file contains functions for backwards compatibility with SDL 1.2 */ - -#include "SDL.h" -#include "SDL_syswm.h" - -#include "video/SDL_sysvideo.h" -#include "video/SDL_pixels_c.h" -#include "render/SDL_yuv_sw_c.h" -#include - - -static SDL_Window *SDL_VideoWindow = NULL; -static SDL_Surface *SDL_WindowSurface = NULL; -static SDL_Surface *SDL_VideoSurface = NULL; -static SDL_Surface *SDL_ShadowSurface = NULL; -static SDL_Surface *SDL_PublicSurface = NULL; -static SDL_GLContext *SDL_VideoContext = NULL; -static Uint32 SDL_VideoFlags = 0; -static SDL_Rect SDL_VideoViewport; -static char *wm_title = NULL; -static SDL_Surface *SDL_VideoIcon; -static int SDL_enabled_UNICODE = 0; - -const char * -SDL_AudioDriverName(char *namebuf, int maxlen) -{ - const char *name = SDL_GetCurrentAudioDriver(); - if (name) { - if (namebuf) { - SDL_strlcpy(namebuf, name, maxlen); - return namebuf; - } else { - return name; - } - } - return NULL; -} - -const char * -SDL_VideoDriverName(char *namebuf, int maxlen) -{ - const char *name = SDL_GetCurrentVideoDriver(); - if (name) { - if (namebuf) { - SDL_strlcpy(namebuf, name, maxlen); - return namebuf; - } else { - return name; - } - } - return NULL; -} - -static int -GetVideoDisplay() -{ - const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY"); - if ( !variable ) { - variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD"); - } - if ( variable ) { - return SDL_atoi(variable); - } else { - return 0; - } -} - -const SDL_VideoInfo * -SDL_GetVideoInfo(void) -{ - static SDL_VideoInfo info; - SDL_DisplayMode mode; - - /* Memory leak, compatibility code, who cares? */ - if (!info.vfmt && SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode) == 0) { - info.vfmt = SDL_AllocFormat(mode.format); - info.current_w = mode.w; - info.current_h = mode.h; - } - return &info; -} - -int -SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags) -{ - int i, actual_bpp = 0; - - if (!SDL_GetVideoDevice()) { - return 0; - } - - if (!(flags & SDL_FULLSCREEN)) { - SDL_DisplayMode mode; - SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode); - return SDL_BITSPERPIXEL(mode.format); - } - - for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) { - SDL_DisplayMode mode; - SDL_GetDisplayMode(GetVideoDisplay(), i, &mode); - if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) { - if (!mode.format) { - return bpp; - } - if (SDL_BITSPERPIXEL(mode.format) >= (Uint32) bpp) { - actual_bpp = SDL_BITSPERPIXEL(mode.format); - } - } - } - return actual_bpp; -} - -SDL_Rect ** -SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags) -{ - int i, nmodes; - SDL_Rect **modes; - - if (!SDL_GetVideoDevice()) { - return NULL; - } - - if (!(flags & SDL_FULLSCREEN)) { - return (SDL_Rect **) (-1); - } - - if (!format) { - format = SDL_GetVideoInfo()->vfmt; - } - - /* Memory leak, but this is a compatibility function, who cares? */ - nmodes = 0; - modes = NULL; - for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) { - SDL_DisplayMode mode; - int bpp; - - SDL_GetDisplayMode(GetVideoDisplay(), i, &mode); - if (!mode.w || !mode.h) { - return (SDL_Rect **) (-1); - } - - /* Copied from src/video/SDL_pixels.c:SDL_PixelFormatEnumToMasks */ - if (SDL_BYTESPERPIXEL(mode.format) <= 2) { - bpp = SDL_BITSPERPIXEL(mode.format); - } else { - bpp = SDL_BYTESPERPIXEL(mode.format) * 8; - } - - if (bpp != format->BitsPerPixel) { - continue; - } - if (nmodes > 0 && modes[nmodes - 1]->w == mode.w - && modes[nmodes - 1]->h == mode.h) { - continue; - } - - modes = SDL_realloc(modes, (nmodes + 2) * sizeof(*modes)); - if (!modes) { - return NULL; - } - modes[nmodes] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect)); - if (!modes[nmodes]) { - return NULL; - } - modes[nmodes]->x = 0; - modes[nmodes]->y = 0; - modes[nmodes]->w = mode.w; - modes[nmodes]->h = mode.h; - ++nmodes; - } - if (modes) { - modes[nmodes] = NULL; - } - return modes; -} - -static int -SDL_CompatEventFilter(void *userdata, SDL_Event * event) -{ - SDL_Event fake; - - switch (event->type) { - case SDL_WINDOWEVENT: - switch (event->window.event) { - case SDL_WINDOWEVENT_EXPOSED: - if (!SDL_HasEvent(SDL_VIDEOEXPOSE)) { - fake.type = SDL_VIDEOEXPOSE; - SDL_PushEvent(&fake); - } - break; - case SDL_WINDOWEVENT_RESIZED: - SDL_FlushEvent(SDL_VIDEORESIZE); - /* We don't want to expose that the window width and height will - be different if we don't get the desired fullscreen mode. - */ - if (SDL_VideoWindow && !(SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN)) { - fake.type = SDL_VIDEORESIZE; - fake.resize.w = event->window.data1; - fake.resize.h = event->window.data2; - SDL_PushEvent(&fake); - } - break; - case SDL_WINDOWEVENT_MINIMIZED: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 0; - fake.active.state = SDL_APPACTIVE; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_RESTORED: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 1; - fake.active.state = SDL_APPACTIVE; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_ENTER: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 1; - fake.active.state = SDL_APPMOUSEFOCUS; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_LEAVE: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 0; - fake.active.state = SDL_APPMOUSEFOCUS; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_FOCUS_GAINED: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 1; - fake.active.state = SDL_APPINPUTFOCUS; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_FOCUS_LOST: - fake.type = SDL_ACTIVEEVENT; - fake.active.gain = 0; - fake.active.state = SDL_APPINPUTFOCUS; - SDL_PushEvent(&fake); - break; - case SDL_WINDOWEVENT_CLOSE: - fake.type = SDL_QUIT; - SDL_PushEvent(&fake); - break; - } - case SDL_KEYDOWN: - case SDL_KEYUP: - { - Uint32 unicode = 0; - if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) { - unicode = event->key.keysym.sym; - if (unicode >= 'a' && unicode <= 'z') { - int shifted = !!(event->key.keysym.mod & KMOD_SHIFT); - int capslock = !!(event->key.keysym.mod & KMOD_CAPS); - if ((shifted ^ capslock) != 0) { - unicode = SDL_toupper(unicode); - } - } - } - if (unicode) { - event->key.keysym.unicode = unicode; - } - break; - } - case SDL_TEXTINPUT: - { - /* FIXME: Generate an old style key repeat event if needed */ - //printf("TEXTINPUT: '%s'\n", event->text.text); - break; - } - case SDL_MOUSEMOTION: - { - event->motion.x -= SDL_VideoViewport.x; - event->motion.y -= SDL_VideoViewport.y; - break; - } - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - { - event->button.x -= SDL_VideoViewport.x; - event->button.y -= SDL_VideoViewport.y; - break; - } - case SDL_MOUSEWHEEL: - { - Uint8 button; - int x, y; - - if (event->wheel.y == 0) { - break; - } - - SDL_GetMouseState(&x, &y); - - if (event->wheel.y > 0) { - button = SDL_BUTTON_WHEELUP; - } else { - button = SDL_BUTTON_WHEELDOWN; - } - - fake.button.button = button; - fake.button.x = x; - fake.button.y = y; - fake.button.windowID = event->wheel.windowID; - - fake.type = SDL_MOUSEBUTTONDOWN; - fake.button.state = SDL_PRESSED; - SDL_PushEvent(&fake); - - fake.type = SDL_MOUSEBUTTONUP; - fake.button.state = SDL_RELEASED; - SDL_PushEvent(&fake); - break; - } - - } - return 1; -} - -static void -GetEnvironmentWindowPosition(int w, int h, int *x, int *y) -{ - int display = GetVideoDisplay(); - const char *window = SDL_getenv("SDL_VIDEO_WINDOW_POS"); - const char *center = SDL_getenv("SDL_VIDEO_CENTERED"); - if (window) { - if (SDL_sscanf(window, "%d,%d", x, y) == 2) { - return; - } - if (SDL_strcmp(window, "center") == 0) { - center = window; - } - } - if (center) { - *x = SDL_WINDOWPOS_CENTERED_DISPLAY(display); - *y = SDL_WINDOWPOS_CENTERED_DISPLAY(display); - } -} - -static void -ClearVideoSurface() -{ - if (SDL_ShadowSurface) { - SDL_FillRect(SDL_ShadowSurface, NULL, - SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); - } - SDL_FillRect(SDL_WindowSurface, NULL, 0); - SDL_UpdateWindowSurface(SDL_VideoWindow); -} - -static void -SetupScreenSaver(int flags) -{ - const char *env; - SDL_bool allow_screensaver; - - /* Allow environment override of screensaver disable */ - env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER"); - if (env) { - allow_screensaver = SDL_atoi(env) ? SDL_TRUE : SDL_FALSE; - } else if (flags & SDL_FULLSCREEN) { - allow_screensaver = SDL_FALSE; - } else { - allow_screensaver = SDL_TRUE; - } - if (allow_screensaver) { - SDL_EnableScreenSaver(); - } else { - SDL_DisableScreenSaver(); - } -} - -static int -SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) -{ - int w, h; - - /* We can't resize something we don't have... */ - if (!SDL_VideoSurface) { - return -1; - } - - /* We probably have to recreate the window in fullscreen mode */ - if (flags & SDL_FULLSCREEN) { - return -1; - } - - /* I don't think there's any change we can gracefully make in flags */ - if (flags != SDL_VideoFlags) { - return -1; - } - if (bpp != SDL_VideoSurface->format->BitsPerPixel) { - return -1; - } - - /* Resize the window */ - SDL_GetWindowSize(SDL_VideoWindow, &w, &h); - if (w != width || h != height) { - SDL_SetWindowSize(SDL_VideoWindow, width, height); - } - - /* If we're in OpenGL mode, just resize the stub surface and we're done! */ - if (flags & SDL_OPENGL) { - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - return 0; - } - - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - return -1; - } - if (SDL_VideoSurface->format != SDL_WindowSurface->format) { - return -1; - } - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - SDL_VideoSurface->pixels = SDL_WindowSurface->pixels; - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_SetClipRect(SDL_VideoSurface, NULL); - - if (SDL_ShadowSurface) { - SDL_ShadowSurface->w = width; - SDL_ShadowSurface->h = height; - SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); - SDL_ShadowSurface->pixels = - SDL_realloc(SDL_ShadowSurface->pixels, - SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); - SDL_SetClipRect(SDL_ShadowSurface, NULL); - SDL_InvalidateMap(SDL_ShadowSurface->map); - } else { - SDL_PublicSurface = SDL_VideoSurface; - } - - ClearVideoSurface(); - - return 0; -} - -SDL_Surface * -SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) -{ - SDL_DisplayMode desktop_mode; - int display = GetVideoDisplay(); - int window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); - int window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); - int window_w; - int window_h; - Uint32 window_flags; - Uint32 surface_flags; - - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_SetVideoMode(%d, %d, %d, 0x%x)", width, height, bpp, flags); - if (!SDL_GetVideoDevice()) { - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Init(SDL_INIT_VIDEO) failed"); - return NULL; - } - } - - SDL_GetDesktopDisplayMode(display, &desktop_mode); - - if (width == 0) { - width = desktop_mode.w; - } - if (height == 0) { - height = desktop_mode.h; - } - if (bpp == 0) { - bpp = SDL_BITSPERPIXEL(desktop_mode.format); - } - - /* See if we can simply resize the existing window and surface */ - if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_ResizeVideoMode(): SDL_PublicSurface %p", SDL_PublicSurface); - return SDL_PublicSurface; - } - - /* Destroy existing window */ - SDL_PublicSurface = NULL; - if (SDL_ShadowSurface) { - SDL_ShadowSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_ShadowSurface); - SDL_ShadowSurface = NULL; - } - if (SDL_VideoSurface) { - SDL_VideoSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_VideoSurface); - SDL_VideoSurface = NULL; - } - if (SDL_VideoContext) { - /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */ - SDL_GL_DeleteContext(SDL_VideoContext); - SDL_VideoContext = NULL; - } - if (SDL_VideoWindow) { - SDL_GetWindowPosition(SDL_VideoWindow, &window_x, &window_y); - SDL_DestroyWindow(SDL_VideoWindow); - } - - /* Set up the event filter */ - if (!SDL_GetEventFilter(NULL, NULL)) { - SDL_SetEventFilter(SDL_CompatEventFilter, NULL); - } - - /* Create a new window */ - window_flags = SDL_WINDOW_SHOWN; - if (flags & SDL_FULLSCREEN) { - window_flags |= SDL_WINDOW_FULLSCREEN; - } - if (flags & SDL_OPENGL) { - window_flags |= SDL_WINDOW_OPENGL; - } - if (flags & SDL_RESIZABLE) { - window_flags |= SDL_WINDOW_RESIZABLE; - } - if (flags & SDL_NOFRAME) { - window_flags |= SDL_WINDOW_BORDERLESS; - } - GetEnvironmentWindowPosition(width, height, &window_x, &window_y); - SDL_VideoWindow = - SDL_CreateWindow(wm_title, window_x, window_y, width, height, - window_flags); - if (!SDL_VideoWindow) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindow() failed"); - return NULL; - } - SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon); - - SetupScreenSaver(flags); - - window_flags = SDL_GetWindowFlags(SDL_VideoWindow); - surface_flags = 0; - if (window_flags & SDL_WINDOW_FULLSCREEN) { - surface_flags |= SDL_FULLSCREEN; - } - if ((window_flags & SDL_WINDOW_OPENGL) && (flags & SDL_OPENGL)) { - surface_flags |= SDL_OPENGL; - } - if (window_flags & SDL_WINDOW_RESIZABLE) { - surface_flags |= SDL_RESIZABLE; - } - if (window_flags & SDL_WINDOW_BORDERLESS) { - surface_flags |= SDL_NOFRAME; - } - - SDL_VideoFlags = flags; - - /* If we're in OpenGL mode, just create a stub surface and we're done! */ - if (flags & SDL_OPENGL) { - SDL_VideoContext = SDL_GL_CreateContext(SDL_VideoWindow); - if (!SDL_VideoContext) { - return NULL; - } - if (SDL_GL_MakeCurrent(SDL_VideoWindow, SDL_VideoContext) < 0) { - return NULL; - } - SDL_VideoSurface = - SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, 0, 0, 0, 0, 0); - if (!SDL_VideoSurface) { - return NULL; - } - SDL_VideoSurface->flags |= surface_flags; - SDL_PublicSurface = SDL_VideoSurface; - return SDL_PublicSurface; - } - - /* Create the screen surface */ - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_GetWindowSurface() failed"); - return NULL; - } - - /* Center the public surface in the window surface */ - SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); - SDL_VideoViewport.x = (window_w - width)/2; - SDL_VideoViewport.y = (window_h - height)/2; - SDL_VideoViewport.w = width; - SDL_VideoViewport.h = height; - - SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, bpp, 0, 0, 0, 0, 0); - SDL_VideoSurface->flags |= surface_flags; - SDL_VideoSurface->flags |= SDL_DONTFREE; - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_VideoSurface->w = width; - SDL_VideoSurface->h = height; - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + - SDL_VideoViewport.y * SDL_VideoSurface->pitch + - SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); - SDL_SetClipRect(SDL_VideoSurface, NULL); - - /* Create a shadow surface if necessary */ - if ((bpp != SDL_VideoSurface->format->BitsPerPixel) - && !(flags & SDL_ANYFORMAT)) { - SDL_ShadowSurface = - SDL_CreateRGBSurface(0, width, height, bpp, 0, 0, 0, 0); - if (!SDL_ShadowSurface) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_ShadowSurface is NULL"); - return NULL; - } - SDL_ShadowSurface->flags |= surface_flags; - SDL_ShadowSurface->flags |= SDL_DONTFREE; - - /* 8-bit SDL_ShadowSurface surfaces report that they have exclusive palette */ - if (SDL_ShadowSurface->format->palette) { - SDL_ShadowSurface->flags |= SDL_HWPALETTE; - SDL_DitherColors(SDL_ShadowSurface->format->palette->colors, - SDL_ShadowSurface->format->BitsPerPixel); - } - SDL_FillRect(SDL_ShadowSurface, NULL, - SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); - } - SDL_PublicSurface = - (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); - - ClearVideoSurface(); - - /* We're finally done! */ - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_SetVideoMode(%d, %d, %d, 0x%x) done - SDL_PublicSurface %p", width, height, bpp, flags, SDL_PublicSurface); - return SDL_PublicSurface; -} - -SDL_Surface * -SDL_GetVideoSurface(void) -{ - return SDL_PublicSurface; -} - -int -SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value) -{ - if (flag & SDL_SRCALPHA) { - /* According to the docs, value is ignored for alpha surfaces */ - if (surface->format->Amask) { - value = 0xFF; - } - SDL_SetSurfaceAlphaMod(surface, value); - SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); - } else { - SDL_SetSurfaceAlphaMod(surface, 0xFF); - SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE); - } - SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL)); - - return 0; -} - -SDL_Surface * -SDL_DisplayFormat(SDL_Surface * surface) -{ - SDL_PixelFormat *format; - - if (!SDL_PublicSurface) { - SDL_SetError("No video mode has been set"); - return NULL; - } - format = SDL_PublicSurface->format; - - /* Set the flags appropriate for copying to display surface */ - return SDL_ConvertSurface(surface, format, SDL_RLEACCEL); -} - -SDL_Surface * -SDL_DisplayFormatAlpha(SDL_Surface * surface) -{ - SDL_PixelFormat *vf; - SDL_PixelFormat *format; - SDL_Surface *converted; - /* default to ARGB8888 */ - Uint32 amask = 0xff000000; - Uint32 rmask = 0x00ff0000; - Uint32 gmask = 0x0000ff00; - Uint32 bmask = 0x000000ff; - - if (!SDL_PublicSurface) { - SDL_SetError("No video mode has been set"); - return NULL; - } - vf = SDL_PublicSurface->format; - - switch (vf->BytesPerPixel) { - case 2: - /* For XGY5[56]5, use, AXGY8888, where {X, Y} = {R, B}. - For anything else (like ARGB4444) it doesn't matter - since we have no special code for it anyway */ - if ((vf->Rmask == 0x1f) && - (vf->Bmask == 0xf800 || vf->Bmask == 0x7c00)) { - rmask = 0xff; - bmask = 0xff0000; - } - break; - - case 3: - case 4: - /* Keep the video format, as long as the high 8 bits are - unused or alpha */ - if ((vf->Rmask == 0xff) && (vf->Bmask == 0xff0000)) { - rmask = 0xff; - bmask = 0xff0000; - } - break; - - default: - /* We have no other optimised formats right now. When/if a new - optimised alpha format is written, add the converter here */ - break; - } - format = SDL_AllocFormat(SDL_MasksToPixelFormatEnum(32, rmask, - gmask, - bmask, - amask)); - if (!format) { - return NULL; - } - converted = SDL_ConvertSurface(surface, format, SDL_RLEACCEL); - SDL_FreeFormat(format); - return converted; -} - -int -SDL_Flip(SDL_Surface * screen) -{ - SDL_UpdateRect(screen, 0, 0, 0, 0); - return 0; -} - -void -SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) -{ - if (screen) { - SDL_Rect rect; - - /* Fill the rectangle */ - rect.x = (int) x; - rect.y = (int) y; - rect.w = (int) (w ? w : screen->w); - rect.h = (int) (h ? h : screen->h); - SDL_UpdateRects(screen, 1, &rect); - } -} - -void -SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) -{ - int i; - - if (screen == SDL_ShadowSurface) { - for (i = 0; i < numrects; ++i) { - SDL_BlitSurface(SDL_ShadowSurface, &rects[i], SDL_VideoSurface, - &rects[i]); - } - - /* Fall through to video surface update */ - screen = SDL_VideoSurface; - } - if (screen == SDL_VideoSurface) { - if (SDL_VideoViewport.x || SDL_VideoViewport.y) { - SDL_Rect *stackrects = SDL_stack_alloc(SDL_Rect, numrects); - SDL_Rect *stackrect; - const SDL_Rect *rect; - - /* Offset all the rectangles before updating */ - for (i = 0; i < numrects; ++i) { - rect = &rects[i]; - stackrect = &stackrects[i]; - stackrect->x = SDL_VideoViewport.x + rect->x; - stackrect->y = SDL_VideoViewport.y + rect->y; - stackrect->w = rect->w; - stackrect->h = rect->h; - } - SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, stackrects, numrects); - SDL_stack_free(stackrects); - } else { - SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, rects, numrects); - } - } -} - -void -SDL_WM_SetCaption(const char *title, const char *icon) -{ - if (wm_title) { - SDL_free(wm_title); - } - if (title) { - wm_title = SDL_strdup(title); - } else { - wm_title = NULL; - } - SDL_SetWindowTitle(SDL_VideoWindow, wm_title); -} - -void -SDL_WM_GetCaption(const char **title, const char **icon) -{ - if (title) { - *title = wm_title; - } - if (icon) { - *icon = ""; - } -} - -void -SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask) -{ - SDL_VideoIcon = icon; - ++SDL_VideoIcon->refcount; -} - -int -SDL_WM_IconifyWindow(void) -{ - SDL_MinimizeWindow(SDL_VideoWindow); - return 0; -} - -int -SDL_WM_ToggleFullScreen(SDL_Surface * surface) -{ - int length; - void *pixels; - Uint8 *src, *dst; - int row; - int window_w; - int window_h; - - if (!SDL_PublicSurface) { - SDL_SetError("SDL_SetVideoMode() hasn't been called"); - return 0; - } - - /* Copy the old bits out */ - length = SDL_PublicSurface->w * SDL_PublicSurface->format->BytesPerPixel; - pixels = SDL_malloc(SDL_PublicSurface->h * length); - if (pixels && SDL_PublicSurface->pixels) { - src = (Uint8*)SDL_PublicSurface->pixels; - dst = (Uint8*)pixels; - for (row = 0; row < SDL_PublicSurface->h; ++row) { - SDL_memcpy(dst, src, length); - src += SDL_PublicSurface->pitch; - dst += length; - } - } - - /* Do the physical mode switch */ - if (SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN) { - if (SDL_SetWindowFullscreen(SDL_VideoWindow, 0) < 0) { - return 0; - } - SDL_PublicSurface->flags &= ~SDL_FULLSCREEN; - } else { - if (SDL_SetWindowFullscreen(SDL_VideoWindow, 1) < 0) { - return 0; - } - SDL_PublicSurface->flags |= SDL_FULLSCREEN; - } - - /* Recreate the screen surface */ - SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); - if (!SDL_WindowSurface) { - /* We're totally hosed... */ - return 0; - } - - /* Center the public surface in the window surface */ - SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); - SDL_VideoViewport.x = (window_w - SDL_VideoSurface->w)/2; - SDL_VideoViewport.y = (window_h - SDL_VideoSurface->h)/2; - SDL_VideoViewport.w = SDL_VideoSurface->w; - SDL_VideoViewport.h = SDL_VideoSurface->h; - - /* Do some shuffling behind the application's back if format changes */ - if (SDL_VideoSurface->format->format != SDL_WindowSurface->format->format) { - if (SDL_ShadowSurface) { - if (SDL_ShadowSurface->format->format == SDL_WindowSurface->format->format) { - /* Whee! We don't need a shadow surface anymore! */ - SDL_VideoSurface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(SDL_VideoSurface); - SDL_free(SDL_ShadowSurface->pixels); - SDL_VideoSurface = SDL_ShadowSurface; - SDL_VideoSurface->flags |= SDL_PREALLOC; - SDL_ShadowSurface = NULL; - } else { - /* No problem, just change the video surface format */ - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_InvalidateMap(SDL_ShadowSurface->map); - } - } else { - /* We can make the video surface the shadow surface */ - SDL_ShadowSurface = SDL_VideoSurface; - SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); - SDL_ShadowSurface->pixels = SDL_malloc(SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); - if (!SDL_ShadowSurface->pixels) { - /* Uh oh, we're hosed */ - SDL_ShadowSurface = NULL; - return 0; - } - SDL_ShadowSurface->flags &= ~SDL_PREALLOC; - - SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0); - SDL_VideoSurface->flags = SDL_ShadowSurface->flags; - SDL_VideoSurface->flags |= SDL_PREALLOC; - SDL_FreeFormat(SDL_VideoSurface->format); - SDL_VideoSurface->format = SDL_WindowSurface->format; - SDL_VideoSurface->format->refcount++; - SDL_VideoSurface->w = SDL_ShadowSurface->w; - SDL_VideoSurface->h = SDL_ShadowSurface->h; - } - } - - /* Update the video surface */ - SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; - SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + - SDL_VideoViewport.y * SDL_VideoSurface->pitch + - SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); - SDL_SetClipRect(SDL_VideoSurface, NULL); - - /* Copy the old bits back */ - if (pixels) { - src = (Uint8*)pixels; - dst = (Uint8*)SDL_PublicSurface->pixels; - for (row = 0; row < SDL_PublicSurface->h; ++row) { - SDL_memcpy(dst, src, length); - src += length; - dst += SDL_PublicSurface->pitch; - } - SDL_Flip(SDL_PublicSurface); - SDL_free(pixels); - } - - /* We're done! */ - return 1; -} - -SDL_GrabMode -SDL_WM_GrabInput(SDL_GrabMode mode) -{ - if (mode != SDL_GRAB_QUERY) { - SDL_SetWindowGrab(SDL_VideoWindow, mode); - } - return (SDL_GrabMode) SDL_GetWindowGrab(SDL_VideoWindow); -} - -void -SDL_WarpMouse(Uint16 x, Uint16 y) -{ - SDL_WarpMouseInWindow(SDL_VideoWindow, x, y); -} - -Uint8 -SDL_GetAppState(void) -{ - Uint8 state = 0; - Uint32 flags = 0; - - flags = SDL_GetWindowFlags(SDL_VideoWindow); - if ((flags & SDL_WINDOW_SHOWN) && !(flags & SDL_WINDOW_MINIMIZED)) { - state |= SDL_APPACTIVE; - } - if (flags & SDL_WINDOW_INPUT_FOCUS) { - state |= SDL_APPINPUTFOCUS; - } - if (flags & SDL_WINDOW_MOUSE_FOCUS) { - state |= SDL_APPMOUSEFOCUS; - } - return state; -} - -const SDL_version * -SDL_Linked_Version(void) -{ - static SDL_version version; - SDL_VERSION(&version); - return &version; -} - -int -SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors, - int firstcolor, int ncolors) -{ - return SDL_SetColors(surface, colors, firstcolor, ncolors); -} - -int -SDL_SetColors(SDL_Surface * surface, const SDL_Color * colors, int firstcolor, - int ncolors) -{ - if (SDL_SetPaletteColors - (surface->format->palette, colors, firstcolor, ncolors) == 0) { - return 1; - } else { - return 0; - } -} - -int -SDL_GetWMInfo(SDL_SysWMinfo * info) -{ - return SDL_GetWindowWMInfo(SDL_VideoWindow, info); -} - -#if 0 -void -SDL_MoveCursor(int x, int y) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - - /* Erase and update the current mouse position */ - if (SHOULD_DRAWCURSOR(SDL_cursorstate)) { - /* Erase and redraw mouse cursor in new position */ - SDL_LockCursor(); - SDL_EraseCursor(SDL_VideoSurface); - SDL_cursor->area.x = (x - SDL_cursor->hot_x); - SDL_cursor->area.y = (y - SDL_cursor->hot_y); - SDL_DrawCursor(SDL_VideoSurface); - SDL_UnlockCursor(); - } else if (_this->MoveWMCursor) { - _this->MoveWMCursor(_this, x, y); - } -} - -/* Keep track of the current cursor colors */ -static int palette_changed = 1; -static Uint8 pixels8[2]; - -void -SDL_CursorPaletteChanged(void) -{ - palette_changed = 1; -} - -void -SDL_MouseRect(SDL_Rect * area) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - int clip_diff; - - *area = SDL_cursor->area; - if (area->x < 0) { - area->w += area->x; - area->x = 0; - } - if (area->y < 0) { - area->h += area->y; - area->y = 0; - } - clip_diff = (area->x + area->w) - SDL_VideoSurface->w; - if (clip_diff > 0) { - area->w = area->w < clip_diff ? 0 : area->w - clip_diff; - } - clip_diff = (area->y + area->h) - SDL_VideoSurface->h; - if (clip_diff > 0) { - area->h = area->h < clip_diff ? 0 : area->h - clip_diff; - } -} - -static void -SDL_DrawCursorFast(SDL_Surface * screen, SDL_Rect * area) -{ - const Uint32 pixels[2] = { 0xFFFFFFFF, 0x00000000 }; - int i, w, h; - Uint8 *data, datab; - Uint8 *mask, maskb; - - data = SDL_cursor->data + area->y * SDL_cursor->area.w / 8; - mask = SDL_cursor->mask + area->y * SDL_cursor->area.w / 8; - switch (screen->format->BytesPerPixel) { - - case 1: - { - Uint8 *dst; - int dstskip; - - if (palette_changed) { - pixels8[0] = - (Uint8) SDL_MapRGB(screen->format, 255, 255, 255); - pixels8[1] = (Uint8) SDL_MapRGB(screen->format, 0, 0, 0); - palette_changed = 0; - } - dst = (Uint8 *) screen->pixels + - (SDL_cursor->area.y + area->y) * screen->pitch + - SDL_cursor->area.x; - dstskip = screen->pitch - area->w; - - for (h = area->h; h; h--) { - for (w = area->w / 8; w; w--) { - maskb = *mask++; - datab = *data++; - for (i = 0; i < 8; ++i) { - if (maskb & 0x80) { - *dst = pixels8[datab >> 7]; - } - maskb <<= 1; - datab <<= 1; - dst++; - } - } - dst += dstskip; - } - } - break; - - case 2: - { - Uint16 *dst; - int dstskip; - - dst = (Uint16 *) screen->pixels + - (SDL_cursor->area.y + area->y) * screen->pitch / 2 + - SDL_cursor->area.x; - dstskip = (screen->pitch / 2) - area->w; - - for (h = area->h; h; h--) { - for (w = area->w / 8; w; w--) { - maskb = *mask++; - datab = *data++; - for (i = 0; i < 8; ++i) { - if (maskb & 0x80) { - *dst = (Uint16) pixels[datab >> 7]; - } - maskb <<= 1; - datab <<= 1; - dst++; - } - } - dst += dstskip; - } - } - break; - - case 3: - { - Uint8 *dst; - int dstskip; - - dst = (Uint8 *) screen->pixels + - (SDL_cursor->area.y + area->y) * screen->pitch + - SDL_cursor->area.x * 3; - dstskip = screen->pitch - area->w * 3; - - for (h = area->h; h; h--) { - for (w = area->w / 8; w; w--) { - maskb = *mask++; - datab = *data++; - for (i = 0; i < 8; ++i) { - if (maskb & 0x80) { - SDL_memset(dst, pixels[datab >> 7], 3); - } - maskb <<= 1; - datab <<= 1; - dst += 3; - } - } - dst += dstskip; - } - } - break; - - case 4: - { - Uint32 *dst; - int dstskip; - - dst = (Uint32 *) screen->pixels + - (SDL_cursor->area.y + area->y) * screen->pitch / 4 + - SDL_cursor->area.x; - dstskip = (screen->pitch / 4) - area->w; - - for (h = area->h; h; h--) { - for (w = area->w / 8; w; w--) { - maskb = *mask++; - datab = *data++; - for (i = 0; i < 8; ++i) { - if (maskb & 0x80) { - *dst = pixels[datab >> 7]; - } - maskb <<= 1; - datab <<= 1; - dst++; - } - } - dst += dstskip; - } - } - break; - } -} - -static void -SDL_DrawCursorSlow(SDL_Surface * screen, SDL_Rect * area) -{ - const Uint32 pixels[2] = { 0xFFFFFF, 0x000000 }; - int h; - int x, minx, maxx; - Uint8 *data, datab = 0; - Uint8 *mask, maskb = 0; - Uint8 *dst; - int dstbpp, dstskip; - - data = SDL_cursor->data + area->y * SDL_cursor->area.w / 8; - mask = SDL_cursor->mask + area->y * SDL_cursor->area.w / 8; - dstbpp = screen->format->BytesPerPixel; - dst = (Uint8 *) screen->pixels + - (SDL_cursor->area.y + area->y) * screen->pitch + - SDL_cursor->area.x * dstbpp; - dstskip = screen->pitch - SDL_cursor->area.w * dstbpp; - - minx = area->x; - maxx = area->x + area->w; - if (screen->format->BytesPerPixel == 1) { - if (palette_changed) { - pixels8[0] = (Uint8) SDL_MapRGB(screen->format, 255, 255, 255); - pixels8[1] = (Uint8) SDL_MapRGB(screen->format, 0, 0, 0); - palette_changed = 0; - } - for (h = area->h; h; h--) { - for (x = 0; x < SDL_cursor->area.w; ++x) { - if ((x % 8) == 0) { - maskb = *mask++; - datab = *data++; - } - if ((x >= minx) && (x < maxx)) { - if (maskb & 0x80) { - SDL_memset(dst, pixels8[datab >> 7], dstbpp); - } - } - maskb <<= 1; - datab <<= 1; - dst += dstbpp; - } - dst += dstskip; - } - } else { - for (h = area->h; h; h--) { - for (x = 0; x < SDL_cursor->area.w; ++x) { - if ((x % 8) == 0) { - maskb = *mask++; - datab = *data++; - } - if ((x >= minx) && (x < maxx)) { - if (maskb & 0x80) { - SDL_memset(dst, pixels[datab >> 7], dstbpp); - } - } - maskb <<= 1; - datab <<= 1; - dst += dstbpp; - } - dst += dstskip; - } - } -} - -/* This handles the ugly work of converting the saved cursor background from - the pixel format of the shadow surface to that of the video surface. - This is only necessary when blitting from a shadow surface of a different - pixel format than the video surface, and using a software rendered cursor. -*/ -static void -SDL_ConvertCursorSave(SDL_Surface * screen, int w, int h) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_BlitInfo info; - SDL_loblit RunBlit; - - /* Make sure we can steal the blit mapping */ - if (screen->map->dst != SDL_VideoSurface) { - return; - } - - /* Set up the blit information */ - info.s_pixels = SDL_cursor->save[1]; - info.s_width = w; - info.s_height = h; - info.s_skip = 0; - info.d_pixels = SDL_cursor->save[0]; - info.d_width = w; - info.d_height = h; - info.d_skip = 0; - info.aux_data = screen->map->sw_data->aux_data; - info.src = screen->format; - info.table = screen->map->table; - info.dst = SDL_VideoSurface->format; - RunBlit = screen->map->sw_data->blit; - - /* Run the actual software blit */ - RunBlit(&info); -} - -void -SDL_DrawCursorNoLock(SDL_Surface * screen) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Rect area; - - /* Get the mouse rectangle, clipped to the screen */ - SDL_MouseRect(&area); - if ((area.w == 0) || (area.h == 0)) { - return; - } - - /* Copy mouse background */ - { - int w, h, screenbpp; - Uint8 *src, *dst; - - /* Set up the copy pointers */ - screenbpp = screen->format->BytesPerPixel; - if ((screen == SDL_VideoSurface) || - FORMAT_EQUAL(screen->format, SDL_VideoSurface->format)) { - dst = SDL_cursor->save[0]; - } else { - dst = SDL_cursor->save[1]; - } - src = (Uint8 *) screen->pixels + area.y * screen->pitch + - area.x * screenbpp; - - /* Perform the copy */ - w = area.w * screenbpp; - h = area.h; - while (h--) { - SDL_memcpy(dst, src, w); - dst += w; - src += screen->pitch; - } - } - - /* Draw the mouse cursor */ - area.x -= SDL_cursor->area.x; - area.y -= SDL_cursor->area.y; - if ((area.x == 0) && (area.w == SDL_cursor->area.w)) { - SDL_DrawCursorFast(screen, &area); - } else { - SDL_DrawCursorSlow(screen, &area); - } -} - -void -SDL_DrawCursor(SDL_Surface * screen) -{ - /* Lock the screen if necessary */ - if (screen == NULL) { - return; - } - if (SDL_MUSTLOCK(screen)) { - if (SDL_LockSurface(screen) < 0) { - return; - } - } - - SDL_DrawCursorNoLock(screen); - - /* Unlock the screen and update if necessary */ - if (SDL_MUSTLOCK(screen)) { - SDL_UnlockSurface(screen); - } - if (screen->flags & SDL_SCREEN_SURFACE) { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Window *window; - SDL_Rect area; - - window = SDL_GetWindowFromSurface(screen); - if (!window) { - return; - } - - SDL_MouseRect(&area); - - if (_this->UpdateWindowSurface) { - _this->UpdateWindowSurface(_this, window, 1, &area); - } - } -} - -void -SDL_EraseCursorNoLock(SDL_Surface * screen) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Window *window; - SDL_Rect area; - - /* Get the window associated with the surface */ - window = SDL_GetWindowFromSurface(screen); - if (!window || !window->surface) { - return; - } - - /* Get the mouse rectangle, clipped to the screen */ - SDL_MouseRect(&area); - if ((area.w == 0) || (area.h == 0)) { - return; - } - - /* Copy mouse background */ - { - int w, h, screenbpp; - Uint8 *src, *dst; - - /* Set up the copy pointers */ - screenbpp = screen->format->BytesPerPixel; - if ((screen->flags & SDL_SCREEN_SURFACE) || - FORMAT_EQUAL(screen->format, window->surface->format)) { - src = SDL_cursor->save[0]; - } else { - src = SDL_cursor->save[1]; - } - dst = (Uint8 *) screen->pixels + area.y * screen->pitch + - area.x * screenbpp; - - /* Perform the copy */ - w = area.w * screenbpp; - h = area.h; - while (h--) { - SDL_memcpy(dst, src, w); - src += w; - dst += screen->pitch; - } - - /* Perform pixel conversion on cursor background */ - if (src > SDL_cursor->save[1]) { - SDL_ConvertCursorSave(screen, area.w, area.h); - } - } -} - -void -SDL_EraseCursor(SDL_Surface * screen) -{ - /* Lock the screen if necessary */ - if (screen == NULL) { - return; - } - if (SDL_MUSTLOCK(screen)) { - if (SDL_LockSurface(screen) < 0) { - return; - } - } - - SDL_EraseCursorNoLock(screen); - - /* Unlock the screen and update if necessary */ - if (SDL_MUSTLOCK(screen)) { - SDL_UnlockSurface(screen); - } - if (screen->flags & SDL_SCREEN_SURFACE) { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Window *window; - SDL_Rect area; - - window = SDL_GetWindowFromSurface(screen); - if (!window) { - return; - } - - SDL_MouseRect(&area); - - if (_this->UpdateWindowSurface) { - _this->UpdateWindowSurface(_this, window, 1, &area); - } - } -} - -/* Reset the cursor on video mode change - FIXME: Keep track of all cursors, and reset them all. - */ -void -SDL_ResetCursor(void) -{ - int savelen; - - if (SDL_cursor) { - savelen = SDL_cursor->area.w * 4 * SDL_cursor->area.h; - SDL_cursor->area.x = 0; - SDL_cursor->area.y = 0; - SDL_memset(SDL_cursor->save[0], 0, savelen); - } -} -#endif - -struct private_yuvhwdata -{ - SDL_SW_YUVTexture *texture; - SDL_Surface *display; - Uint32 display_format; -}; - -SDL_Overlay * -SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) -{ - SDL_Overlay *overlay; - Uint32 texture_format; - SDL_SW_YUVTexture *texture; - - if ((display->flags & SDL_OPENGL) == SDL_OPENGL) { - SDL_SetError("YUV overlays are not supported in OpenGL mode"); - return NULL; - } - - if (display != SDL_PublicSurface) { - SDL_SetError("YUV display is only supported on the screen surface"); - return NULL; - } - - switch (format) { - case SDL_YV12_OVERLAY: - texture_format = SDL_PIXELFORMAT_YV12; - break; - case SDL_IYUV_OVERLAY: - texture_format = SDL_PIXELFORMAT_IYUV; - break; - case SDL_YUY2_OVERLAY: - texture_format = SDL_PIXELFORMAT_YUY2; - break; - case SDL_UYVY_OVERLAY: - texture_format = SDL_PIXELFORMAT_UYVY; - break; - case SDL_YVYU_OVERLAY: - texture_format = SDL_PIXELFORMAT_YVYU; - break; - default: - SDL_SetError("Unknown YUV format"); - return NULL; - } - - overlay = (SDL_Overlay *) SDL_malloc(sizeof(*overlay)); - if (!overlay) { - SDL_OutOfMemory(); - return NULL; - } - SDL_zerop(overlay); - - overlay->hwdata = - (struct private_yuvhwdata *) SDL_malloc(sizeof(*overlay->hwdata)); - if (!overlay->hwdata) { - SDL_free(overlay); - SDL_OutOfMemory(); - return NULL; - } - - texture = SDL_SW_CreateYUVTexture(texture_format, w, h); - if (!texture) { - SDL_free(overlay->hwdata); - SDL_free(overlay); - return NULL; - } - overlay->hwdata->texture = texture; - overlay->hwdata->display = NULL; - overlay->hwdata->display_format = SDL_PIXELFORMAT_UNKNOWN; - - overlay->format = format; - overlay->w = w; - overlay->h = h; - if (format == SDL_YV12_OVERLAY || format == SDL_IYUV_OVERLAY) { - overlay->planes = 3; - } else { - overlay->planes = 1; - } - overlay->pitches = texture->pitches; - overlay->pixels = texture->planes; - - return overlay; -} - -int -SDL_LockYUVOverlay(SDL_Overlay * overlay) -{ - SDL_Rect rect; - void *pixels; - int pitch; - - if (!overlay) { - SDL_SetError("Passed a NULL overlay"); - return -1; - } - - rect.x = 0; - rect.y = 0; - rect.w = overlay->w; - rect.h = overlay->h; - - if (SDL_SW_LockYUVTexture(overlay->hwdata->texture, &rect, &pixels, &pitch) < 0) { - return -1; - } - - overlay->pixels[0] = (Uint8 *) pixels; - overlay->pitches[0] = pitch; - switch (overlay->format) { - case SDL_YV12_OVERLAY: - case SDL_IYUV_OVERLAY: - overlay->pitches[1] = pitch / 2; - overlay->pitches[2] = pitch / 2; - overlay->pixels[1] = - overlay->pixels[0] + overlay->pitches[0] * overlay->h; - overlay->pixels[2] = - overlay->pixels[1] + overlay->pitches[1] * overlay->h / 2; - break; - case SDL_YUY2_OVERLAY: - case SDL_UYVY_OVERLAY: - case SDL_YVYU_OVERLAY: - break; - } - return 0; -} - -void -SDL_UnlockYUVOverlay(SDL_Overlay * overlay) -{ - if (!overlay) { - return; - } - - SDL_SW_UnlockYUVTexture(overlay->hwdata->texture); -} - -int -SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect) -{ - SDL_Surface *display; - SDL_Rect src_rect; - SDL_Rect dst_rect; - void *pixels; - - if (!overlay || !dstrect) { - SDL_SetError("Passed a NULL overlay or dstrect"); - return -1; - } - - display = overlay->hwdata->display; - if (display != SDL_VideoSurface) { - overlay->hwdata->display = display = SDL_VideoSurface; - overlay->hwdata->display_format = SDL_MasksToPixelFormatEnum( - display->format->BitsPerPixel, - display->format->Rmask, - display->format->Gmask, - display->format->Bmask, - display->format->Amask); - } - - src_rect.x = 0; - src_rect.y = 0; - src_rect.w = overlay->w; - src_rect.h = overlay->h; - - if (!SDL_IntersectRect(&display->clip_rect, dstrect, &dst_rect)) { - return 0; - } - - pixels = (void *)((Uint8 *)display->pixels + - dst_rect.y * display->pitch + - dst_rect.x * display->format->BytesPerPixel); - - if (SDL_SW_CopyYUVToRGB(overlay->hwdata->texture, &src_rect, - overlay->hwdata->display_format, - dst_rect.w, dst_rect.h, - pixels, display->pitch) < 0) { - return -1; - } - SDL_UpdateWindowSurface(SDL_VideoWindow); - return 0; -} - -void -SDL_FreeYUVOverlay(SDL_Overlay * overlay) -{ - if (!overlay) { - return; - } - if (overlay->hwdata) { - if (overlay->hwdata->texture) { - SDL_SW_DestroyYUVTexture(overlay->hwdata->texture); - } - SDL_free(overlay->hwdata); - } - SDL_free(overlay); -} - -void -SDL_GL_SwapBuffers(void) -{ - SDL_GL_SwapWindow(SDL_VideoWindow); -} - -int -SDL_SetGamma(float red, float green, float blue) -{ - Uint16 red_ramp[256]; - Uint16 green_ramp[256]; - Uint16 blue_ramp[256]; - - SDL_CalculateGammaRamp(red, red_ramp); - if (green == red) { - SDL_memcpy(green_ramp, red_ramp, sizeof(red_ramp)); - } else { - SDL_CalculateGammaRamp(green, green_ramp); - } - if (blue == red) { - SDL_memcpy(blue_ramp, red_ramp, sizeof(red_ramp)); - } else { - SDL_CalculateGammaRamp(blue, blue_ramp); - } - return SDL_SetWindowGammaRamp(SDL_VideoWindow, red_ramp, green_ramp, blue_ramp); -} - -int -SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue) -{ - return SDL_SetWindowGammaRamp(SDL_VideoWindow, red, green, blue); -} - -int -SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue) -{ - return SDL_GetWindowGammaRamp(SDL_VideoWindow, red, green, blue); -} - -int -SDL_EnableKeyRepeat(int delay, int interval) -{ - return 0; -} - -void -SDL_GetKeyRepeat(int *delay, int *interval) -{ - if (delay) { - *delay = SDL_DEFAULT_REPEAT_DELAY; - } - if (interval) { - *interval = SDL_DEFAULT_REPEAT_INTERVAL; - } -} - -int -SDL_EnableUNICODE(int enable) -{ - int previous = SDL_enabled_UNICODE; - - switch (enable) { - case 1: - SDL_enabled_UNICODE = 1; - SDL_StartTextInput(); - break; - case 0: - SDL_enabled_UNICODE = 0; - SDL_StopTextInput(); - break; - } - return previous; -} - -static Uint32 -SDL_SetTimerCallback(Uint32 interval, void* param) -{ - return ((SDL_OldTimerCallback)param)(interval); -} - -int -SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback) -{ - static SDL_TimerID compat_timer; - - if (compat_timer) { - SDL_RemoveTimer(compat_timer); - compat_timer = 0; - } - - if (interval && callback) { - compat_timer = SDL_AddTimer(interval, SDL_SetTimerCallback, callback); - if (!compat_timer) { - return -1; - } - } - return 0; -} - -int -SDL_putenv(const char *_var) -{ - char *ptr = NULL; - char *var = SDL_strdup(_var); - if (var == NULL) { - return -1; /* we don't set errno. */ - } - - ptr = SDL_strchr(var, '='); - if (ptr == NULL) { - SDL_free(var); - return -1; - } - - *ptr = '\0'; /* split the string into name and value. */ - SDL_setenv(var, ptr + 1, 1); - SDL_free(var); - return 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/src/SDL_error.c b/project/jni/sdl-1.3/src/SDL_error.c old mode 100644 new mode 100755 index 19a6507d1..306dfe2ba --- a/project/jni/sdl-1.3/src/SDL_error.c +++ b/project/jni/sdl-1.3/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_error_c.h b/project/jni/sdl-1.3/src/SDL_error_c.h old mode 100644 new mode 100755 index f346faa04..c887faf0a --- a/project/jni/sdl-1.3/src/SDL_error_c.h +++ b/project/jni/sdl-1.3/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_fatal.c b/project/jni/sdl-1.3/src/SDL_fatal.c old mode 100644 new mode 100755 index 73a43f33d..f68787e68 --- a/project/jni/sdl-1.3/src/SDL_fatal.c +++ b/project/jni/sdl-1.3/src/SDL_fatal.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_fatal.h b/project/jni/sdl-1.3/src/SDL_fatal.h old mode 100644 new mode 100755 index 7d1876167..356256fcf --- a/project/jni/sdl-1.3/src/SDL_fatal.h +++ b/project/jni/sdl-1.3/src/SDL_fatal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_hints.c b/project/jni/sdl-1.3/src/SDL_hints.c old mode 100644 new mode 100755 index 8868c4e63..b472f5322 --- a/project/jni/sdl-1.3/src/SDL_hints.c +++ b/project/jni/sdl-1.3/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_hints_c.h b/project/jni/sdl-1.3/src/SDL_hints_c.h old mode 100644 new mode 100755 index 923bd3ee7..715ca67d6 --- a/project/jni/sdl-1.3/src/SDL_hints_c.h +++ b/project/jni/sdl-1.3/src/SDL_hints_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/SDL_log.c b/project/jni/sdl-1.3/src/SDL_log.c old mode 100644 new mode 100755 index b58b86386..d38be9f93 --- a/project/jni/sdl-1.3/src/SDL_log.c +++ b/project/jni/sdl-1.3/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ #include #endif -#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_ERROR +#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL #define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO typedef struct SDL_LogLevel diff --git a/project/jni/sdl-1.3/src/SDL_renderer_gles.c.diff b/project/jni/sdl-1.3/src/SDL_renderer_gles.c.diff deleted file mode 100644 index b9cdcd51d..000000000 --- a/project/jni/sdl-1.3/src/SDL_renderer_gles.c.diff +++ /dev/null @@ -1,207 +0,0 @@ -These are changes of my Android SDL port over the official SDL port, at the last point where I've synced them -TODO: merge this - ---- SDL_renderer_gles.c 2011-12-05 14:18:19.517975982 +0200 -+++ /home/pelya/src/endless_space/SDL-android/video/SDL_renderer_gles.c 2011-12-05 13:57:25.000000000 +0200 -@@ -20,15 +20,29 @@ - slouken@libsdl.org - */ - #include "SDL_config.h" -+#include "SDL_version.h" - - #if SDL_VIDEO_RENDER_OGL_ES - -+#if SDL_VERSION_ATLEAST(1,3,0) - #include "SDL_video.h" - #include "SDL_opengles.h" - #include "SDL_sysvideo.h" -+#else -+#include "SDL_video-1.3.h" -+#include "SDL_sysvideo-1.3.h" -+#endif -+#include "SDL_opengles.h" - #include "SDL_pixels_c.h" - #include "SDL_rect_c.h" -+#if SDL_VERSION_ATLEAST(1,3,0) - #include "SDL_yuv_sw_c.h" -+#endif -+#ifdef ANDROID -+#include -+#else -+#define __android_log_print(...) -+#endif - - #if defined(__QNXNTO__) - /* Include QNX system header to check QNX version later */ -@@ -112,15 +126,14 @@ - SDL_TEXTUREMODULATE_ALPHA), - (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | - SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), -- (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 6, -+ (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 5, - { - /* OpenGL ES 1.x supported formats list */ - SDL_PIXELFORMAT_RGBA4444, - SDL_PIXELFORMAT_RGBA5551, - SDL_PIXELFORMAT_RGB565, - SDL_PIXELFORMAT_RGB24, -- SDL_PIXELFORMAT_BGR888, -- SDL_PIXELFORMAT_ABGR8888}, -+ SDL_PIXELFORMAT_RGBA8888}, - 0, - 0} - }; -@@ -213,11 +226,13 @@ - GLint value; - int doublebuffer; - -+#if SDL_VERSION_ATLEAST(1,3,0) - if (!(window->flags & SDL_WINDOW_OPENGL)) { - if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) { - return NULL; - } - } -+#endif - - renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); - if (!renderer) { -@@ -295,11 +310,15 @@ - renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; - } - -+#if SDL_VERSION_ATLEAST(1,3,0) -+ // Always double-buffered -+#else - if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) { - if (!doublebuffer) { - renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; - } - } -+#endif - #if SDL_VIDEO_DRIVER_PANDORA - data->GL_OES_draw_texture_supported = SDL_FALSE; - data->useDrawTexture = SDL_FALSE; -@@ -311,6 +330,10 @@ - data->GL_OES_draw_texture_supported = SDL_FALSE; - data->useDrawTexture = SDL_FALSE; - } -+#ifdef ANDROID -+ data->GL_OES_draw_texture_supported = SDL_TRUE; -+ data->useDrawTexture = SDL_TRUE; -+#endif - #endif - - data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); -@@ -337,14 +360,27 @@ - if (SDL_GL_MakeCurrent(window, data->context) < 0) { - return -1; - } -+ -+ /* Set up parameters for rendering */ -+ data->blendMode = -1; -+ data->glDisable(GL_DEPTH_TEST); -+ data->glDisable(GL_CULL_FACE); -+ data->updateSize = SDL_TRUE; -+ - if (data->updateSize) { - data->glMatrixMode(GL_PROJECTION); - data->glLoadIdentity(); - data->glMatrixMode(GL_MODELVIEW); - data->glLoadIdentity(); -+#if SDL_VIDEO_RENDER_RESIZE -+ data->glViewport(0, 0, window->display->desktop_mode.w, window->display->desktop_mode.h); -+ data->glOrthof(0.0, (GLfloat) window->display->desktop_mode.w, (GLfloat) window->display->desktop_mode.h, -+ 0.0, 0.0, 1.0); -+#else - data->glViewport(0, 0, window->w, window->h); -- data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0, -- 0.0, 1.0); -+ data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, -+ 0.0, 0.0, 1.0); -+#endif - data->updateSize = SDL_FALSE; - } - return 0; -@@ -388,6 +424,7 @@ - break; - case SDL_PIXELFORMAT_BGR888: - case SDL_PIXELFORMAT_ABGR8888: -+ case SDL_PIXELFORMAT_RGBA8888: - internalFormat = GL_RGBA; - format = GL_RGBA; - type = GL_UNSIGNED_BYTE; -@@ -419,7 +456,8 @@ - return -1; - } - -- if (texture->access == SDL_TEXTUREACCESS_STREAMING) { -+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) -+ { - data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); - data->pixels = SDL_malloc(texture->h * data->pitch); - if (!data->pixels) { -@@ -441,6 +479,11 @@ - texture_h = power_of_2(texture->h); - data->texw = (GLfloat) texture->w / texture_w; - data->texh = (GLfloat) texture->h / texture_h; -+ if( renderer->info.max_texture_width < texture_w || renderer->info.max_texture_height < texture_h ) -+ __android_log_print(ANDROID_LOG_WARN, "libSDL", "GLES: Allocated texture of size %dx%d which is bigger than largest possible device texture %dx%d", -+ texture_w, texture_h, renderer->info.max_texture_width, renderer->info.max_texture_height ); -+ else if( texture_w > 1024 || texture_h > 1024 ) -+ __android_log_print(ANDROID_LOG_WARN, "libSDL", "GLES: Allocated texture of size %dx%d which is bigger than 1024x1024 - this code will not work on HTC G1", texture_w, texture_h ); - - data->format = format; - data->formattype = type; -@@ -557,13 +600,36 @@ - GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; - GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; - GLenum result; -+ int bpp = SDL_BYTESPERPIXEL(texture->format); -+ void * temp_buffer; -+ void * temp_ptr; -+ int i; - - renderdata->glGetError(); - renderdata->glEnable(data->type); - SetupTextureUpdate(renderdata, texture, pitch); -+ -+ if( rect->w * bpp == pitch ) { -+ temp_buffer = (void *)pixels; /* No need to reformat */ -+ } else { -+ /* Reformatting of mem area required */ -+ temp_buffer = SDL_malloc(rect->w * rect->h * bpp); -+ temp_ptr = temp_buffer; -+ for (i = 0; i < rect->h; i++) { -+ SDL_memcpy(temp_ptr, pixels, rect->w * bpp); -+ temp_ptr += rect->w * bpp; -+ pixels += pitch; -+ } -+ } -+ - renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w, - rect->h, data->format, data->formattype, -- pixels); -+ temp_buffer); -+ -+ if( temp_buffer != pixels ) { -+ SDL_free(temp_buffer); -+ } -+ - renderdata->glDisable(data->type); - result = renderdata->glGetError(); - if (result != GL_NO_ERROR) { -@@ -887,7 +953,13 @@ - cropRect[3] = -srcrect->h; - data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, - cropRect); -- data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h, -+ //__android_log_print(ANDROID_LOG_INFO, "libSDL", "GLES_RenderCopy glDrawTexiOES(%d, %d, %d, %d) cropRect %d:%d:%d:%d", dstrect->x, window->display->desktop_mode.h - dstrect->y - dstrect->h, dstrect->w, dstrect->h, cropRect[0], cropRect[1], cropRect[2], cropRect[3]); -+ data->glDrawTexiOES(dstrect->x, -+#if SDL_VIDEO_RENDER_RESIZE -+ window->display->desktop_mode.h - dstrect->y - dstrect->h, -+#else -+ window->h - dstrect->y - dstrect->h, -+#endif - 0, dstrect->w, dstrect->h); - } else { - diff --git a/project/jni/sdl-1.3/src/SDL_video.c.diff b/project/jni/sdl-1.3/src/SDL_video.c.diff deleted file mode 100644 index 13775d7ca..000000000 --- a/project/jni/sdl-1.3/src/SDL_video.c.diff +++ /dev/null @@ -1,288 +0,0 @@ -These are changes of my Android SDL port over the official SDL port, at the last point where I've synced them -TODO: merge this - ---- SDL_video.c 2011-12-05 14:18:19.537975981 +0200 -+++ /home/pelya/src/endless_space/SDL-android/project/jni/sdl-1.3/src/video/SDL_video.c 2011-12-05 14:20:10.817974963 +0200 -@@ -33,6 +33,9 @@ - #include "SDL_renderer_sw.h" - #include "../events/SDL_sysevents.h" - #include "../events/SDL_events_c.h" -+#ifdef ANDROID -+#include -+#endif - - #if SDL_VIDEO_DRIVER_WIN32 - #include "win32/SDL_win32video.h" -@@ -98,15 +101,15 @@ - #if SDL_VIDEO_DRIVER_UIKIT - &UIKIT_bootstrap, - #endif -+#if SDL_VIDEO_DRIVER_ANDROID -+ &ANDROID_bootstrap, -+#endif - #if SDL_VIDEO_DRIVER_DUMMY - &DUMMY_bootstrap, - #endif - #if SDL_VIDEO_DRIVER_PANDORA - &PND_bootstrap, - #endif --#if SDL_VIDEO_DRIVER_ANDROID -- &Android_bootstrap, --#endif - NULL - }; - -@@ -2396,6 +2399,36 @@ - return renderer->RenderClear(renderer); - } - -+#if SDL_VIDEO_RENDER_RESIZE -+ -+static inline void -+SDL_RESIZE_resizePoints(int realW, int fakeW, int realH, int fakeH, -+ const SDL_Point * src, SDL_Point * dest, int count ) -+{ -+ int i; -+ for( i = 0; i < count; i++ ) { -+ dest[i].x = src[i].x * realW / fakeW; -+ dest[i].y = src[i].y * realH / fakeH; -+ } -+} -+ -+static inline void -+SDL_RESIZE_resizeRects(int realW, int fakeW, int realH, int fakeH, -+ const SDL_Rect ** src, SDL_Rect * dest, int count ) -+{ -+ int i; -+ for( i = 0; i < count; i++ ) { -+ // Calculate bottom-right corner instead of width/height, and substract upper-left corner, -+ // otherwise we'll have rounding errors and holes between textures -+ dest[i].x = src[i]->x * realW / fakeW; -+ dest[i].y = src[i]->y * realH / fakeH; -+ dest[i].w = (src[i]->w + src[i]->x) * realW / fakeW - dest[i].x; -+ dest[i].h = (src[i]->h + src[i]->y) * realH / fakeH - dest[i].y; -+ } -+} -+ -+#endif -+ - int - SDL_RenderDrawPoint(int x, int y) - { -@@ -2403,6 +2436,7 @@ - - point.x = x; - point.y = y; -+ - return SDL_RenderDrawPoints(&point, 1); - } - -@@ -2410,6 +2444,9 @@ - SDL_RenderDrawPoints(const SDL_Point * points, int count) - { - SDL_Renderer *renderer; -+#if SDL_VIDEO_RENDER_RESIZE -+ int realW, realH, fakeW, fakeH, ret; -+#endif - - if (!points) { - SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points"); -@@ -2427,6 +2464,26 @@ - if (count < 1) { - return 0; - } -+ -+#if SDL_VIDEO_RENDER_RESIZE -+ realW = renderer->window->display->desktop_mode.w; -+ realH = renderer->window->display->desktop_mode.h; -+ fakeW = renderer->window->w; -+ fakeH = renderer->window->h; -+ //if( fakeW > realW || fakeH > realH ) -+ { -+ SDL_Point * resized = SDL_stack_alloc( SDL_Point, count ); -+ if( ! resized ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ SDL_RESIZE_resizePoints( realW, fakeW, realH, fakeH, points, resized, count ); -+ ret = renderer->RenderDrawPoints(renderer, resized, count); -+ SDL_stack_free(resized); -+ return ret; -+ } -+#endif -+ - return renderer->RenderDrawPoints(renderer, points, count); - } - -@@ -2446,6 +2503,9 @@ - SDL_RenderDrawLines(const SDL_Point * points, int count) - { - SDL_Renderer *renderer; -+#if SDL_VIDEO_RENDER_RESIZE -+ int realW, realH, fakeW, fakeH, ret; -+#endif - - if (!points) { - SDL_SetError("SDL_RenderDrawLines(): Passed NULL points"); -@@ -2463,6 +2523,26 @@ - if (count < 2) { - return 0; - } -+ -+#if SDL_VIDEO_RENDER_RESIZE -+ realW = renderer->window->display->desktop_mode.w; -+ realH = renderer->window->display->desktop_mode.h; -+ fakeW = renderer->window->w; -+ fakeH = renderer->window->h; -+ //if( fakeW > realW || fakeH > realH ) -+ { -+ SDL_Point * resized = SDL_stack_alloc( SDL_Point, count ); -+ if( ! resized ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ SDL_RESIZE_resizePoints( realW, fakeW, realH, fakeH, points, resized, count ); -+ ret = renderer->RenderDrawLines(renderer, resized, count); -+ SDL_stack_free(resized); -+ return ret; -+ } -+#endif -+ - return renderer->RenderDrawLines(renderer, points, count); - } - -@@ -2477,6 +2557,9 @@ - { - SDL_Renderer *renderer; - int i; -+#if SDL_VIDEO_RENDER_RESIZE -+ int realW, realH, fakeW, fakeH, ret; -+#endif - - if (!rects) { - SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); -@@ -2509,6 +2592,37 @@ - return renderer->RenderDrawRects(renderer, &rect, 1); - } - } -+ -+#if SDL_VIDEO_RENDER_RESIZE -+ realW = renderer->window->display->desktop_mode.w; -+ realH = renderer->window->display->desktop_mode.h; -+ fakeW = renderer->window->w; -+ fakeH = renderer->window->h; -+ //if( fakeW > realW || fakeH > realH ) -+ { -+ SDL_Rect * resized = SDL_stack_alloc( SDL_Rect, count ); -+ if( ! resized ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ -+ const SDL_Rect ** resizedPtrs = SDL_stack_alloc( const SDL_Rect *, count ); -+ if( ! resizedPtrs ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ -+ for( i = 0; i < count; i++ ) { -+ resizedPtrs[i] = &(resized[i]); -+ } -+ SDL_RESIZE_resizeRects( realW, fakeW, realH, fakeH, rects, resized, count ); -+ ret = renderer->RenderDrawRects(renderer, resizedPtrs, count); -+ SDL_stack_free(resizedPtrs); -+ SDL_stack_free(resized); -+ return ret; -+ } -+#endif -+ - return renderer->RenderDrawRects(renderer, rects, count); - } - -@@ -2523,6 +2637,9 @@ - { - SDL_Renderer *renderer; - int i; -+#if SDL_VIDEO_RENDER_RESIZE -+ int realW, realH, fakeW, fakeH, ret; -+#endif - - if (!rects) { - SDL_SetError("SDL_RenderFillRects(): Passed NULL rects"); -@@ -2555,6 +2672,37 @@ - return renderer->RenderFillRects(renderer, &rect, 1); - } - } -+ -+#if SDL_VIDEO_RENDER_RESIZE -+ realW = renderer->window->display->desktop_mode.w; -+ realH = renderer->window->display->desktop_mode.h; -+ fakeW = renderer->window->w; -+ fakeH = renderer->window->h; -+ //if( fakeW > realW || fakeH > realH ) -+ { -+ SDL_Rect * resized = SDL_stack_alloc( SDL_Rect, count ); -+ if( ! resized ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ -+ const SDL_Rect ** resizedPtrs = SDL_stack_alloc( const SDL_Rect *, count ); -+ if( ! resizedPtrs ) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ -+ for( i = 0; i < count; i++ ) { -+ resizedPtrs[i] = &(resized[i]); -+ } -+ SDL_RESIZE_resizeRects( realW, fakeW, realH, fakeH, rects, resized, count ); -+ ret = renderer->RenderFillRects(renderer, resizedPtrs, count); -+ SDL_stack_free(resizedPtrs); -+ SDL_stack_free(resized); -+ return ret; -+ } -+#endif -+ - return renderer->RenderFillRects(renderer, rects, count); - } - -@@ -2566,6 +2714,12 @@ - SDL_Window *window; - SDL_Rect real_srcrect; - SDL_Rect real_dstrect; -+#if SDL_VIDEO_RENDER_RESIZE -+ int realW; -+ int realH; -+ int fakeW; -+ int fakeH; -+#endif - - CHECK_TEXTURE_MAGIC(texture, -1); - -@@ -2616,6 +2770,25 @@ - } - } - -+#if SDL_VIDEO_RENDER_RESIZE -+ realW = window->display->desktop_mode.w; -+ realH = window->display->desktop_mode.h; -+ fakeW = window->w; -+ fakeH = window->h; -+ //if( fakeW > realW || fakeH > realH ) -+ { -+ // Calculate bottom-right corner instead of width/height, and substract upper-left corner, -+ // otherwise we'll have rounding errors and holes between textures -+ real_dstrect.w = (real_dstrect.w + real_dstrect.x) * realW / fakeW; -+ real_dstrect.h = (real_dstrect.h + real_dstrect.y) * realH / fakeH; -+ real_dstrect.x = real_dstrect.x * realW / fakeW; -+ real_dstrect.y = real_dstrect.y * realH / fakeH; -+ real_dstrect.w -= real_dstrect.x; -+ real_dstrect.h -= real_dstrect.y; -+ //__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_RenderCopy dest %d:%d+%d+%d desktop_mode %d:%d", (int)real_dstrect.x, (int)real_dstrect.y, (int)real_dstrect.w, (int)real_dstrect.h, (int)realW, (int)realH); -+ } -+#endif -+ - return renderer->RenderCopy(renderer, texture, &real_srcrect, - &real_dstrect); - } diff --git a/project/jni/sdl-1.3/src/atomic/SDL_atomic.c b/project/jni/sdl-1.3/src/atomic/SDL_atomic.c old mode 100644 new mode 100755 index ed9bca47d..d8be4c89d --- a/project/jni/sdl-1.3/src/atomic/SDL_atomic.c +++ b/project/jni/sdl-1.3/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_stdinc.h" +#include "SDL_config.h" #include "SDL_atomic.h" diff --git a/project/jni/sdl-1.3/src/atomic/SDL_spinlock.c b/project/jni/sdl-1.3/src/atomic/SDL_spinlock.c old mode 100644 new mode 100755 index 805afcdaa..ab3c5cb31 --- a/project/jni/sdl-1.3/src/atomic/SDL_spinlock.c +++ b/project/jni/sdl-1.3/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_stdinc.h" +#include "SDL_config.h" #include "SDL_atomic.h" #include "SDL_mutex.h" diff --git a/project/jni/sdl-1.3/src/audio/SDL_audio.c b/project/jni/sdl-1.3/src/audio/SDL_audio.c old mode 100644 new mode 100755 index a50f3937b..6c95e816e --- a/project/jni/sdl-1.3/src/audio/SDL_audio.c +++ b/project/jni/sdl-1.3/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_audio_c.h b/project/jni/sdl-1.3/src/audio/SDL_audio_c.h old mode 100644 new mode 100755 index 90a97c42e..5ce806a7a --- a/project/jni/sdl-1.3/src/audio/SDL_audio_c.h +++ b/project/jni/sdl-1.3/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_audiocvt.c b/project/jni/sdl-1.3/src/audio/SDL_audiocvt.c old mode 100644 new mode 100755 index fffab7617..b069543e0 --- a/project/jni/sdl-1.3/src/audio/SDL_audiocvt.c +++ b/project/jni/sdl-1.3/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,12 +25,9 @@ #include "SDL_audio.h" #include "SDL_audio_c.h" -/* #define DEBUG_CONVERT */ +#include "SDL_assert.h" -/* !!! FIXME */ -#ifndef assert -#define assert(x) -#endif +/* #define DEBUG_CONVERT */ /* Effectively mix right and left channels into a single channel */ static void SDLCALL @@ -295,8 +292,9 @@ SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { \ const type *src = (const type *) (cvt->buf + cvt->len_cvt); \ type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \ - for (i = cvt->len_cvt / 2; i; --i, --src) { \ + for (i = cvt->len_cvt / sizeof(type); i; --i) { \ const type val = *src; \ + src -= 1; \ dst -= 2; \ dst[0] = dst[1] = val; \ } \ @@ -880,9 +878,9 @@ SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate) int lo, hi; int div; - assert(src_rate != 0); - assert(dst_rate != 0); - assert(src_rate != dst_rate); + SDL_assert(src_rate != 0); + SDL_assert(dst_rate != 0); + SDL_assert(src_rate != dst_rate); if (src_rate < dst_rate) { lo = src_rate; diff --git a/project/jni/sdl-1.3/src/audio/SDL_audiodev.c b/project/jni/sdl-1.3/src/audio/SDL_audiodev.c old mode 100644 new mode 100755 index 2d8e3936a..2d0a62932 --- a/project/jni/sdl-1.3/src/audio/SDL_audiodev.c +++ b/project/jni/sdl-1.3/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_audiodev_c.h b/project/jni/sdl-1.3/src/audio/SDL_audiodev_c.h old mode 100644 new mode 100755 index 919b3a855..9a4c59060 --- a/project/jni/sdl-1.3/src/audio/SDL_audiodev_c.h +++ b/project/jni/sdl-1.3/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_audiomem.h b/project/jni/sdl-1.3/src/audio/SDL_audiomem.h old mode 100644 new mode 100755 index a678d2e3d..93ffdab8b --- a/project/jni/sdl-1.3/src/audio/SDL_audiomem.h +++ b/project/jni/sdl-1.3/src/audio/SDL_audiomem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_audiotypecvt.c b/project/jni/sdl-1.3/src/audio/SDL_audiotypecvt.c old mode 100644 new mode 100755 index 1bf4143c2..c4ad21691 --- a/project/jni/sdl-1.3/src/audio/SDL_audiotypecvt.c +++ b/project/jni/sdl-1.3/src/audio/SDL_audiotypecvt.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -2304,10 +2304,10 @@ SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 1; + const Uint8 *target = ((const Uint8 *) cvt->buf); Uint8 sample0 = src[0]; Uint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = sample0; dst--; eps += srcsize; @@ -2368,12 +2368,12 @@ SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 2; + const Uint8 *target = ((const Uint8 *) cvt->buf); Uint8 sample1 = src[1]; Uint8 sample0 = src[0]; Uint8 last_sample1 = sample1; Uint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = sample1; dst[0] = sample0; dst -= 2; @@ -2442,7 +2442,7 @@ SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 4; + const Uint8 *target = ((const Uint8 *) cvt->buf); Uint8 sample3 = src[3]; Uint8 sample2 = src[2]; Uint8 sample1 = src[1]; @@ -2451,7 +2451,7 @@ SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint8 last_sample2 = sample2; Uint8 last_sample1 = sample1; Uint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = sample3; dst[2] = sample2; dst[1] = sample1; @@ -2536,7 +2536,7 @@ SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 6; + const Uint8 *target = ((const Uint8 *) cvt->buf); Uint8 sample5 = src[5]; Uint8 sample4 = src[4]; Uint8 sample3 = src[3]; @@ -2549,7 +2549,7 @@ SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint8 last_sample2 = sample2; Uint8 last_sample1 = sample1; Uint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = sample5; dst[4] = sample4; dst[3] = sample3; @@ -2650,7 +2650,7 @@ SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 8; + const Uint8 *target = ((const Uint8 *) cvt->buf); Uint8 sample7 = src[7]; Uint8 sample6 = src[6]; Uint8 sample5 = src[5]; @@ -2667,7 +2667,7 @@ SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint8 last_sample2 = sample2; Uint8 last_sample1 = sample1; Uint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = sample7; dst[6] = sample6; dst[5] = sample5; @@ -2784,10 +2784,10 @@ SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 1; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint8 sample0 = ((Sint8) src[0]); Sint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = ((Sint8) sample0); dst--; eps += srcsize; @@ -2848,12 +2848,12 @@ SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 2; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint8 sample1 = ((Sint8) src[1]); Sint8 sample0 = ((Sint8) src[0]); Sint8 last_sample1 = sample1; Sint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = ((Sint8) sample1); dst[0] = ((Sint8) sample0); dst -= 2; @@ -2922,7 +2922,7 @@ SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 4; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint8 sample3 = ((Sint8) src[3]); Sint8 sample2 = ((Sint8) src[2]); Sint8 sample1 = ((Sint8) src[1]); @@ -2931,7 +2931,7 @@ SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint8 last_sample2 = sample2; Sint8 last_sample1 = sample1; Sint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = ((Sint8) sample3); dst[2] = ((Sint8) sample2); dst[1] = ((Sint8) sample1); @@ -3016,7 +3016,7 @@ SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 6; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint8 sample5 = ((Sint8) src[5]); Sint8 sample4 = ((Sint8) src[4]); Sint8 sample3 = ((Sint8) src[3]); @@ -3029,7 +3029,7 @@ SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint8 last_sample2 = sample2; Sint8 last_sample1 = sample1; Sint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = ((Sint8) sample5); dst[4] = ((Sint8) sample4); dst[3] = ((Sint8) sample3); @@ -3130,7 +3130,7 @@ SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 8; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint8 sample7 = ((Sint8) src[7]); Sint8 sample6 = ((Sint8) src[6]); Sint8 sample5 = ((Sint8) src[5]); @@ -3147,7 +3147,7 @@ SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint8 last_sample2 = sample2; Sint8 last_sample1 = sample1; Sint8 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = ((Sint8) sample7); dst[6] = ((Sint8) sample6); dst[5] = ((Sint8) sample5); @@ -3264,10 +3264,10 @@ SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample0 = SDL_SwapLE16(src[0]); Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = SDL_SwapLE16(sample0); dst--; eps += srcsize; @@ -3328,12 +3328,12 @@ SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample1 = SDL_SwapLE16(src[1]); Uint16 sample0 = SDL_SwapLE16(src[0]); Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = SDL_SwapLE16(sample1); dst[0] = SDL_SwapLE16(sample0); dst -= 2; @@ -3402,7 +3402,7 @@ SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample3 = SDL_SwapLE16(src[3]); Uint16 sample2 = SDL_SwapLE16(src[2]); Uint16 sample1 = SDL_SwapLE16(src[1]); @@ -3411,7 +3411,7 @@ SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = SDL_SwapLE16(sample3); dst[2] = SDL_SwapLE16(sample2); dst[1] = SDL_SwapLE16(sample1); @@ -3496,7 +3496,7 @@ SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample5 = SDL_SwapLE16(src[5]); Uint16 sample4 = SDL_SwapLE16(src[4]); Uint16 sample3 = SDL_SwapLE16(src[3]); @@ -3509,7 +3509,7 @@ SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = SDL_SwapLE16(sample5); dst[4] = SDL_SwapLE16(sample4); dst[3] = SDL_SwapLE16(sample3); @@ -3610,7 +3610,7 @@ SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample7 = SDL_SwapLE16(src[7]); Uint16 sample6 = SDL_SwapLE16(src[6]); Uint16 sample5 = SDL_SwapLE16(src[5]); @@ -3627,7 +3627,7 @@ SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = SDL_SwapLE16(sample7); dst[6] = SDL_SwapLE16(sample6); dst[5] = SDL_SwapLE16(sample5); @@ -3744,10 +3744,10 @@ SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = ((Sint16) SDL_SwapLE16(sample0)); dst--; eps += srcsize; @@ -3808,12 +3808,12 @@ SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = ((Sint16) SDL_SwapLE16(sample1)); dst[0] = ((Sint16) SDL_SwapLE16(sample0)); dst -= 2; @@ -3882,7 +3882,7 @@ SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); @@ -3891,7 +3891,7 @@ SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = ((Sint16) SDL_SwapLE16(sample3)); dst[2] = ((Sint16) SDL_SwapLE16(sample2)); dst[1] = ((Sint16) SDL_SwapLE16(sample1)); @@ -3976,7 +3976,7 @@ SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); @@ -3989,7 +3989,7 @@ SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = ((Sint16) SDL_SwapLE16(sample5)); dst[4] = ((Sint16) SDL_SwapLE16(sample4)); dst[3] = ((Sint16) SDL_SwapLE16(sample3)); @@ -4090,7 +4090,7 @@ SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); @@ -4107,7 +4107,7 @@ SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = ((Sint16) SDL_SwapLE16(sample7)); dst[6] = ((Sint16) SDL_SwapLE16(sample6)); dst[5] = ((Sint16) SDL_SwapLE16(sample5)); @@ -4224,10 +4224,10 @@ SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample0 = SDL_SwapBE16(src[0]); Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = SDL_SwapBE16(sample0); dst--; eps += srcsize; @@ -4288,12 +4288,12 @@ SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample1 = SDL_SwapBE16(src[1]); Uint16 sample0 = SDL_SwapBE16(src[0]); Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = SDL_SwapBE16(sample1); dst[0] = SDL_SwapBE16(sample0); dst -= 2; @@ -4362,7 +4362,7 @@ SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample3 = SDL_SwapBE16(src[3]); Uint16 sample2 = SDL_SwapBE16(src[2]); Uint16 sample1 = SDL_SwapBE16(src[1]); @@ -4371,7 +4371,7 @@ SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = SDL_SwapBE16(sample3); dst[2] = SDL_SwapBE16(sample2); dst[1] = SDL_SwapBE16(sample1); @@ -4456,7 +4456,7 @@ SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample5 = SDL_SwapBE16(src[5]); Uint16 sample4 = SDL_SwapBE16(src[4]); Uint16 sample3 = SDL_SwapBE16(src[3]); @@ -4469,7 +4469,7 @@ SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = SDL_SwapBE16(sample5); dst[4] = SDL_SwapBE16(sample4); dst[3] = SDL_SwapBE16(sample3); @@ -4570,7 +4570,7 @@ SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Uint16 sample7 = SDL_SwapBE16(src[7]); Uint16 sample6 = SDL_SwapBE16(src[6]); Uint16 sample5 = SDL_SwapBE16(src[5]); @@ -4587,7 +4587,7 @@ SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Uint16 last_sample2 = sample2; Uint16 last_sample1 = sample1; Uint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = SDL_SwapBE16(sample7); dst[6] = SDL_SwapBE16(sample6); dst[5] = SDL_SwapBE16(sample5); @@ -4704,10 +4704,10 @@ SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = ((Sint16) SDL_SwapBE16(sample0)); dst--; eps += srcsize; @@ -4768,12 +4768,12 @@ SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = ((Sint16) SDL_SwapBE16(sample1)); dst[0] = ((Sint16) SDL_SwapBE16(sample0)); dst -= 2; @@ -4842,7 +4842,7 @@ SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); @@ -4851,7 +4851,7 @@ SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = ((Sint16) SDL_SwapBE16(sample3)); dst[2] = ((Sint16) SDL_SwapBE16(sample2)); dst[1] = ((Sint16) SDL_SwapBE16(sample1)); @@ -4936,7 +4936,7 @@ SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); @@ -4949,7 +4949,7 @@ SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = ((Sint16) SDL_SwapBE16(sample5)); dst[4] = ((Sint16) SDL_SwapBE16(sample4)); dst[3] = ((Sint16) SDL_SwapBE16(sample3)); @@ -5050,7 +5050,7 @@ SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); @@ -5067,7 +5067,7 @@ SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = sample2; Sint16 last_sample1 = sample1; Sint16 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = ((Sint16) SDL_SwapBE16(sample7)); dst[6] = ((Sint16) SDL_SwapBE16(sample6)); dst[5] = ((Sint16) SDL_SwapBE16(sample5)); @@ -5184,10 +5184,10 @@ SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = ((Sint32) SDL_SwapLE32(sample0)); dst--; eps += srcsize; @@ -5248,12 +5248,12 @@ SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = ((Sint32) SDL_SwapLE32(sample1)); dst[0] = ((Sint32) SDL_SwapLE32(sample0)); dst -= 2; @@ -5322,7 +5322,7 @@ SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); @@ -5331,7 +5331,7 @@ SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = ((Sint32) SDL_SwapLE32(sample3)); dst[2] = ((Sint32) SDL_SwapLE32(sample2)); dst[1] = ((Sint32) SDL_SwapLE32(sample1)); @@ -5416,7 +5416,7 @@ SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); @@ -5429,7 +5429,7 @@ SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = ((Sint32) SDL_SwapLE32(sample5)); dst[4] = ((Sint32) SDL_SwapLE32(sample4)); dst[3] = ((Sint32) SDL_SwapLE32(sample3)); @@ -5530,7 +5530,7 @@ SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); @@ -5547,7 +5547,7 @@ SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = ((Sint32) SDL_SwapLE32(sample7)); dst[6] = ((Sint32) SDL_SwapLE32(sample6)); dst[5] = ((Sint32) SDL_SwapLE32(sample5)); @@ -5664,10 +5664,10 @@ SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = ((Sint32) SDL_SwapBE32(sample0)); dst--; eps += srcsize; @@ -5728,12 +5728,12 @@ SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = ((Sint32) SDL_SwapBE32(sample1)); dst[0] = ((Sint32) SDL_SwapBE32(sample0)); dst -= 2; @@ -5802,7 +5802,7 @@ SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); @@ -5811,7 +5811,7 @@ SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = ((Sint32) SDL_SwapBE32(sample3)); dst[2] = ((Sint32) SDL_SwapBE32(sample2)); dst[1] = ((Sint32) SDL_SwapBE32(sample1)); @@ -5896,7 +5896,7 @@ SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); @@ -5909,7 +5909,7 @@ SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = ((Sint32) SDL_SwapBE32(sample5)); dst[4] = ((Sint32) SDL_SwapBE32(sample4)); dst[3] = ((Sint32) SDL_SwapBE32(sample3)); @@ -6010,7 +6010,7 @@ SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); @@ -6027,7 +6027,7 @@ SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = sample2; Sint32 last_sample1 = sample1; Sint32 last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = ((Sint32) SDL_SwapBE32(sample7)); dst[6] = ((Sint32) SDL_SwapBE32(sample6)); dst[5] = ((Sint32) SDL_SwapBE32(sample5)); @@ -6144,10 +6144,10 @@ SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 1; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); float sample0 = SDL_SwapFloatLE(src[0]); float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = SDL_SwapFloatLE(sample0); dst--; eps += srcsize; @@ -6208,12 +6208,12 @@ SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); float sample1 = SDL_SwapFloatLE(src[1]); float sample0 = SDL_SwapFloatLE(src[0]); float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = SDL_SwapFloatLE(sample1); dst[0] = SDL_SwapFloatLE(sample0); dst -= 2; @@ -6282,7 +6282,7 @@ SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); float sample3 = SDL_SwapFloatLE(src[3]); float sample2 = SDL_SwapFloatLE(src[2]); float sample1 = SDL_SwapFloatLE(src[1]); @@ -6291,7 +6291,7 @@ SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = SDL_SwapFloatLE(sample3); dst[2] = SDL_SwapFloatLE(sample2); dst[1] = SDL_SwapFloatLE(sample1); @@ -6376,7 +6376,7 @@ SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 6; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); float sample5 = SDL_SwapFloatLE(src[5]); float sample4 = SDL_SwapFloatLE(src[4]); float sample3 = SDL_SwapFloatLE(src[3]); @@ -6389,7 +6389,7 @@ SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = SDL_SwapFloatLE(sample5); dst[4] = SDL_SwapFloatLE(sample4); dst[3] = SDL_SwapFloatLE(sample3); @@ -6490,7 +6490,7 @@ SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 8; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); float sample7 = SDL_SwapFloatLE(src[7]); float sample6 = SDL_SwapFloatLE(src[6]); float sample5 = SDL_SwapFloatLE(src[5]); @@ -6507,7 +6507,7 @@ SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = SDL_SwapFloatLE(sample7); dst[6] = SDL_SwapFloatLE(sample6); dst[5] = SDL_SwapFloatLE(sample5); @@ -6624,10 +6624,10 @@ SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 1; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); float sample0 = SDL_SwapFloatBE(src[0]); float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[0] = SDL_SwapFloatBE(sample0); dst--; eps += srcsize; @@ -6688,12 +6688,12 @@ SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); float sample1 = SDL_SwapFloatBE(src[1]); float sample0 = SDL_SwapFloatBE(src[0]); float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[1] = SDL_SwapFloatBE(sample1); dst[0] = SDL_SwapFloatBE(sample0); dst -= 2; @@ -6762,7 +6762,7 @@ SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); float sample3 = SDL_SwapFloatBE(src[3]); float sample2 = SDL_SwapFloatBE(src[2]); float sample1 = SDL_SwapFloatBE(src[1]); @@ -6771,7 +6771,7 @@ SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[3] = SDL_SwapFloatBE(sample3); dst[2] = SDL_SwapFloatBE(sample2); dst[1] = SDL_SwapFloatBE(sample1); @@ -6856,7 +6856,7 @@ SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 6; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); float sample5 = SDL_SwapFloatBE(src[5]); float sample4 = SDL_SwapFloatBE(src[4]); float sample3 = SDL_SwapFloatBE(src[3]); @@ -6869,7 +6869,7 @@ SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[5] = SDL_SwapFloatBE(sample5); dst[4] = SDL_SwapFloatBE(sample4); dst[3] = SDL_SwapFloatBE(sample3); @@ -6970,7 +6970,7 @@ SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) register int eps = 0; float *dst = ((float *) (cvt->buf + dstsize)) - 8; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); float sample7 = SDL_SwapFloatBE(src[7]); float sample6 = SDL_SwapFloatBE(src[6]); float sample5 = SDL_SwapFloatBE(src[5]); @@ -6987,7 +6987,7 @@ SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) float last_sample2 = sample2; float last_sample1 = sample1; float last_sample0 = sample0; - while (dst > target) { + while (dst >= target) { dst[7] = SDL_SwapFloatBE(sample7); dst[6] = SDL_SwapFloatBE(sample6); dst[5] = SDL_SwapFloatBE(sample5); @@ -7103,11 +7103,11 @@ SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 1; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample0 = (Sint16) src[0]; src--; dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); @@ -7156,17 +7156,17 @@ SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 1; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample0 = (Sint16) src[0]; src--; - dst[3] = (Uint8) sample0; - dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); + dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Uint8) sample0; last_sample0 = sample0; dst -= 4; } @@ -7211,12 +7211,12 @@ SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 2; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample1 = (Sint16) src[1]; const Sint16 sample0 = (Sint16) src[0]; src -= 2; @@ -7273,23 +7273,23 @@ SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 2; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample1 = (Sint16) src[1]; const Sint16 sample0 = (Sint16) src[0]; src -= 2; - dst[7] = (Uint8) sample1; - dst[6] = (Uint8) sample0; - dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); + dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); + dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Uint8) sample1; + dst[0] = (Uint8) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -7339,14 +7339,14 @@ SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 4; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample3 = (Sint16) src[3]; Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample3 = (Sint16) src[3]; const Sint16 sample2 = (Sint16) src[2]; const Sint16 sample1 = (Sint16) src[1]; @@ -7419,35 +7419,35 @@ SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 4; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample3 = (Sint16) src[3]; Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample3 = (Sint16) src[3]; const Sint16 sample2 = (Sint16) src[2]; const Sint16 sample1 = (Sint16) src[1]; const Sint16 sample0 = (Sint16) src[0]; src -= 4; - dst[15] = (Uint8) sample3; - dst[14] = (Uint8) sample2; - dst[13] = (Uint8) sample1; - dst[12] = (Uint8) sample0; - dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); + dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); + dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); + dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); + dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Uint8) sample3; + dst[2] = (Uint8) sample2; + dst[1] = (Uint8) sample1; + dst[0] = (Uint8) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -7507,16 +7507,16 @@ SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 6; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample5 = (Sint16) src[5]; Sint16 last_sample4 = (Sint16) src[4]; Sint16 last_sample3 = (Sint16) src[3]; Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample5 = (Sint16) src[5]; const Sint16 sample4 = (Sint16) src[4]; const Sint16 sample3 = (Sint16) src[3]; @@ -7605,16 +7605,16 @@ SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 6; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample5 = (Sint16) src[5]; Sint16 last_sample4 = (Sint16) src[4]; Sint16 last_sample3 = (Sint16) src[3]; Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample5 = (Sint16) src[5]; const Sint16 sample4 = (Sint16) src[4]; const Sint16 sample3 = (Sint16) src[3]; @@ -7622,30 +7622,30 @@ SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint16 sample1 = (Sint16) src[1]; const Sint16 sample0 = (Sint16) src[0]; src -= 6; - dst[23] = (Uint8) sample5; - dst[22] = (Uint8) sample4; - dst[21] = (Uint8) sample3; - dst[20] = (Uint8) sample2; - dst[19] = (Uint8) sample1; - dst[18] = (Uint8) sample0; - dst[17] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Uint8) ((sample5 + last_sample5) >> 1); + dst[16] = (Uint8) ((sample4 + last_sample4) >> 1); + dst[15] = (Uint8) ((sample3 + last_sample3) >> 1); + dst[14] = (Uint8) ((sample2 + last_sample2) >> 1); + dst[13] = (Uint8) ((sample1 + last_sample1) >> 1); + dst[12] = (Uint8) ((sample0 + last_sample0) >> 1); + dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Uint8) sample5; + dst[4] = (Uint8) sample4; + dst[3] = (Uint8) sample3; + dst[2] = (Uint8) sample2; + dst[1] = (Uint8) sample1; + dst[0] = (Uint8) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -7715,9 +7715,9 @@ SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 8; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample7 = (Sint16) src[7]; Sint16 last_sample6 = (Sint16) src[6]; Sint16 last_sample5 = (Sint16) src[5]; @@ -7726,7 +7726,7 @@ SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample7 = (Sint16) src[7]; const Sint16 sample6 = (Sint16) src[6]; const Sint16 sample5 = (Sint16) src[5]; @@ -7831,9 +7831,9 @@ SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; + Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4; const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf) - 8; + const Uint8 *target = ((const Uint8 *) cvt->buf); Sint16 last_sample7 = (Sint16) src[7]; Sint16 last_sample6 = (Sint16) src[6]; Sint16 last_sample5 = (Sint16) src[5]; @@ -7842,7 +7842,7 @@ SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = (Sint16) src[2]; Sint16 last_sample1 = (Sint16) src[1]; Sint16 last_sample0 = (Sint16) src[0]; - while (dst > target) { + while (dst >= target) { const Sint16 sample7 = (Sint16) src[7]; const Sint16 sample6 = (Sint16) src[6]; const Sint16 sample5 = (Sint16) src[5]; @@ -7852,38 +7852,38 @@ SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint16 sample1 = (Sint16) src[1]; const Sint16 sample0 = (Sint16) src[0]; src -= 8; - dst[31] = (Uint8) sample7; - dst[30] = (Uint8) sample6; - dst[29] = (Uint8) sample5; - dst[28] = (Uint8) sample4; - dst[27] = (Uint8) sample3; - dst[26] = (Uint8) sample2; - dst[25] = (Uint8) sample1; - dst[24] = (Uint8) sample0; - dst[23] = (Uint8) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Uint8) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint8) ((sample7 + last_sample7) >> 1); + dst[22] = (Uint8) ((sample6 + last_sample6) >> 1); + dst[21] = (Uint8) ((sample5 + last_sample5) >> 1); + dst[20] = (Uint8) ((sample4 + last_sample4) >> 1); + dst[19] = (Uint8) ((sample3 + last_sample3) >> 1); + dst[18] = (Uint8) ((sample2 + last_sample2) >> 1); + dst[17] = (Uint8) ((sample1 + last_sample1) >> 1); + dst[16] = (Uint8) ((sample0 + last_sample0) >> 1); + dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Uint8) sample7; + dst[6] = (Uint8) sample6; + dst[5] = (Uint8) sample5; + dst[4] = (Uint8) sample4; + dst[3] = (Uint8) sample3; + dst[2] = (Uint8) sample2; + dst[1] = (Uint8) sample1; + dst[0] = (Uint8) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -7963,11 +7963,11 @@ SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 1; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src--; dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); @@ -8016,17 +8016,17 @@ SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 1; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src--; - dst[3] = (Sint8) sample0; - dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); + dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Sint8) sample0; last_sample0 = sample0; dst -= 4; } @@ -8071,12 +8071,12 @@ SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 2; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample1 = (Sint16) ((Sint8) src[1]); const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src -= 2; @@ -8133,23 +8133,23 @@ SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 2; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample1 = (Sint16) ((Sint8) src[1]); const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src -= 2; - dst[7] = (Sint8) sample1; - dst[6] = (Sint8) sample0; - dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); + dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); + dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Sint8) sample1; + dst[0] = (Sint8) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -8199,14 +8199,14 @@ SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 4; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample3 = (Sint16) ((Sint8) src[3]); const Sint16 sample2 = (Sint16) ((Sint8) src[2]); const Sint16 sample1 = (Sint16) ((Sint8) src[1]); @@ -8279,35 +8279,35 @@ SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 4; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample3 = (Sint16) ((Sint8) src[3]); const Sint16 sample2 = (Sint16) ((Sint8) src[2]); const Sint16 sample1 = (Sint16) ((Sint8) src[1]); const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src -= 4; - dst[15] = (Sint8) sample3; - dst[14] = (Sint8) sample2; - dst[13] = (Sint8) sample1; - dst[12] = (Sint8) sample0; - dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); + dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); + dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); + dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); + dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Sint8) sample3; + dst[2] = (Sint8) sample2; + dst[1] = (Sint8) sample1; + dst[0] = (Sint8) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -8367,16 +8367,16 @@ SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 6; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample5 = (Sint16) ((Sint8) src[5]); const Sint16 sample4 = (Sint16) ((Sint8) src[4]); const Sint16 sample3 = (Sint16) ((Sint8) src[3]); @@ -8465,16 +8465,16 @@ SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 6; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample5 = (Sint16) ((Sint8) src[5]); const Sint16 sample4 = (Sint16) ((Sint8) src[4]); const Sint16 sample3 = (Sint16) ((Sint8) src[3]); @@ -8482,30 +8482,30 @@ SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint16 sample1 = (Sint16) ((Sint8) src[1]); const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src -= 6; - dst[23] = (Sint8) sample5; - dst[22] = (Sint8) sample4; - dst[21] = (Sint8) sample3; - dst[20] = (Sint8) sample2; - dst[19] = (Sint8) sample1; - dst[18] = (Sint8) sample0; - dst[17] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Sint8) ((sample5 + last_sample5) >> 1); + dst[16] = (Sint8) ((sample4 + last_sample4) >> 1); + dst[15] = (Sint8) ((sample3 + last_sample3) >> 1); + dst[14] = (Sint8) ((sample2 + last_sample2) >> 1); + dst[13] = (Sint8) ((sample1 + last_sample1) >> 1); + dst[12] = (Sint8) ((sample0 + last_sample0) >> 1); + dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Sint8) sample5; + dst[4] = (Sint8) sample4; + dst[3] = (Sint8) sample3; + dst[2] = (Sint8) sample2; + dst[1] = (Sint8) sample1; + dst[0] = (Sint8) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -8575,9 +8575,9 @@ SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 8; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); @@ -8586,7 +8586,7 @@ SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample7 = (Sint16) ((Sint8) src[7]); const Sint16 sample6 = (Sint16) ((Sint8) src[6]); const Sint16 sample5 = (Sint16) ((Sint8) src[5]); @@ -8691,9 +8691,9 @@ SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; + Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4; const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf) - 8; + const Sint8 *target = ((const Sint8 *) cvt->buf); Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); @@ -8702,7 +8702,7 @@ SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst > target) { + while (dst >= target) { const Sint16 sample7 = (Sint16) ((Sint8) src[7]); const Sint16 sample6 = (Sint16) ((Sint8) src[6]); const Sint16 sample5 = (Sint16) ((Sint8) src[5]); @@ -8712,38 +8712,38 @@ SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint16 sample1 = (Sint16) ((Sint8) src[1]); const Sint16 sample0 = (Sint16) ((Sint8) src[0]); src -= 8; - dst[31] = (Sint8) sample7; - dst[30] = (Sint8) sample6; - dst[29] = (Sint8) sample5; - dst[28] = (Sint8) sample4; - dst[27] = (Sint8) sample3; - dst[26] = (Sint8) sample2; - dst[25] = (Sint8) sample1; - dst[24] = (Sint8) sample0; - dst[23] = (Sint8) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Sint8) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint8) ((sample7 + last_sample7) >> 1); + dst[22] = (Sint8) ((sample6 + last_sample6) >> 1); + dst[21] = (Sint8) ((sample5 + last_sample5) >> 1); + dst[20] = (Sint8) ((sample4 + last_sample4) >> 1); + dst[19] = (Sint8) ((sample3 + last_sample3) >> 1); + dst[18] = (Sint8) ((sample2 + last_sample2) >> 1); + dst[17] = (Sint8) ((sample1 + last_sample1) >> 1); + dst[16] = (Sint8) ((sample0 + last_sample0) >> 1); + dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Sint8) sample7; + dst[6] = (Sint8) sample6; + dst[5] = (Sint8) sample5; + dst[4] = (Sint8) sample4; + dst[3] = (Sint8) sample3; + dst[2] = (Sint8) sample2; + dst[1] = (Sint8) sample1; + dst[0] = (Sint8) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -8823,11 +8823,11 @@ SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src--; dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); @@ -8876,17 +8876,17 @@ SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src--; - dst[3] = (Uint16) sample0; - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Uint16) sample0; last_sample0 = sample0; dst -= 4; } @@ -8931,12 +8931,12 @@ SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src -= 2; @@ -8993,23 +8993,23 @@ SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src -= 2; - dst[7] = (Uint16) sample1; - dst[6] = (Uint16) sample0; - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -9059,14 +9059,14 @@ SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); @@ -9139,35 +9139,35 @@ SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src -= 4; - dst[15] = (Uint16) sample3; - dst[14] = (Uint16) sample2; - dst[13] = (Uint16) sample1; - dst[12] = (Uint16) sample0; - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -9227,16 +9227,16 @@ SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); @@ -9325,16 +9325,16 @@ SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); @@ -9342,30 +9342,30 @@ SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src -= 6; - dst[23] = (Uint16) sample5; - dst[22] = (Uint16) sample4; - dst[21] = (Uint16) sample3; - dst[20] = (Uint16) sample2; - dst[19] = (Uint16) sample1; - dst[18] = (Uint16) sample0; - dst[17] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); + dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); + dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Uint16) sample5; + dst[4] = (Uint16) sample4; + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -9435,9 +9435,9 @@ SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); @@ -9446,7 +9446,7 @@ SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); @@ -9551,9 +9551,9 @@ SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); @@ -9562,7 +9562,7 @@ SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); @@ -9572,38 +9572,38 @@ SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); src -= 8; - dst[31] = (Uint16) sample7; - dst[30] = (Uint16) sample6; - dst[29] = (Uint16) sample5; - dst[28] = (Uint16) sample4; - dst[27] = (Uint16) sample3; - dst[26] = (Uint16) sample2; - dst[25] = (Uint16) sample1; - dst[24] = (Uint16) sample0; - dst[23] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); + dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); + dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); + dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); + dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Uint16) sample7; + dst[6] = (Uint16) sample6; + dst[5] = (Uint16) sample5; + dst[4] = (Uint16) sample4; + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -9683,11 +9683,11 @@ SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src--; dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); @@ -9736,17 +9736,17 @@ SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src--; - dst[3] = (Sint16) sample0; - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Sint16) sample0; last_sample0 = sample0; dst -= 4; } @@ -9791,12 +9791,12 @@ SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src -= 2; @@ -9853,23 +9853,23 @@ SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src -= 2; - dst[7] = (Sint16) sample1; - dst[6] = (Sint16) sample0; - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -9919,14 +9919,14 @@ SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); @@ -9999,35 +9999,35 @@ SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src -= 4; - dst[15] = (Sint16) sample3; - dst[14] = (Sint16) sample2; - dst[13] = (Sint16) sample1; - dst[12] = (Sint16) sample0; - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -10087,16 +10087,16 @@ SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); @@ -10185,16 +10185,16 @@ SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); @@ -10202,30 +10202,30 @@ SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src -= 6; - dst[23] = (Sint16) sample5; - dst[22] = (Sint16) sample4; - dst[21] = (Sint16) sample3; - dst[20] = (Sint16) sample2; - dst[19] = (Sint16) sample1; - dst[18] = (Sint16) sample0; - dst[17] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); + dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); + dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Sint16) sample5; + dst[4] = (Sint16) sample4; + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -10295,9 +10295,9 @@ SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); @@ -10306,7 +10306,7 @@ SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); @@ -10411,9 +10411,9 @@ SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); @@ -10422,7 +10422,7 @@ SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); @@ -10432,38 +10432,38 @@ SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); src -= 8; - dst[31] = (Sint16) sample7; - dst[30] = (Sint16) sample6; - dst[29] = (Sint16) sample5; - dst[28] = (Sint16) sample4; - dst[27] = (Sint16) sample3; - dst[26] = (Sint16) sample2; - dst[25] = (Sint16) sample1; - dst[24] = (Sint16) sample0; - dst[23] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); + dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); + dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); + dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); + dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Sint16) sample7; + dst[6] = (Sint16) sample6; + dst[5] = (Sint16) sample5; + dst[4] = (Sint16) sample4; + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -10543,11 +10543,11 @@ SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src--; dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); @@ -10596,17 +10596,17 @@ SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 1; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src--; - dst[3] = (Uint16) sample0; - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Uint16) sample0; last_sample0 = sample0; dst -= 4; } @@ -10651,12 +10651,12 @@ SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src -= 2; @@ -10713,23 +10713,23 @@ SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 2; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src -= 2; - dst[7] = (Uint16) sample1; - dst[6] = (Uint16) sample0; - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -10779,14 +10779,14 @@ SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); @@ -10859,35 +10859,35 @@ SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 4; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src -= 4; - dst[15] = (Uint16) sample3; - dst[14] = (Uint16) sample2; - dst[13] = (Uint16) sample1; - dst[12] = (Uint16) sample0; - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -10947,16 +10947,16 @@ SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); @@ -11045,16 +11045,16 @@ SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 6; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); @@ -11062,30 +11062,30 @@ SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src -= 6; - dst[23] = (Uint16) sample5; - dst[22] = (Uint16) sample4; - dst[21] = (Uint16) sample3; - dst[20] = (Uint16) sample2; - dst[19] = (Uint16) sample1; - dst[18] = (Uint16) sample0; - dst[17] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); + dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); + dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Uint16) sample5; + dst[4] = (Uint16) sample4; + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -11155,9 +11155,9 @@ SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); @@ -11166,7 +11166,7 @@ SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); @@ -11271,9 +11271,9 @@ SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; + Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf) - 8; + const Uint16 *target = ((const Uint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); @@ -11282,7 +11282,7 @@ SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); @@ -11292,38 +11292,38 @@ SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); src -= 8; - dst[31] = (Uint16) sample7; - dst[30] = (Uint16) sample6; - dst[29] = (Uint16) sample5; - dst[28] = (Uint16) sample4; - dst[27] = (Uint16) sample3; - dst[26] = (Uint16) sample2; - dst[25] = (Uint16) sample1; - dst[24] = (Uint16) sample0; - dst[23] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); + dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); + dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); + dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); + dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); + dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); + dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); + dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); + dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Uint16) sample7; + dst[6] = (Uint16) sample6; + dst[5] = (Uint16) sample5; + dst[4] = (Uint16) sample4; + dst[3] = (Uint16) sample3; + dst[2] = (Uint16) sample2; + dst[1] = (Uint16) sample1; + dst[0] = (Uint16) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -11403,11 +11403,11 @@ SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src--; dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); @@ -11456,17 +11456,17 @@ SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 1; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src--; - dst[3] = (Sint16) sample0; - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Sint16) sample0; last_sample0 = sample0; dst -= 4; } @@ -11511,12 +11511,12 @@ SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src -= 2; @@ -11573,23 +11573,23 @@ SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src -= 2; - dst[7] = (Sint16) sample1; - dst[6] = (Sint16) sample0; - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -11639,14 +11639,14 @@ SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); @@ -11719,35 +11719,35 @@ SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 4; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src -= 4; - dst[15] = (Sint16) sample3; - dst[14] = (Sint16) sample2; - dst[13] = (Sint16) sample1; - dst[12] = (Sint16) sample0; - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -11807,16 +11807,16 @@ SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); @@ -11905,16 +11905,16 @@ SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 6; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); @@ -11922,30 +11922,30 @@ SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src -= 6; - dst[23] = (Sint16) sample5; - dst[22] = (Sint16) sample4; - dst[21] = (Sint16) sample3; - dst[20] = (Sint16) sample2; - dst[19] = (Sint16) sample1; - dst[18] = (Sint16) sample0; - dst[17] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); + dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); + dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Sint16) sample5; + dst[4] = (Sint16) sample4; + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -12015,9 +12015,9 @@ SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); @@ -12026,7 +12026,7 @@ SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); @@ -12131,9 +12131,9 @@ SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; + Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf) - 8; + const Sint16 *target = ((const Sint16 *) cvt->buf); Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); @@ -12142,7 +12142,7 @@ SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst > target) { + while (dst >= target) { const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); @@ -12152,38 +12152,38 @@ SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); src -= 8; - dst[31] = (Sint16) sample7; - dst[30] = (Sint16) sample6; - dst[29] = (Sint16) sample5; - dst[28] = (Sint16) sample4; - dst[27] = (Sint16) sample3; - dst[26] = (Sint16) sample2; - dst[25] = (Sint16) sample1; - dst[24] = (Sint16) sample0; - dst[23] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); + dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); + dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); + dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); + dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); + dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); + dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); + dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); + dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Sint16) sample7; + dst[6] = (Sint16) sample6; + dst[5] = (Sint16) sample5; + dst[4] = (Sint16) sample4; + dst[3] = (Sint16) sample3; + dst[2] = (Sint16) sample2; + dst[1] = (Sint16) sample1; + dst[0] = (Sint16) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -12263,11 +12263,11 @@ SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src--; dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); @@ -12316,17 +12316,17 @@ SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src--; - dst[3] = (Sint32) sample0; - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Sint32) sample0; last_sample0 = sample0; dst -= 4; } @@ -12371,12 +12371,12 @@ SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src -= 2; @@ -12433,23 +12433,23 @@ SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src -= 2; - dst[7] = (Sint32) sample1; - dst[6] = (Sint32) sample0; - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -12499,14 +12499,14 @@ SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); @@ -12579,35 +12579,35 @@ SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src -= 4; - dst[15] = (Sint32) sample3; - dst[14] = (Sint32) sample2; - dst[13] = (Sint32) sample1; - dst[12] = (Sint32) sample0; - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -12667,16 +12667,16 @@ SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); @@ -12765,16 +12765,16 @@ SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); @@ -12782,30 +12782,30 @@ SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src -= 6; - dst[23] = (Sint32) sample5; - dst[22] = (Sint32) sample4; - dst[21] = (Sint32) sample3; - dst[20] = (Sint32) sample2; - dst[19] = (Sint32) sample1; - dst[18] = (Sint32) sample0; - dst[17] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); + dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); + dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Sint32) sample5; + dst[4] = (Sint32) sample4; + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -12875,9 +12875,9 @@ SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); @@ -12886,7 +12886,7 @@ SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); @@ -12991,9 +12991,9 @@ SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); @@ -13002,7 +13002,7 @@ SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); @@ -13012,38 +13012,38 @@ SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); src -= 8; - dst[31] = (Sint32) sample7; - dst[30] = (Sint32) sample6; - dst[29] = (Sint32) sample5; - dst[28] = (Sint32) sample4; - dst[27] = (Sint32) sample3; - dst[26] = (Sint32) sample2; - dst[25] = (Sint32) sample1; - dst[24] = (Sint32) sample0; - dst[23] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); + dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); + dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); + dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); + dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Sint32) sample7; + dst[6] = (Sint32) sample6; + dst[5] = (Sint32) sample5; + dst[4] = (Sint32) sample4; + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -13123,11 +13123,11 @@ SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src--; dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); @@ -13176,17 +13176,17 @@ SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 1; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src--; - dst[3] = (Sint32) sample0; - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[0] = (Sint32) sample0; last_sample0 = sample0; dst -= 4; } @@ -13231,12 +13231,12 @@ SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src -= 2; @@ -13293,23 +13293,23 @@ SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 2; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src -= 2; - dst[7] = (Sint32) sample1; - dst[6] = (Sint32) sample0; - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -13359,14 +13359,14 @@ SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); @@ -13439,35 +13439,35 @@ SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 4; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src -= 4; - dst[15] = (Sint32) sample3; - dst[14] = (Sint32) sample2; - dst[13] = (Sint32) sample1; - dst[12] = (Sint32) sample0; - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -13527,16 +13527,16 @@ SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); @@ -13625,16 +13625,16 @@ SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 6; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); @@ -13642,30 +13642,30 @@ SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src -= 6; - dst[23] = (Sint32) sample5; - dst[22] = (Sint32) sample4; - dst[21] = (Sint32) sample3; - dst[20] = (Sint32) sample2; - dst[19] = (Sint32) sample1; - dst[18] = (Sint32) sample0; - dst[17] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[16] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[15] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[14] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[13] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[12] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); + dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); + dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); + dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); + dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); + dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); + dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[5] = (Sint32) sample5; + dst[4] = (Sint32) sample4; + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -13735,9 +13735,9 @@ SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); @@ -13746,7 +13746,7 @@ SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); @@ -13851,9 +13851,9 @@ SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; + Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf) - 8; + const Sint32 *target = ((const Sint32 *) cvt->buf); Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); @@ -13862,7 +13862,7 @@ SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst > target) { + while (dst >= target) { const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); @@ -13872,38 +13872,38 @@ SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); src -= 8; - dst[31] = (Sint32) sample7; - dst[30] = (Sint32) sample6; - dst[29] = (Sint32) sample5; - dst[28] = (Sint32) sample4; - dst[27] = (Sint32) sample3; - dst[26] = (Sint32) sample2; - dst[25] = (Sint32) sample1; - dst[24] = (Sint32) sample0; - dst[23] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[22] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[21] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[20] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[19] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[18] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[17] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[16] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[6] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); + dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); + dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); + dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); + dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); + dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); + dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); + dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); + dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); + dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); + dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); + dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); + dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); + dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); + dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); + dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); + dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); + dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); + dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); + dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); + dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); + dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); + dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); + dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); + dst[7] = (Sint32) sample7; + dst[6] = (Sint32) sample6; + dst[5] = (Sint32) sample5; + dst[4] = (Sint32) sample4; + dst[3] = (Sint32) sample3; + dst[2] = (Sint32) sample2; + dst[1] = (Sint32) sample1; + dst[0] = (Sint32) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -13983,11 +13983,11 @@ SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; + float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample0 = (double) SDL_SwapFloatLE(src[0]); src--; dst[1] = (float) ((sample0 + last_sample0) * 0.5); @@ -14036,17 +14036,17 @@ SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; + float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample0 = (double) SDL_SwapFloatLE(src[0]); src--; - dst[3] = (float) sample0; - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[2] = (float) ((sample0 + last_sample0) * 0.5); + dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[0] = (float) sample0; last_sample0 = sample0; dst -= 4; } @@ -14091,12 +14091,12 @@ SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; + float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample1 = (double) SDL_SwapFloatLE(src[1]); const double sample0 = (double) SDL_SwapFloatLE(src[0]); src -= 2; @@ -14153,23 +14153,23 @@ SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; + float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample1 = (double) SDL_SwapFloatLE(src[1]); const double sample0 = (double) SDL_SwapFloatLE(src[0]); src -= 2; - dst[7] = (float) sample1; - dst[6] = (float) sample0; - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[5] = (float) ((sample1 + last_sample1) * 0.5); + dst[4] = (float) ((sample0 + last_sample0) * 0.5); + dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -14219,14 +14219,14 @@ SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; + float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); double last_sample3 = (double) SDL_SwapFloatLE(src[3]); double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample3 = (double) SDL_SwapFloatLE(src[3]); const double sample2 = (double) SDL_SwapFloatLE(src[2]); const double sample1 = (double) SDL_SwapFloatLE(src[1]); @@ -14299,35 +14299,35 @@ SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; + float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); double last_sample3 = (double) SDL_SwapFloatLE(src[3]); double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample3 = (double) SDL_SwapFloatLE(src[3]); const double sample2 = (double) SDL_SwapFloatLE(src[2]); const double sample1 = (double) SDL_SwapFloatLE(src[1]); const double sample0 = (double) SDL_SwapFloatLE(src[0]); src -= 4; - dst[15] = (float) sample3; - dst[14] = (float) sample2; - dst[13] = (float) sample1; - dst[12] = (float) sample0; - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[11] = (float) ((sample3 + last_sample3) * 0.5); + dst[10] = (float) ((sample2 + last_sample2) * 0.5); + dst[9] = (float) ((sample1 + last_sample1) * 0.5); + dst[8] = (float) ((sample0 + last_sample0) * 0.5); + dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -14387,16 +14387,16 @@ SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; + float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); double last_sample5 = (double) SDL_SwapFloatLE(src[5]); double last_sample4 = (double) SDL_SwapFloatLE(src[4]); double last_sample3 = (double) SDL_SwapFloatLE(src[3]); double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample5 = (double) SDL_SwapFloatLE(src[5]); const double sample4 = (double) SDL_SwapFloatLE(src[4]); const double sample3 = (double) SDL_SwapFloatLE(src[3]); @@ -14485,16 +14485,16 @@ SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; + float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); double last_sample5 = (double) SDL_SwapFloatLE(src[5]); double last_sample4 = (double) SDL_SwapFloatLE(src[4]); double last_sample3 = (double) SDL_SwapFloatLE(src[3]); double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample5 = (double) SDL_SwapFloatLE(src[5]); const double sample4 = (double) SDL_SwapFloatLE(src[4]); const double sample3 = (double) SDL_SwapFloatLE(src[3]); @@ -14502,30 +14502,30 @@ SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const double sample1 = (double) SDL_SwapFloatLE(src[1]); const double sample0 = (double) SDL_SwapFloatLE(src[0]); src -= 6; - dst[23] = (float) sample5; - dst[22] = (float) sample4; - dst[21] = (float) sample3; - dst[20] = (float) sample2; - dst[19] = (float) sample1; - dst[18] = (float) sample0; - dst[17] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[16] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[15] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[14] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[13] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[12] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); + dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); + dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[17] = (float) ((sample5 + last_sample5) * 0.5); + dst[16] = (float) ((sample4 + last_sample4) * 0.5); + dst[15] = (float) ((sample3 + last_sample3) * 0.5); + dst[14] = (float) ((sample2 + last_sample2) * 0.5); + dst[13] = (float) ((sample1 + last_sample1) * 0.5); + dst[12] = (float) ((sample0 + last_sample0) * 0.5); + dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); + dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); + dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[5] = (float) sample5; + dst[4] = (float) sample4; + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -14595,9 +14595,9 @@ SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; + float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); double last_sample7 = (double) SDL_SwapFloatLE(src[7]); double last_sample6 = (double) SDL_SwapFloatLE(src[6]); double last_sample5 = (double) SDL_SwapFloatLE(src[5]); @@ -14606,7 +14606,7 @@ SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample7 = (double) SDL_SwapFloatLE(src[7]); const double sample6 = (double) SDL_SwapFloatLE(src[6]); const double sample5 = (double) SDL_SwapFloatLE(src[5]); @@ -14711,9 +14711,9 @@ SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; + float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); double last_sample7 = (double) SDL_SwapFloatLE(src[7]); double last_sample6 = (double) SDL_SwapFloatLE(src[6]); double last_sample5 = (double) SDL_SwapFloatLE(src[5]); @@ -14722,7 +14722,7 @@ SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) double last_sample2 = (double) SDL_SwapFloatLE(src[2]); double last_sample1 = (double) SDL_SwapFloatLE(src[1]); double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample7 = (double) SDL_SwapFloatLE(src[7]); const double sample6 = (double) SDL_SwapFloatLE(src[6]); const double sample5 = (double) SDL_SwapFloatLE(src[5]); @@ -14732,38 +14732,38 @@ SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const double sample1 = (double) SDL_SwapFloatLE(src[1]); const double sample0 = (double) SDL_SwapFloatLE(src[0]); src -= 8; - dst[31] = (float) sample7; - dst[30] = (float) sample6; - dst[29] = (float) sample5; - dst[28] = (float) sample4; - dst[27] = (float) sample3; - dst[26] = (float) sample2; - dst[25] = (float) sample1; - dst[24] = (float) sample0; - dst[23] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[22] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[21] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[20] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[19] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[18] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[17] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[16] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[6] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); + dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); + dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); + dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); + dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[23] = (float) ((sample7 + last_sample7) * 0.5); + dst[22] = (float) ((sample6 + last_sample6) * 0.5); + dst[21] = (float) ((sample5 + last_sample5) * 0.5); + dst[20] = (float) ((sample4 + last_sample4) * 0.5); + dst[19] = (float) ((sample3 + last_sample3) * 0.5); + dst[18] = (float) ((sample2 + last_sample2) * 0.5); + dst[17] = (float) ((sample1 + last_sample1) * 0.5); + dst[16] = (float) ((sample0 + last_sample0) * 0.5); + dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); + dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); + dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); + dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); + dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[7] = (float) sample7; + dst[6] = (float) sample6; + dst[5] = (float) sample5; + dst[4] = (float) sample4; + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; @@ -14843,11 +14843,11 @@ SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; + float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample0 = (double) SDL_SwapFloatBE(src[0]); src--; dst[1] = (float) ((sample0 + last_sample0) * 0.5); @@ -14896,17 +14896,17 @@ SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; + float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf) - 1; + const float *target = ((const float *) cvt->buf); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample0 = (double) SDL_SwapFloatBE(src[0]); src--; - dst[3] = (float) sample0; - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[2] = (float) ((sample0 + last_sample0) * 0.5); + dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[0] = (float) sample0; last_sample0 = sample0; dst -= 4; } @@ -14951,12 +14951,12 @@ SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; + float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample1 = (double) SDL_SwapFloatBE(src[1]); const double sample0 = (double) SDL_SwapFloatBE(src[0]); src -= 2; @@ -15013,23 +15013,23 @@ SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; + float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf) - 2; + const float *target = ((const float *) cvt->buf); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample1 = (double) SDL_SwapFloatBE(src[1]); const double sample0 = (double) SDL_SwapFloatBE(src[0]); src -= 2; - dst[7] = (float) sample1; - dst[6] = (float) sample0; - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[5] = (float) ((sample1 + last_sample1) * 0.5); + dst[4] = (float) ((sample0 + last_sample0) * 0.5); + dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample1 = sample1; last_sample0 = sample0; dst -= 8; @@ -15079,14 +15079,14 @@ SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; + float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); double last_sample3 = (double) SDL_SwapFloatBE(src[3]); double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample3 = (double) SDL_SwapFloatBE(src[3]); const double sample2 = (double) SDL_SwapFloatBE(src[2]); const double sample1 = (double) SDL_SwapFloatBE(src[1]); @@ -15159,35 +15159,35 @@ SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; + float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf) - 4; + const float *target = ((const float *) cvt->buf); double last_sample3 = (double) SDL_SwapFloatBE(src[3]); double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample3 = (double) SDL_SwapFloatBE(src[3]); const double sample2 = (double) SDL_SwapFloatBE(src[2]); const double sample1 = (double) SDL_SwapFloatBE(src[1]); const double sample0 = (double) SDL_SwapFloatBE(src[0]); src -= 4; - dst[15] = (float) sample3; - dst[14] = (float) sample2; - dst[13] = (float) sample1; - dst[12] = (float) sample0; - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[11] = (float) ((sample3 + last_sample3) * 0.5); + dst[10] = (float) ((sample2 + last_sample2) * 0.5); + dst[9] = (float) ((sample1 + last_sample1) * 0.5); + dst[8] = (float) ((sample0 + last_sample0) * 0.5); + dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample3 = sample3; last_sample2 = sample2; last_sample1 = sample1; @@ -15247,16 +15247,16 @@ SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; + float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); double last_sample5 = (double) SDL_SwapFloatBE(src[5]); double last_sample4 = (double) SDL_SwapFloatBE(src[4]); double last_sample3 = (double) SDL_SwapFloatBE(src[3]); double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample5 = (double) SDL_SwapFloatBE(src[5]); const double sample4 = (double) SDL_SwapFloatBE(src[4]); const double sample3 = (double) SDL_SwapFloatBE(src[3]); @@ -15345,16 +15345,16 @@ SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; + float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf) - 6; + const float *target = ((const float *) cvt->buf); double last_sample5 = (double) SDL_SwapFloatBE(src[5]); double last_sample4 = (double) SDL_SwapFloatBE(src[4]); double last_sample3 = (double) SDL_SwapFloatBE(src[3]); double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample5 = (double) SDL_SwapFloatBE(src[5]); const double sample4 = (double) SDL_SwapFloatBE(src[4]); const double sample3 = (double) SDL_SwapFloatBE(src[3]); @@ -15362,30 +15362,30 @@ SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const double sample1 = (double) SDL_SwapFloatBE(src[1]); const double sample0 = (double) SDL_SwapFloatBE(src[0]); src -= 6; - dst[23] = (float) sample5; - dst[22] = (float) sample4; - dst[21] = (float) sample3; - dst[20] = (float) sample2; - dst[19] = (float) sample1; - dst[18] = (float) sample0; - dst[17] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[16] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[15] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[14] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[13] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[12] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); + dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); + dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[17] = (float) ((sample5 + last_sample5) * 0.5); + dst[16] = (float) ((sample4 + last_sample4) * 0.5); + dst[15] = (float) ((sample3 + last_sample3) * 0.5); + dst[14] = (float) ((sample2 + last_sample2) * 0.5); + dst[13] = (float) ((sample1 + last_sample1) * 0.5); + dst[12] = (float) ((sample0 + last_sample0) * 0.5); + dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); + dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); + dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[5] = (float) sample5; + dst[4] = (float) sample4; + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample5 = sample5; last_sample4 = sample4; last_sample3 = sample3; @@ -15455,9 +15455,9 @@ SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; + float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); double last_sample7 = (double) SDL_SwapFloatBE(src[7]); double last_sample6 = (double) SDL_SwapFloatBE(src[6]); double last_sample5 = (double) SDL_SwapFloatBE(src[5]); @@ -15466,7 +15466,7 @@ SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample7 = (double) SDL_SwapFloatBE(src[7]); const double sample6 = (double) SDL_SwapFloatBE(src[6]); const double sample5 = (double) SDL_SwapFloatBE(src[5]); @@ -15571,9 +15571,9 @@ SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) #endif const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; + float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf) - 8; + const float *target = ((const float *) cvt->buf); double last_sample7 = (double) SDL_SwapFloatBE(src[7]); double last_sample6 = (double) SDL_SwapFloatBE(src[6]); double last_sample5 = (double) SDL_SwapFloatBE(src[5]); @@ -15582,7 +15582,7 @@ SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) double last_sample2 = (double) SDL_SwapFloatBE(src[2]); double last_sample1 = (double) SDL_SwapFloatBE(src[1]); double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst > target) { + while (dst >= target) { const double sample7 = (double) SDL_SwapFloatBE(src[7]); const double sample6 = (double) SDL_SwapFloatBE(src[6]); const double sample5 = (double) SDL_SwapFloatBE(src[5]); @@ -15592,38 +15592,38 @@ SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) const double sample1 = (double) SDL_SwapFloatBE(src[1]); const double sample0 = (double) SDL_SwapFloatBE(src[0]); src -= 8; - dst[31] = (float) sample7; - dst[30] = (float) sample6; - dst[29] = (float) sample5; - dst[28] = (float) sample4; - dst[27] = (float) sample3; - dst[26] = (float) sample2; - dst[25] = (float) sample1; - dst[24] = (float) sample0; - dst[23] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[22] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[21] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[20] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[19] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[18] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[17] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[16] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[6] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); + dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); + dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); + dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); + dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); + dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); + dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); + dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); + dst[23] = (float) ((sample7 + last_sample7) * 0.5); + dst[22] = (float) ((sample6 + last_sample6) * 0.5); + dst[21] = (float) ((sample5 + last_sample5) * 0.5); + dst[20] = (float) ((sample4 + last_sample4) * 0.5); + dst[19] = (float) ((sample3 + last_sample3) * 0.5); + dst[18] = (float) ((sample2 + last_sample2) * 0.5); + dst[17] = (float) ((sample1 + last_sample1) * 0.5); + dst[16] = (float) ((sample0 + last_sample0) * 0.5); + dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); + dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); + dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); + dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); + dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); + dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); + dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); + dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); + dst[7] = (float) sample7; + dst[6] = (float) sample6; + dst[5] = (float) sample5; + dst[4] = (float) sample4; + dst[3] = (float) sample3; + dst[2] = (float) sample2; + dst[1] = (float) sample1; + dst[0] = (float) sample0; last_sample7 = sample7; last_sample6 = sample6; last_sample5 = sample5; diff --git a/project/jni/sdl-1.3/src/audio/SDL_mixer.c b/project/jni/sdl-1.3/src/audio/SDL_mixer.c old mode 100644 new mode 100755 index 5b122bf97..3a1a9f4a1 --- a/project/jni/sdl-1.3/src/audio/SDL_mixer.c +++ b/project/jni/sdl-1.3/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_sysaudio.h b/project/jni/sdl-1.3/src/audio/SDL_sysaudio.h old mode 100644 new mode 100755 index 14e22a8c1..0badf53b2 --- a/project/jni/sdl-1.3/src/audio/SDL_sysaudio.h +++ b/project/jni/sdl-1.3/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_wave.c b/project/jni/sdl-1.3/src/audio/SDL_wave.c old mode 100644 new mode 100755 index 9918eb400..d6df07bbe --- a/project/jni/sdl-1.3/src/audio/SDL_wave.c +++ b/project/jni/sdl-1.3/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/SDL_wave.h b/project/jni/sdl-1.3/src/audio/SDL_wave.h old mode 100644 new mode 100755 index 7775a29a5..b879d4b65 --- a/project/jni/sdl-1.3/src/audio/SDL_wave.h +++ b/project/jni/sdl-1.3/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.c b/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.c old mode 100644 new mode 100755 index f3e4b0a23..2d5f7d819 --- a/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.c +++ b/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.h b/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.h old mode 100644 new mode 100755 index f28d0697a..4c5725856 --- a/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.h +++ b/project/jni/sdl-1.3/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.c b/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.c old mode 100644 new mode 100755 index 57c29c56b..3031ae289 --- a/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.c +++ b/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,7 @@ static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s, static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer, int count); static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s); +static int (*SDL_NAME(arts_suspend))(void); static int (*SDL_NAME(arts_suspended)) (void); static const char *(*SDL_NAME(arts_error_text)) (int errorcode); @@ -78,6 +79,7 @@ static struct SDL_ARTS_SYM(arts_stream_get), SDL_ARTS_SYM(arts_write), SDL_ARTS_SYM(arts_close_stream), + SDL_ARTS_SYM(arts_suspend), SDL_ARTS_SYM(arts_suspended), SDL_ARTS_SYM(arts_error_text), /* *INDENT-ON* */ @@ -216,6 +218,17 @@ ARTS_CloseDevice(_THIS) } } +static int +ARTS_Suspend(void) +{ + const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */ + while ( (!SDL_NAME(arts_suspended)()) && (SDL_GetTicks() < abortms) ) { + if ( SDL_NAME(arts_suspend)() ) { + break; + } + } + return SDL_NAME(arts_suspended)(); +} static int ARTS_OpenDevice(_THIS, const char *devname, int iscapture) @@ -270,7 +283,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) return 0; } - if (!SDL_NAME(arts_suspended) ()) { + if (!ARTS_Suspend()) { ARTS_CloseDevice(this); SDL_SetError("ARTS can not open audio device"); return 0; @@ -346,7 +359,7 @@ ARTS_Init(SDL_AudioDriverImpl * impl) } /* Play a stream so aRts doesn't crash */ - if (SDL_NAME(arts_suspended) ()) { + if (ARTS_Suspend()) { arts_stream_t stream; stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL"); SDL_NAME(arts_write) (stream, "", 0); diff --git a/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.h b/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.h old mode 100644 new mode 100755 index 15cf3d904..f64ea4255 --- a/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.h +++ b/project/jni/sdl-1.3/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.cc b/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.cc old mode 100644 new mode 100755 index 310cb53bc..8540ea878 --- a/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.cc +++ b/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.h b/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.h old mode 100644 new mode 100755 index 509b23ac3..0e5d8871a --- a/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.h +++ b/project/jni/sdl-1.3/src/audio/baudio/SDL_beaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.c b/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.c old mode 100644 new mode 100755 index 8d1b0895d..753dd2860 --- a/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.c +++ b/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.h b/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.h old mode 100644 new mode 100755 index 550c8abcc..dd0dfd878 --- a/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.h +++ b/project/jni/sdl-1.3/src/audio/bsd/SDL_bsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.c b/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.c old mode 100644 new mode 100755 index d5f6b4fef..53d3a08f1 --- a/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.c +++ b/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_coreaudio.h" +#include "SDL_assert.h" #define DEBUG_COREAUDIO 0 @@ -268,8 +269,8 @@ outputCallback(void *inRefCon, any input format in OpenAudio, and leave the conversion to CoreAudio. */ /* - assert(!this->convert.needed); - assert(this->spec.channels == ioData->mNumberChannels); + SDL_assert(!this->convert.needed); + SDL_assert(this->spec.channels == ioData->mNumberChannels); */ for (i = 0; i < ioData->mNumberBuffers; i++) { diff --git a/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.h b/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.h old mode 100644 new mode 100755 index 511e1325f..65941f584 --- a/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.h +++ b/project/jni/sdl-1.3/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.c b/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.c old mode 100644 new mode 100755 index cd5556c90..a4ae908ae --- a/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.c +++ b/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.h b/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.h old mode 100644 new mode 100755 index 29e6504c5..4f00851ae --- a/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.h +++ b/project/jni/sdl-1.3/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.c b/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.c old mode 100644 new mode 100755 index 4e68a3951..1aeb7f4bf --- a/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.c +++ b/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.h b/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.h old mode 100644 new mode 100755 index 5a83168e1..c75ab4921 --- a/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.h +++ b/project/jni/sdl-1.3/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.c b/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.c old mode 100644 new mode 100755 index 5c4a76921..a67b7d525 --- a/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.c +++ b/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.h b/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.h old mode 100644 new mode 100755 index 223e5686f..3d9ebf196 --- a/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.h +++ b/project/jni/sdl-1.3/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.c b/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.c old mode 100644 new mode 100755 index 5ee014b22..14743464d --- a/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.c +++ b/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.h b/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.h old mode 100644 new mode 100755 index 49ea253b5..32956b982 --- a/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.h +++ b/project/jni/sdl-1.3/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.c b/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.c old mode 100644 new mode 100755 index 03ae3278a..627723561 --- a/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.c +++ b/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.h b/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.h old mode 100644 new mode 100755 index 47ad8a399..9824f577a --- a/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.h +++ b/project/jni/sdl-1.3/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.c b/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.c old mode 100644 new mode 100755 index 05bd1754e..db3995969 --- a/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.c +++ b/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.h b/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.h old mode 100644 new mode 100755 index 7be96de5a..3c997e711 --- a/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.h +++ b/project/jni/sdl-1.3/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.c b/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.c old mode 100644 new mode 100755 index d44f55627..d9b6b4c2c --- a/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.c +++ b/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.h b/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.h old mode 100644 new mode 100755 index a83c938d9..829a80422 --- a/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.h +++ b/project/jni/sdl-1.3/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.c b/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.c old mode 100644 new mode 100755 index 034e1726b..8b123a94a --- a/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.c +++ b/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.h b/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.h old mode 100644 new mode 100755 index ab0d7e3fa..f6bcff22e --- a/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.h +++ b/project/jni/sdl-1.3/src/audio/nds/SDL_ndsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.c b/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.c old mode 100644 new mode 100755 index 821fa7718..02051adce --- a/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.c +++ b/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.h b/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.h old mode 100644 new mode 100755 index d572ba918..9aae5c603 --- a/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.h +++ b/project/jni/sdl-1.3/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.c b/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.c old mode 100644 new mode 100755 index 6b2333e02..e64fef845 --- a/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.h b/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.h old mode 100644 new mode 100755 index 57b9412c7..195a446e8 --- a/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/project/jni/sdl-1.3/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.c b/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.c old mode 100644 new mode 100755 index 2cf4b8b54..e7d624d50 --- a/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.c +++ b/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.h b/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.h old mode 100644 new mode 100755 index 2ec87d263..7846485ce --- a/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.h +++ b/project/jni/sdl-1.3/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/sdlgenaudiocvt.pl b/project/jni/sdl-1.3/src/audio/sdlgenaudiocvt.pl index 0282a8adc..19a8c85dd 100755 --- a/project/jni/sdl-1.3/src/audio/sdlgenaudiocvt.pl +++ b/project/jni/sdl-1.3/src/audio/sdlgenaudiocvt.pl @@ -38,7 +38,7 @@ sub outputHeader { /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -404,11 +404,11 @@ EOF # Upsampling (growing the buffer) needs to work backwards, since we # overwrite the buffer as we go. if ($upsample) { - $endcomparison = '>'; # dst > target + $endcomparison = '>='; # dst > target print <buf + dstsize)) - $channels; const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf) - $channels; + const $fctype *target = ((const $fctype *) cvt->buf); EOF } else { $endcomparison = '<'; # dst < target @@ -544,11 +544,11 @@ EOF # Upsampling (growing the buffer) needs to work backwards, since we # overwrite the buffer as we go. if ($upsample) { - $endcomparison = '>'; # dst > target + $endcomparison = '>='; # dst > target print <buf + dstsize)) - $channels; + $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels * $multiple; const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf) - $channels; + const $fctype *target = ((const $fctype *) cvt->buf); EOF } else { $endcomparison = '<'; # dst < target @@ -611,28 +611,28 @@ EOF for (my $i = $channels-1; $i >= 0; $i--) { my $dsti = $i + ($channels * 3); print <= 0; $i--) { my $dsti = $i + ($channels * 2); print <= 0; $i--) { my $dsti = $i + ($channels * 1); print <= 0; $i--) { my $dsti = $i + ($channels * 0); print < + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/sun/SDL_sunaudio.h b/project/jni/sdl-1.3/src/audio/sun/SDL_sunaudio.h old mode 100644 new mode 100755 index f73e1d182..c90c646e6 --- a/project/jni/sdl-1.3/src/audio/sun/SDL_sunaudio.h +++ b/project/jni/sdl-1.3/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.c b/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.c old mode 100644 new mode 100755 index 019f7dff2..8df5843d0 --- a/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.c +++ b/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.h b/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.h old mode 100644 new mode 100755 index f68ed28d7..a69a26438 --- a/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.h +++ b/project/jni/sdl-1.3/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/audio/xaudio2/SDL_xaudio2.c b/project/jni/sdl-1.3/src/audio/xaudio2/SDL_xaudio2.c old mode 100644 new mode 100755 index a1230e4d7..b3651827f --- a/project/jni/sdl-1.3/src/audio/xaudio2/SDL_xaudio2.c +++ b/project/jni/sdl-1.3/src/audio/xaudio2/SDL_xaudio2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include /* XAudio2 exists as of the March 2008 DirectX SDK */ #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) -# warning Your DirectX SDK is too old. Disabling XAudio2 support. +# pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") #else # define SDL_XAUDIO2_HAS_SDK 1 #endif diff --git a/project/jni/sdl-1.3/src/core/windows/SDL_windows.c b/project/jni/sdl-1.3/src/core/windows/SDL_windows.c old mode 100644 new mode 100755 index a7c4425bb..4103d98d8 --- a/project/jni/sdl-1.3/src/core/windows/SDL_windows.c +++ b/project/jni/sdl-1.3/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/core/windows/SDL_windows.h b/project/jni/sdl-1.3/src/core/windows/SDL_windows.h old mode 100644 new mode 100755 index 604370ba4..ab21627d6 --- a/project/jni/sdl-1.3/src/core/windows/SDL_windows.h +++ b/project/jni/sdl-1.3/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/cpuinfo/SDL_cpuinfo.c b/project/jni/sdl-1.3/src/cpuinfo/SDL_cpuinfo.c old mode 100644 new mode 100755 index 379511c3a..294b1e4c7 --- a/project/jni/sdl-1.3/src/cpuinfo/SDL_cpuinfo.c +++ b/project/jni/sdl-1.3/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_clipboardevents.c b/project/jni/sdl-1.3/src/events/SDL_clipboardevents.c old mode 100644 new mode 100755 index ec3233bb8..2a7d0574d --- a/project/jni/sdl-1.3/src/events/SDL_clipboardevents.c +++ b/project/jni/sdl-1.3/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_clipboardevents_c.h b/project/jni/sdl-1.3/src/events/SDL_clipboardevents_c.h old mode 100644 new mode 100755 index bfdbd473a..689ac8e4e --- a/project/jni/sdl-1.3/src/events/SDL_clipboardevents_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_dropevents.c b/project/jni/sdl-1.3/src/events/SDL_dropevents.c old mode 100644 new mode 100755 index a84672b44..5a65e8dcc --- a/project/jni/sdl-1.3/src/events/SDL_dropevents.c +++ b/project/jni/sdl-1.3/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,7 @@ SDL_SendDropFile(const char *file) if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_DROPFILE; - event.drop.file = SDL_strdup(file); - + event.drop.file = SDL_strdup(file); posted = (SDL_PushEvent(&event) > 0); } return (posted); diff --git a/project/jni/sdl-1.3/src/events/SDL_dropevents_c.h b/project/jni/sdl-1.3/src/events/SDL_dropevents_c.h old mode 100644 new mode 100755 index 2bbe78dbf..3c13d4d51 --- a/project/jni/sdl-1.3/src/events/SDL_dropevents_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_events.c b/project/jni/sdl-1.3/src/events/SDL_events.c old mode 100644 new mode 100755 index 921c3d9e2..642db5d1a --- a/project/jni/sdl-1.3/src/events/SDL_events.c +++ b/project/jni/sdl-1.3/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -358,7 +358,7 @@ int SDL_PushEvent(SDL_Event * event) { SDL_EventWatcher *curr; - + event->window.timestamp = SDL_GetTicks(); if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) { return 0; } diff --git a/project/jni/sdl-1.3/src/events/SDL_events_c.h b/project/jni/sdl-1.3/src/events/SDL_events_c.h old mode 100644 new mode 100755 index dc936fe01..df3a5608d --- a/project/jni/sdl-1.3/src/events/SDL_events_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_gesture.c b/project/jni/sdl-1.3/src/events/SDL_gesture.c old mode 100644 new mode 100755 index 26732a198..428badc95 --- a/project/jni/sdl-1.3/src/events/SDL_gesture.c +++ b/project/jni/sdl-1.3/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_gesture_c.h b/project/jni/sdl-1.3/src/events/SDL_gesture_c.h old mode 100644 new mode 100755 index 1aabc13ac..fdb84ad85 --- a/project/jni/sdl-1.3/src/events/SDL_gesture_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_keyboard.c b/project/jni/sdl-1.3/src/events/SDL_keyboard.c old mode 100644 new mode 100755 index 6424de9db..366e0184e --- a/project/jni/sdl-1.3/src/events/SDL_keyboard.c +++ b/project/jni/sdl-1.3/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_keyboard_c.h b/project/jni/sdl-1.3/src/events/SDL_keyboard_c.h old mode 100644 new mode 100755 index 5b2aa4cdf..96a28ce2b --- a/project/jni/sdl-1.3/src/events/SDL_keyboard_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_mouse.c b/project/jni/sdl-1.3/src/events/SDL_mouse.c old mode 100644 new mode 100755 index a514e38d9..ff20a79ed --- a/project/jni/sdl-1.3/src/events/SDL_mouse.c +++ b/project/jni/sdl-1.3/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -323,9 +323,13 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) /* Set the relative mode */ mouse->relative_mode = enabled; - if (!enabled) { + if (enabled) { + /* Save the expected mouse position */ + mouse->original_x = mouse->x; + mouse->original_y = mouse->y; + } else if (mouse->focus) { /* Restore the expected mouse position */ - SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y); + SDL_WarpMouseInWindow(mouse->focus, mouse->original_x, mouse->original_y); } /* Flush pending mouse motion */ @@ -465,7 +469,11 @@ SDL_SetCursor(SDL_Cursor * cursor) } mouse->cur_cursor = cursor; } else { - cursor = mouse->cur_cursor; + if (mouse->focus) { + cursor = mouse->cur_cursor; + } else { + cursor = mouse->def_cursor; + } } if (cursor && mouse->cursor_shown && !mouse->relative_mode) { diff --git a/project/jni/sdl-1.3/src/events/SDL_mouse_c.h b/project/jni/sdl-1.3/src/events/SDL_mouse_c.h old mode 100644 new mode 100755 index 36e8d3d90..d571ddabd --- a/project/jni/sdl-1.3/src/events/SDL_mouse_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,6 +60,8 @@ typedef struct int last_x, last_y; /* the last reported x and y coordinates */ Uint8 buttonstate; SDL_bool relative_mode; + /* the x and y coordinates when relative mode was activated */ + int original_x, original_y; SDL_Cursor *cursors; SDL_Cursor *def_cursor; diff --git a/project/jni/sdl-1.3/src/events/SDL_quit.c b/project/jni/sdl-1.3/src/events/SDL_quit.c old mode 100644 new mode 100755 index 1a3aa003f..f65f69c1a --- a/project/jni/sdl-1.3/src/events/SDL_quit.c +++ b/project/jni/sdl-1.3/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_sysevents.h b/project/jni/sdl-1.3/src/events/SDL_sysevents.h old mode 100644 new mode 100755 index 7e214e81f..dfdf4d64c --- a/project/jni/sdl-1.3/src/events/SDL_sysevents.h +++ b/project/jni/sdl-1.3/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_touch.c b/project/jni/sdl-1.3/src/events/SDL_touch.c old mode 100644 new mode 100755 index 3dd301d1a..2e9cd10a7 --- a/project/jni/sdl-1.3/src/events/SDL_touch.c +++ b/project/jni/sdl-1.3/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,6 +141,7 @@ SDL_AddTouch(const SDL_Touch * touch, char *name) SDL_touchPads[index]->xres = (1<<(16-1)); SDL_touchPads[index]->yres = (1<<(16-1)); + SDL_touchPads[index]->pressureres = (1<<(16-1)); //Do I want this here? Probably SDL_GestureAddTouch(SDL_touchPads[index]); @@ -357,6 +358,8 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, event.tfinger.touchId = id; event.tfinger.x = x; event.tfinger.y = y; + event.tfinger.dx = 0; + event.tfinger.dy = 0; event.tfinger.pressure = pressure; event.tfinger.state = touch->buttonstate; event.tfinger.windowID = touch->focus ? touch->focus->id : 0; @@ -384,6 +387,7 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, event.tfinger.y = finger->y; event.tfinger.dx = 0; event.tfinger.dy = 0; + event.tfinger.pressure = pressure; if(SDL_DelFinger(touch,fingerid) < 0) return 0; posted = (SDL_PushEvent(&event) > 0); diff --git a/project/jni/sdl-1.3/src/events/SDL_touch_c.h b/project/jni/sdl-1.3/src/events/SDL_touch_c.h old mode 100644 new mode 100755 index 90cf4857e..17bbce07d --- a/project/jni/sdl-1.3/src/events/SDL_touch_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_windowevents.c b/project/jni/sdl-1.3/src/events/SDL_windowevents.c old mode 100644 new mode 100755 index 2d366bf86..fca48e3e5 --- a/project/jni/sdl-1.3/src/events/SDL_windowevents.c +++ b/project/jni/sdl-1.3/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/SDL_windowevents_c.h b/project/jni/sdl-1.3/src/events/SDL_windowevents_c.h old mode 100644 new mode 100755 index a0f399738..dac3e099e --- a/project/jni/sdl-1.3/src/events/SDL_windowevents_c.h +++ b/project/jni/sdl-1.3/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/blank_cursor.h b/project/jni/sdl-1.3/src/events/blank_cursor.h old mode 100644 new mode 100755 index 2bd5a3ea4..fdc4632ad --- a/project/jni/sdl-1.3/src/events/blank_cursor.h +++ b/project/jni/sdl-1.3/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/default_cursor.h b/project/jni/sdl-1.3/src/events/default_cursor.h old mode 100644 new mode 100755 index 1f22d6a75..ba68bf3c5 --- a/project/jni/sdl-1.3/src/events/default_cursor.h +++ b/project/jni/sdl-1.3/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/nds/SDL_ndsgesture.c b/project/jni/sdl-1.3/src/events/nds/SDL_ndsgesture.c old mode 100644 new mode 100755 index c6548000b..b729c7ee8 --- a/project/jni/sdl-1.3/src/events/nds/SDL_ndsgesture.c +++ b/project/jni/sdl-1.3/src/events/nds/SDL_ndsgesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/scancodes_darwin.h b/project/jni/sdl-1.3/src/events/scancodes_darwin.h old mode 100644 new mode 100755 index 8fc4e14fa..25d236f30 --- a/project/jni/sdl-1.3/src/events/scancodes_darwin.h +++ b/project/jni/sdl-1.3/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/scancodes_linux.h b/project/jni/sdl-1.3/src/events/scancodes_linux.h old mode 100644 new mode 100755 index 16a74b94b..05110d625 --- a/project/jni/sdl-1.3/src/events/scancodes_linux.h +++ b/project/jni/sdl-1.3/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/scancodes_windows.h b/project/jni/sdl-1.3/src/events/scancodes_windows.h old mode 100644 new mode 100755 index a5223f304..9028e0466 --- a/project/jni/sdl-1.3/src/events/scancodes_windows.h +++ b/project/jni/sdl-1.3/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/events/scancodes_xfree86.h b/project/jni/sdl-1.3/src/events/scancodes_xfree86.h old mode 100644 new mode 100755 index 4ff023102..f83385042 --- a/project/jni/sdl-1.3/src/events/scancodes_xfree86.h +++ b/project/jni/sdl-1.3/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/file/SDL_rwops.c b/project/jni/sdl-1.3/src/file/SDL_rwops.c old mode 100644 new mode 100755 index 540c783ec..d4868cc7a --- a/project/jni/sdl-1.3/src/file/SDL_rwops.c +++ b/project/jni/sdl-1.3/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,11 +31,9 @@ #include "cocoa/SDL_rwopsbundlesupport.h" #endif /* __APPLE__ */ -/* #ifdef ANDROID #include "../core/android/SDL_android.h" #endif -*/ #ifdef __NDS__ /* include libfat headers for fatInitDefault(). */ @@ -447,7 +445,7 @@ SDL_RWFromFile(const char *file, const char *mode) SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); return NULL; } -#if 0 && defined(__ANDROID__) +#if defined(ANDROID) rwops = SDL_AllocRW(); if (!rwops) return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ diff --git a/project/jni/sdl-1.3/src/haptic/SDL_haptic.c b/project/jni/sdl-1.3/src/haptic/SDL_haptic.c old mode 100644 new mode 100755 index db7dd1219..2ab4cbf4d --- a/project/jni/sdl-1.3/src/haptic/SDL_haptic.c +++ b/project/jni/sdl-1.3/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/SDL_haptic_c.h b/project/jni/sdl-1.3/src/haptic/SDL_haptic_c.h old mode 100644 new mode 100755 index d7e81105e..b937a2c9a --- a/project/jni/sdl-1.3/src/haptic/SDL_haptic_c.h +++ b/project/jni/sdl-1.3/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/SDL_syshaptic.h b/project/jni/sdl-1.3/src/haptic/SDL_syshaptic.h old mode 100644 new mode 100755 index b28e1a9cb..53871928f --- a/project/jni/sdl-1.3/src/haptic/SDL_syshaptic.h +++ b/project/jni/sdl-1.3/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/darwin/SDL_syshaptic.c b/project/jni/sdl-1.3/src/haptic/darwin/SDL_syshaptic.c old mode 100644 new mode 100755 index 0f771d72c..feb4309e7 --- a/project/jni/sdl-1.3/src/haptic/darwin/SDL_syshaptic.c +++ b/project/jni/sdl-1.3/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -426,7 +426,7 @@ SDL_SYS_HapticOpenFromService(SDL_Haptic * haptic, io_service_t service) /* Get supported features. */ ret2 = GetSupportedFeatures(haptic); - if (haptic->supported < 0) { + if (ret2 < 0) { goto open_err; } diff --git a/project/jni/sdl-1.3/src/haptic/dummy/SDL_syshaptic.c b/project/jni/sdl-1.3/src/haptic/dummy/SDL_syshaptic.c old mode 100644 new mode 100755 index b940b3b96..1d6eade16 --- a/project/jni/sdl-1.3/src/haptic/dummy/SDL_syshaptic.c +++ b/project/jni/sdl-1.3/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/linux/SDL_syshaptic.c b/project/jni/sdl-1.3/src/haptic/linux/SDL_syshaptic.c old mode 100644 new mode 100755 index 0df86a715..c73a60876 --- a/project/jni/sdl-1.3/src/haptic/linux/SDL_syshaptic.c +++ b/project/jni/sdl-1.3/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/nds/SDL_syshaptic.c b/project/jni/sdl-1.3/src/haptic/nds/SDL_syshaptic.c old mode 100644 new mode 100755 index d18aae27e..ddb8ecc75 --- a/project/jni/sdl-1.3/src/haptic/nds/SDL_syshaptic.c +++ b/project/jni/sdl-1.3/src/haptic/nds/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/haptic/windows/SDL_syshaptic.c b/project/jni/sdl-1.3/src/haptic/windows/SDL_syshaptic.c old mode 100644 new mode 100755 index 79a9ab9b1..86ab60372 --- a/project/jni/sdl-1.3/src/haptic/windows/SDL_syshaptic.c +++ b/project/jni/sdl-1.3/src/haptic/windows/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/SDL_joystick.c b/project/jni/sdl-1.3/src/joystick/SDL_joystick.c old mode 100644 new mode 100755 index 662763b35..9bc6e5864 --- a/project/jni/sdl-1.3/src/joystick/SDL_joystick.c +++ b/project/jni/sdl-1.3/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -427,6 +427,11 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) { int posted; + /* Make sure we're not getting garbage events */ + if (axis >= joystick->naxes) { + return 0; + } + /* Update internal joystick state */ joystick->axes[axis] = value; @@ -454,6 +459,11 @@ SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value) { int posted; + /* Make sure we're not getting garbage events */ + if (hat >= joystick->nhats) { + return 0; + } + /* Update internal joystick state */ joystick->hats[hat] = value; @@ -482,6 +492,11 @@ SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball, { int posted; + /* Make sure we're not getting garbage events */ + if (ball >= joystick->nballs) { + return 0; + } + /* Update internal mouse state */ joystick->balls[ball].dx += xrel; joystick->balls[ball].dy += yrel; @@ -526,6 +541,11 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state) } #endif /* !SDL_EVENTS_DISABLED */ + /* Make sure we're not getting garbage events */ + if (button >= joystick->nbuttons) { + return 0; + } + /* Update internal joystick state */ joystick->buttons[button] = state; diff --git a/project/jni/sdl-1.3/src/joystick/SDL_joystick_c.h b/project/jni/sdl-1.3/src/joystick/SDL_joystick_c.h old mode 100644 new mode 100755 index 49b9a3655..1705219c2 --- a/project/jni/sdl-1.3/src/joystick/SDL_joystick_c.h +++ b/project/jni/sdl-1.3/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/SDL_sysjoystick.h b/project/jni/sdl-1.3/src/joystick/SDL_sysjoystick.h old mode 100644 new mode 100755 index 5de8cc974..2a9b78595 --- a/project/jni/sdl-1.3/src/joystick/SDL_sysjoystick.h +++ b/project/jni/sdl-1.3/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/beos/SDL_bejoystick.cc b/project/jni/sdl-1.3/src/joystick/beos/SDL_bejoystick.cc old mode 100644 new mode 100755 index d78e66fbd..cae0ae188 --- a/project/jni/sdl-1.3/src/joystick/beos/SDL_bejoystick.cc +++ b/project/jni/sdl-1.3/src/joystick/beos/SDL_bejoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/bsd/SDL_sysjoystick.c b/project/jni/sdl-1.3/src/joystick/bsd/SDL_sysjoystick.c old mode 100644 new mode 100755 index 782b92daf..f46896c25 --- a/project/jni/sdl-1.3/src/joystick/bsd/SDL_sysjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -149,7 +149,7 @@ static char *joydevnames[MAX_JOYS]; static int report_alloc(struct report *, struct report_desc *, int); static void report_free(struct report *); -#if defined(USBHID_UCR_DATA) || defined(__FreeBSD_kernel__) +#if defined(USBHID_UCR_DATA) #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) #define REP_BUF_DATA(rep) ((rep)->buf->ugd_data) diff --git a/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick.c b/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick.c old mode 100644 new mode 100755 index c982465b2..ce7658407 --- a/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick_c.h b/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick_c.h old mode 100644 new mode 100755 index eeb2444e4..65dd814bf --- a/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/project/jni/sdl-1.3/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/dummy/SDL_sysjoystick.c b/project/jni/sdl-1.3/src/joystick/dummy/SDL_sysjoystick.c old mode 100644 new mode 100755 index 61d19823e..02bd5d751 --- a/project/jni/sdl-1.3/src/joystick/dummy/SDL_sysjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.h b/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.h old mode 100644 new mode 100755 index 02841e7f9..18cfd472e --- a/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.h +++ b/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.m b/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.m old mode 100644 new mode 100755 index 074d27282..c203b0025 --- a/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.m +++ b/project/jni/sdl-1.3/src/joystick/iphoneos/SDLUIAccelerationDelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/iphoneos/SDL_sysjoystick.m b/project/jni/sdl-1.3/src/joystick/iphoneos/SDL_sysjoystick.m old mode 100644 new mode 100755 index 48e0f62ec..9b3d29944 --- a/project/jni/sdl-1.3/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/project/jni/sdl-1.3/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick.c b/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick.c old mode 100644 new mode 100755 index 51cf8a407..1017f22f4 --- a/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick_c.h b/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick_c.h old mode 100644 new mode 100755 index dda9a9c73..a6c382f0e --- a/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick_c.h +++ b/project/jni/sdl-1.3/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/nds/SDL_sysjoystick.c b/project/jni/sdl-1.3/src/joystick/nds/SDL_sysjoystick.c old mode 100644 new mode 100755 index bd8202258..703734f57 --- a/project/jni/sdl-1.3/src/joystick/nds/SDL_sysjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/nds/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick.c b/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick.c old mode 100644 new mode 100755 index 6d9b44ff8..d73f66416 --- a/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -74,6 +74,7 @@ static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext); static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef); +static void SortDevObjects(SDL_Joystick *joystick); static Uint8 TranslatePOV(DWORD value); static int SDL_PrivateJoystickAxis_Int(SDL_Joystick * joystick, Uint8 axis, Sint16 value); @@ -483,6 +484,10 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) EnumDevObjectsCallback, joystick, DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV); + /* Reorder the input objects. Some devices do not report the X axis as + * the first axis, for example. */ + SortDevObjects(joystick); + dipdw.diph.dwObj = 0; dipdw.diph.dwHow = DIPH_DEVICE; dipdw.dwData = INPUT_QSIZE; @@ -504,6 +509,55 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) return (0); } +/* Sort using the data offset into the DInput struct. + * This gives a reasonable ordering for the inputs. */ +static int +SortDevFunc(const void *a, const void *b) +{ + const input_t *inputA = (const input_t*)a; + const input_t *inputB = (const input_t*)b; + + if (inputA->ofs < inputB->ofs) + return -1; + if (inputA->ofs > inputB->ofs) + return 1; + return 0; +} + +/* Sort the input objects and recalculate the indices for each input. */ +static void +SortDevObjects(SDL_Joystick *joystick) +{ + input_t *inputs = joystick->hwdata->Inputs; + int nButtons = 0; + int nHats = 0; + int nAxis = 0; + int n; + + SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc); + + for (n = 0; n < joystick->hwdata->NumInputs; n++) + { + switch (inputs[n].type) + { + case BUTTON: + inputs[n].num = nButtons; + nButtons++; + break; + + case HAT: + inputs[n].num = nHats; + nHats++; + break; + + case AXIS: + inputs[n].num = nAxis; + nAxis++; + break; + } + } +} + static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) { diff --git a/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick_c.h b/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick_c.h old mode 100644 new mode 100755 index 8a6952bd9..1aa993486 --- a/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick_c.h +++ b/project/jni/sdl-1.3/src/joystick/windows/SDL_dxjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/joystick/windows/SDL_mmjoystick.c b/project/jni/sdl-1.3/src/joystick/windows/SDL_mmjoystick.c old mode 100644 new mode 100755 index 49b9b174f..5298c537b --- a/project/jni/sdl-1.3/src/joystick/windows/SDL_mmjoystick.c +++ b/project/jni/sdl-1.3/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/libm/math_libm.h b/project/jni/sdl-1.3/src/libm/math_libm.h index 6c1f8e9d7..23e1f73d9 100644 --- a/project/jni/sdl-1.3/src/libm/math_libm.h +++ b/project/jni/sdl-1.3/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/loadso/beos/SDL_sysloadso.c b/project/jni/sdl-1.3/src/loadso/beos/SDL_sysloadso.c old mode 100644 new mode 100755 index ea58428aa..3c0a829b2 --- a/project/jni/sdl-1.3/src/loadso/beos/SDL_sysloadso.c +++ b/project/jni/sdl-1.3/src/loadso/beos/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/loadso/dlopen/SDL_sysloadso.c b/project/jni/sdl-1.3/src/loadso/dlopen/SDL_sysloadso.c old mode 100644 new mode 100755 index 908e677a2..5ee579b32 --- a/project/jni/sdl-1.3/src/loadso/dlopen/SDL_sysloadso.c +++ b/project/jni/sdl-1.3/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/loadso/dummy/SDL_sysloadso.c b/project/jni/sdl-1.3/src/loadso/dummy/SDL_sysloadso.c old mode 100644 new mode 100755 index 155288935..d89f5dbda --- a/project/jni/sdl-1.3/src/loadso/dummy/SDL_sysloadso.c +++ b/project/jni/sdl-1.3/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/loadso/windows/SDL_sysloadso.c b/project/jni/sdl-1.3/src/loadso/windows/SDL_sysloadso.c old mode 100644 new mode 100755 index cd5d1012a..8b465a5e1 --- a/project/jni/sdl-1.3/src/loadso/windows/SDL_sysloadso.c +++ b/project/jni/sdl-1.3/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/main/android/SDL_android_main.cpp b/project/jni/sdl-1.3/src/main/android/SDL_android_main.cpp new file mode 100644 index 000000000..126963cf0 --- /dev/null +++ b/project/jni/sdl-1.3/src/main/android/SDL_android_main.cpp @@ -0,0 +1,42 @@ + +#include "SDL_config.h" + +#ifdef __ANDROID__ + +/* Include the SDL main definition header */ +#include "SDL_main.h" + +/******************************************************************************* + Functions called by JNI +*******************************************************************************/ +#include + +// Called before SDL_main() to initialize JNI bindings in SDL library +extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls); + +// Library init +extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) +{ + return JNI_VERSION_1_4; +} + +// Start up the SDL app +extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj) +{ + /* This interface could expand with ABI negotiation, calbacks, etc. */ + SDL_Android_Init(env, cls); + + /* Run the application code! */ + int status; + char *argv[2]; + argv[0] = strdup("SDL_app"); + argv[1] = NULL; + status = SDL_main(1, argv); + + /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ + //exit(status); +} + +#endif /* __ANDROID__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/src/main/beos/SDL_BApp.h b/project/jni/sdl-1.3/src/main/beos/SDL_BApp.h old mode 100644 new mode 100755 index 9f9d5a25f..2c9377716 --- a/project/jni/sdl-1.3/src/main/beos/SDL_BApp.h +++ b/project/jni/sdl-1.3/src/main/beos/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.cc b/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.cc old mode 100644 new mode 100755 index 33a7330be..7524d8939 --- a/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.cc +++ b/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.h b/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.h old mode 100644 new mode 100755 index 7d95e32be..60012d34a --- a/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.h +++ b/project/jni/sdl-1.3/src/main/beos/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/main/dummy/SDL_dummy_main.c b/project/jni/sdl-1.3/src/main/dummy/SDL_dummy_main.c index e5a1351f1..87955239a 100644 --- a/project/jni/sdl-1.3/src/main/dummy/SDL_dummy_main.c +++ b/project/jni/sdl-1.3/src/main/dummy/SDL_dummy_main.c @@ -1,5 +1,6 @@ /* Include the SDL main definition header */ +#include "SDL_config.h" #include "SDL_main.h" #ifdef main diff --git a/project/jni/sdl-1.3/src/main/windows/version.rc b/project/jni/sdl-1.3/src/main/windows/version.rc index fd398aaca..9f03fe72b 100644 --- a/project/jni/sdl-1.3/src/main/windows/version.rc +++ b/project/jni/sdl-1.3/src/main/windows/version.rc @@ -25,7 +25,7 @@ BEGIN VALUE "FileDescription", "SDL\0" VALUE "FileVersion", "1, 3, 0, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2009 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2012 Sam Lantinga\0" VALUE "OriginalFilename", "SDL.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" VALUE "ProductVersion", "1, 3, 0, 0\0" diff --git a/project/jni/sdl-1.3/src/power/SDL_power.c b/project/jni/sdl-1.3/src/power/SDL_power.c old mode 100644 new mode 100755 index 024f7df7e..9c6d62b47 --- a/project/jni/sdl-1.3/src/power/SDL_power.c +++ b/project/jni/sdl-1.3/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/beos/SDL_syspower.c b/project/jni/sdl-1.3/src/power/beos/SDL_syspower.c old mode 100644 new mode 100755 index eb49628b5..84a9257bc --- a/project/jni/sdl-1.3/src/power/beos/SDL_syspower.c +++ b/project/jni/sdl-1.3/src/power/beos/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/linux/SDL_syspower.c b/project/jni/sdl-1.3/src/power/linux/SDL_syspower.c old mode 100644 new mode 100755 index 2e409488c..321bbfc6f --- a/project/jni/sdl-1.3/src/power/linux/SDL_syspower.c +++ b/project/jni/sdl-1.3/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/macosx/SDL_syspower.c b/project/jni/sdl-1.3/src/power/macosx/SDL_syspower.c old mode 100644 new mode 100755 index b76b5c650..8de22bea4 --- a/project/jni/sdl-1.3/src/power/macosx/SDL_syspower.c +++ b/project/jni/sdl-1.3/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/nds/SDL_syspower.c b/project/jni/sdl-1.3/src/power/nds/SDL_syspower.c old mode 100644 new mode 100755 index e0a92f235..c40a1c2a4 --- a/project/jni/sdl-1.3/src/power/nds/SDL_syspower.c +++ b/project/jni/sdl-1.3/src/power/nds/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.h b/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.h old mode 100644 new mode 100755 index 2bec9e171..14bc75004 --- a/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.h +++ b/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.m b/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.m old mode 100644 new mode 100755 index 2766ef5dd..db5d11036 --- a/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.m +++ b/project/jni/sdl-1.3/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/power/windows/SDL_syspower.c b/project/jni/sdl-1.3/src/power/windows/SDL_syspower.c old mode 100644 new mode 100755 index 0d75a2bcc..0ebb56aec --- a/project/jni/sdl-1.3/src/power/windows/SDL_syspower.c +++ b/project/jni/sdl-1.3/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/SDL_render.c b/project/jni/sdl-1.3/src/render/SDL_render.c old mode 100644 new mode 100755 index e839469dc..01dd0a1d8 --- a/project/jni/sdl-1.3/src/render/SDL_render.c +++ b/project/jni/sdl-1.3/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,6 @@ #include "SDL_render.h" #include "SDL_sysrender.h" #include "software/SDL_render_sw_c.h" -#include #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" @@ -101,28 +100,82 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) renderer->WindowEvent(renderer, &event->window); } - if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { + if (event->window.event == SDL_WINDOWEVENT_RESIZED) { /* Try to keep the previous viewport centered */ int w, h; SDL_Rect viewport; SDL_GetWindowSize(window, &w, &h); - viewport.x = (w - renderer->viewport.w) / 2; - viewport.y = (h - renderer->viewport.h) / 2; - viewport.w = renderer->viewport.w; - viewport.h = renderer->viewport.h; - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_RendererEventWatch(): window %p size %dx%d", window, w, h); - SDL_RenderSetViewport(renderer, &viewport); + if (renderer->target) { + renderer->viewport_backup.x = (w - renderer->viewport_backup.w) / 2; + renderer->viewport_backup.y = (h - renderer->viewport_backup.h) / 2; + } else { + viewport.x = (w - renderer->viewport.w) / 2; + viewport.y = (h - renderer->viewport.h) / 2; + viewport.w = renderer->viewport.w; + viewport.h = renderer->viewport.h; + SDL_RenderSetViewport(renderer, &viewport); + } + renderer->resized = SDL_TRUE; + } else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { + int w, h; + SDL_Rect viewport; + + if (!renderer->resized) { + /* Window was programmatically resized, reset viewport */ + SDL_GetWindowSize(window, &w, &h); + if (renderer->target) { + renderer->viewport_backup.x = 0; + renderer->viewport_backup.y = 0; + renderer->viewport_backup.w = w; + renderer->viewport_backup.h = h; + } else { + viewport.x = 0; + viewport.y = 0; + viewport.w = w; + viewport.h = h; + SDL_RenderSetViewport(renderer, &viewport); + } + renderer->resized = SDL_FALSE; + } + } else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) { + renderer->hidden = SDL_TRUE; + } else if (event->window.event == SDL_WINDOWEVENT_SHOWN) { + if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) { + renderer->hidden = SDL_FALSE; + } } else if (event->window.event == SDL_WINDOWEVENT_MINIMIZED) { - renderer->minimized = SDL_TRUE; + renderer->hidden = SDL_TRUE; } else if (event->window.event == SDL_WINDOWEVENT_RESTORED) { - renderer->minimized = SDL_FALSE; + if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) { + renderer->hidden = SDL_FALSE; + } } } } return 0; } +int +SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, + SDL_Window **window, SDL_Renderer **renderer) +{ + *window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, height, window_flags); + if (!*window) { + *renderer = NULL; + return -1; + } + + *renderer = SDL_CreateRenderer(*window, -1, 0); + if (!*renderer) { + return -1; + } + + return 0; +} + SDL_Renderer * SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) { @@ -195,10 +248,10 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) renderer->magic = &renderer_magic; renderer->window = window; - if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) { - renderer->minimized = SDL_TRUE; + if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { + renderer->hidden = SDL_TRUE; } else { - renderer->minimized = SDL_FALSE; + renderer->hidden = SDL_FALSE; } SDL_SetWindowData(window, SDL_WINDOWRENDERDATA, renderer); @@ -798,6 +851,72 @@ SDL_UnlockTexture(SDL_Texture * texture) } } +SDL_bool +SDL_RenderTargetSupported(SDL_Renderer *renderer) +{ + if (!renderer || !renderer->SetRenderTarget) { + return SDL_FALSE; + } + return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0; +} + +int +SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) +{ + SDL_Rect viewport; + + if (!SDL_RenderTargetSupported(renderer)) { + SDL_Unsupported(); + return -1; + } + if (texture == renderer->target) { + /* Nothing to do! */ + return 0; + } + + /* texture == NULL is valid and means reset the target to the window */ + if (texture) { + CHECK_TEXTURE_MAGIC(texture, -1); + if (renderer != texture->renderer) { + SDL_SetError("Texture was not created with this renderer"); + return -1; + } + if (!(texture->access & SDL_TEXTUREACCESS_TARGET)) { + SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET"); + return -1; + } + if (texture->native) { + /* Always render to the native texture */ + texture = texture->native; + } + } + + if (texture && !renderer->target) { + /* Make a backup of the viewport */ + renderer->viewport_backup = renderer->viewport; + } + renderer->target = texture; + + if (renderer->SetRenderTarget(renderer, texture) < 0) { + return -1; + } + + if (texture) { + viewport.x = 0; + viewport.y = 0; + viewport.w = texture->w; + viewport.h = texture->h; + } else { + viewport = renderer->viewport_backup; + } + if (SDL_RenderSetViewport(renderer, &viewport) < 0) { + return -1; + } + + /* All set! */ + return 0; +} + int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) { @@ -885,8 +1004,8 @@ SDL_RenderClear(SDL_Renderer * renderer) { CHECK_RENDERER_MAGIC(renderer, -1); - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } return renderer->RenderClear(renderer); @@ -915,8 +1034,8 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, if (count < 1) { return 0; } - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } return renderer->RenderDrawPoints(renderer, points, count); @@ -947,8 +1066,8 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, if (count < 2) { return 0; } - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } return renderer->RenderDrawLines(renderer, points, count); @@ -1000,8 +1119,8 @@ SDL_RenderDrawRects(SDL_Renderer * renderer, return 0; } - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } for (i = 0; i < count; ++i) { @@ -1016,9 +1135,9 @@ int SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect) { SDL_Rect full_rect; - + CHECK_RENDERER_MAGIC(renderer, -1); - + /* If 'rect' == NULL, then outline the whole surface */ if (!rect) { full_rect.x = 0; @@ -1043,8 +1162,8 @@ SDL_RenderFillRects(SDL_Renderer * renderer, if (count < 1) { return 0; } - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } return renderer->RenderFillRects(renderer, rects, count); @@ -1104,8 +1223,8 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, texture = texture->native; } - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return 0; } return renderer->RenderCopy(renderer, texture, &real_srcrect, @@ -1157,8 +1276,8 @@ SDL_RenderPresent(SDL_Renderer * renderer) { CHECK_RENDERER_MAGIC(renderer, ); - /* Don't draw while we're minimized */ - if (renderer->minimized) { + /* Don't draw while we're hidden */ + if (renderer->hidden) { return; } renderer->RenderPresent(renderer); diff --git a/project/jni/sdl-1.3/src/render/SDL_sysrender.h b/project/jni/sdl-1.3/src/render/SDL_sysrender.h old mode 100644 new mode 100755 index 368dfc4e3..89fa5005f --- a/project/jni/sdl-1.3/src/render/SDL_sysrender.h +++ b/project/jni/sdl-1.3/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,6 +77,7 @@ struct SDL_Renderer int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture); + int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture); int (*UpdateViewport) (SDL_Renderer * renderer); int (*RenderClear) (SDL_Renderer * renderer); int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points, @@ -99,13 +100,16 @@ struct SDL_Renderer /* The window associated with the renderer */ SDL_Window *window; - SDL_bool minimized; + SDL_bool hidden; + SDL_bool resized; /* The drawable area within the window */ SDL_Rect viewport; + SDL_Rect viewport_backup; /* The list of textures */ SDL_Texture *textures; + SDL_Texture *target; Uint8 r, g, b, a; /**< Color for drawing operations values */ SDL_BlendMode blendMode; /**< The drawing blend mode */ diff --git a/project/jni/sdl-1.3/src/render/SDL_yuv_mmx.c b/project/jni/sdl-1.3/src/render/SDL_yuv_mmx.c old mode 100644 new mode 100755 index 4f9a9d369..9d50dd6af --- a/project/jni/sdl-1.3/src/render/SDL_yuv_mmx.c +++ b/project/jni/sdl-1.3/src/render/SDL_yuv_mmx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/SDL_yuv_sw.c b/project/jni/sdl-1.3/src/render/SDL_yuv_sw.c old mode 100644 new mode 100755 index a42b62c0b..2f8172d13 --- a/project/jni/sdl-1.3/src/render/SDL_yuv_sw.c +++ b/project/jni/sdl-1.3/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1119,15 +1119,48 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, switch (swdata->format) { case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: - if (rect - && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w - || rect->h != swdata->h)) { - SDL_SetError - ("YV12 and IYUV textures only support full surface updates"); - return -1; + if (rect->x == 0 && rect->y == 0 && + rect->w == swdata->w && rect->h == swdata->h) { + SDL_memcpy(swdata->pixels, pixels, + (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2); + } else { + Uint8 *src, *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = (Uint8 *) pixels; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->w; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch; + dst = swdata->pixels + swdata->h * swdata->w; + dst += rect->y/2 * swdata->w/2 + rect->x/2; + length = rect->w / 2; + for (row = 0; row < rect->h/2; ++row) { + SDL_memcpy(dst, src, length); + src += pitch/2; + dst += swdata->w/2; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch + (rect->h * pitch) / 4; + dst = swdata->pixels + swdata->h * swdata->w + + (swdata->h * swdata->w) / 4; + dst += rect->y/2 * swdata->w/2 + rect->x/2; + length = rect->w / 2; + for (row = 0; row < rect->h/2; ++row) { + SDL_memcpy(dst, src, length); + src += pitch/2; + dst += swdata->w/2; + } } - SDL_memcpy(swdata->pixels, pixels, - (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2); break; case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: diff --git a/project/jni/sdl-1.3/src/render/SDL_yuv_sw_c.h b/project/jni/sdl-1.3/src/render/SDL_yuv_sw_c.h old mode 100644 new mode 100755 index 94c91af99..28a25514a --- a/project/jni/sdl-1.3/src/render/SDL_yuv_sw_c.h +++ b/project/jni/sdl-1.3/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/direct3d/SDL_render_d3d.c b/project/jni/sdl-1.3/src/render/direct3d/SDL_render_d3d.c old mode 100644 new mode 100755 index 974796a15..e058144d1 --- a/project/jni/sdl-1.3/src/render/direct3d/SDL_render_d3d.c +++ b/project/jni/sdl-1.3/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,6 +99,7 @@ static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_UpdateViewport(SDL_Renderer * renderer); static int D3D_RenderClear(SDL_Renderer * renderer); static int D3D_RenderDrawPoints(SDL_Renderer * renderer, @@ -121,7 +122,7 @@ SDL_RenderDriver D3D_RenderDriver = { D3D_CreateRenderer, { "direct3d", - (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), 1, {SDL_PIXELFORMAT_ARGB8888}, 0, @@ -138,6 +139,8 @@ typedef struct SDL_bool updateSize; SDL_bool beginScene; D3DTEXTUREFILTERTYPE scaleMode; + IDirect3DSurface9 *defaultRenderTarget; + IDirect3DSurface9 *currentRenderTarget; } D3D_RenderData; typedef struct @@ -385,6 +388,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = D3D_UpdateTexture; renderer->LockTexture = D3D_LockTexture; renderer->UnlockTexture = D3D_UnlockTexture; + renderer->SetRenderTarget = D3D_SetRenderTarget; renderer->UpdateViewport = D3D_UpdateViewport; renderer->RenderClear = D3D_RenderClear; renderer->RenderDrawPoints = D3D_RenderDrawPoints; @@ -441,11 +445,11 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) result = IDirect3D9_CreateDevice(data->d3d, data->adapter, D3DDEVTYPE_HAL, pparams.hDeviceWindow, - (caps. + D3DCREATE_FPU_PRESERVE | ((caps. DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) ? D3DCREATE_HARDWARE_VERTEXPROCESSING : - D3DCREATE_SOFTWARE_VERTEXPROCESSING, + D3DCREATE_SOFTWARE_VERTEXPROCESSING), &pparams, &data->device); if (FAILED(result)) { D3D_DestroyRenderer(renderer); @@ -478,6 +482,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) IDirect3DDevice9_GetDeviceCaps(data->device, &caps); renderer->info.max_texture_width = caps.MaxTextureWidth; renderer->info.max_texture_height = caps.MaxTextureHeight; + if (caps.NumSimultaneousRTs >= 2) { + renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE; + } /* Set up parameters for rendering */ IDirect3DDevice9_SetVertexShader(data->device, NULL); @@ -507,6 +514,10 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) IDirect3DDevice9_SetTextureStageState(data->device, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); + /* Store the default render target */ + IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget ); + data->currentRenderTarget = NULL; + /* Set an identity world and view matrix */ matrix.m[0][0] = 1.0f; matrix.m[0][1] = 0.0f; @@ -580,7 +591,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) usage = D3DUSAGE_DYNAMIC; } else #endif - { + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + /* D3DPOOL_MANAGED does not work with D3DUSAGE_RENDERTARGET */ + pool = D3DPOOL_DEFAULT; + usage = D3DUSAGE_RENDERTARGET; + } else { pool = D3DPOOL_MANAGED; usage = 0; } @@ -718,6 +733,41 @@ D3D_UpdateViewport(SDL_Renderer * renderer) return 0; } +static int +D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + D3D_TextureData *texturedata; + HRESULT result; + + D3D_ActivateRenderer(renderer); + + /* Release the previous render target if it wasn't the default one */ + if (data->currentRenderTarget != NULL) { + IDirect3DSurface9_Release(data->currentRenderTarget); + data->currentRenderTarget = NULL; + } + + if (texture == NULL) { + IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget); + return 0; + } + + texturedata = (D3D_TextureData *) texture->driverdata; + result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture, 0, &data->currentRenderTarget); + if(FAILED(result)) { + D3D_SetError("GetSurfaceLevel()", result); + return -1; + } + result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget); + if(FAILED(result)) { + D3D_SetError("SetRenderTarget()", result); + return -1; + } + + return 0; +} + static int D3D_RenderClear(SDL_Renderer * renderer) { @@ -1187,6 +1237,13 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; if (data) { + // Release the render target + IDirect3DSurface9_Release(data->defaultRenderTarget); + if (data->currentRenderTarget != NULL) { + IDirect3DSurface9_Release(data->currentRenderTarget); + data->currentRenderTarget = NULL; + } + if (data->device) { IDirect3DDevice9_Release(data->device); } diff --git a/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.c b/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.c new file mode 100644 index 000000000..7ba9be072 --- /dev/null +++ b/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.c @@ -0,0 +1,315 @@ +/* + * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, + * with permission of the original author. The following is mostly his + * code/comments. + * + * + * Easy GL2D + * + * Relminator 2010 + * Richard Eric M. Lope BSN RN + * + * http://rel.betterwebber.com + * + * A very small and simple DS rendering lib using the 3d core to render 2D stuff + */ +#include "SDL_config.h" + +#if SDL_VIDEO_RENDER_NDS + +#include "SDL_libgl2D.h" + +/* + * Our static global variable used for Depth values since we cannot + * disable depth testing in the DS hardware This value is incremented + * for every draw call. */ +v16 g_depth; +int gCurrentTexture; + +/* + * !!! PRIVATE !!! Set orthographic projection at 1:1 correspondence + * to screen coords glOrtho expects f32 values but if we use the + * standard f32 values, we need to rescale either every vert or the + * modelview matrix by the same amount to make it work. That's gonna + * give us lots of overflows and headaches. So we "scale down" and + * use an all integer value. + */ +void SetOrtho(void) +{ + glMatrixMode(GL_PROJECTION); // set matrixmode to projection + glLoadIdentity(); // reset + glOrthof32(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1 << 12, 1 << 12); // downscale projection matrix +} + +/* + * Initializes GL in 2D mode Also initializes GL in 3d mode so that we + * could combine 2D and 3D later Almost a direct copy from the DS + * example files + */ +void glScreen2D(void) +{ + // initialize gl + glInit(); + + // enable textures + glEnable(GL_TEXTURE_2D); + + // enable antialiasing + glEnable(GL_ANTIALIAS); + + // setup the rear plane + glClearColor(0, 0, 0, 31); // BG must be opaque for AA to work + glClearPolyID(63); // BG must have a unique polygon ID for AA to work + + glClearDepth(GL_MAX_DEPTH); + + // this should work the same as the normal gl call + glViewport(0,0,255,191); + + // any floating point gl call is being converted to fixed prior to being implemented + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(70, 256.0 / 192.0, 1, 200); + + gluLookAt( 0.0, 0.0, 1.0, //camera possition + 0.0, 0.0, 0.0, //look at + 0.0, 1.0, 0.0); //up + + glMaterialf(GL_AMBIENT, RGB15(31,31,31)); + glMaterialf(GL_DIFFUSE, RGB15(31,31,31)); + glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31)); + glMaterialf(GL_EMISSION, RGB15(31,31,31)); + + // ds uses a table for shinyness..this generates a half-ass one + glMaterialShinyness(); + + // not a real gl function and will likely change + glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK); +} + +/* + * Sets up OpenGL for 2d rendering Call this before drawing any of + * GL2D's drawing or sprite functions. + */ +void glBegin2D(void) +{ + // save 3d perpective projection matrix + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + // save 3d modelview matrix for safety + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + + // what?!! No glDisable(GL_DEPTH_TEST)?!!!!!! + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glDisable(GL_ANTIALIAS); // disable AA + glDisable(GL_OUTLINE); // disable edge-marking + + glColor(0x7FFF); // max color + + glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); // no culling + + SetOrtho(); + + glMatrixMode(GL_TEXTURE); // reset texture matrix just in case we did some funky stuff with it + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); // reset modelview matrix. No need to scale up by << 12 + glLoadIdentity(); + + gCurrentTexture = 0; // set current texture to 0 + g_depth = 0; // set depth to 0. We need this var since we cannot disable depth testing +} + +/* + * Issue this after drawing 2d so that we don't mess the matrix stack. + * The complement of glBegin2D. + */ +void glEnd2D(void) +{ + // restore 3d matrices and set current matrix to modelview + glMatrixMode(GL_PROJECTION); + glPopMatrix(1); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(1); +} + +/* + * Draws a pixel + * Parameters: + * x,y -> First coordinate of the line + * color -> RGB15/ARGB16 color + */ +void glPutPixel(int x, int y, int color) +{ + glBindTexture(0, 0); + glColor(color); + glBegin(GL_TRIANGLES); + gxVertex3i(x, y, g_depth); + gxVertex2i(x, y); + gxVertex2i(x, y); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * Draws a line + * Parameters: + * x1,y1 -> First coordinate of the line + * x2,y2 -> Second coordinate of the line + * color -> RGB15/ARGB16 color + */ +void glLine(int x1, int y1, int x2, int y2, int color) +{ + x2++; + y2++; + + glBindTexture(0, 0); + glColor(color); + glBegin(GL_TRIANGLES); + gxVertex3i(x1, y1, g_depth); + gxVertex2i(x2, y2); + gxVertex2i(x2, y2); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * Draws a Filled Box + * Parameters: + * x1,y1 -> Top-left corner of the box + * x2,y2 -> Bottom-Right corner of the box + * color -> RGB15/ARGB16 color +*/ +void glBoxFilled(int x1, int y1, int x2, int y2, int color) +{ + x2++; + y2++; + + glBindTexture(0, 0); + glColor(color); + glBegin(GL_QUADS); + gxVertex3i(x1, y1, g_depth); // use 3i for first vertex so that we increment HW depth + gxVertex2i(x1, y2); // no need for 3 vertices as 2i would share last depth call + gxVertex2i(x2, y2); + gxVertex2i(x2, y1); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * + * Create a tile. + * Very rigid and prone to human error. + * + * Parameters: + * *sprite -> pointer to a glImage + * texture_width -> width/height of the texture; + * texture_height -> valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d) + * sprite_width + * sprite_height -> width/height of the picture in the texture. + * type -> The format of the texture (see glTexImage2d) + * param -> parameters for the texture (see glTexImage2d) + */ +int glLoadTile(glImage *sprite, + int texture_width, + int texture_height, + int sprite_width, + int sprite_height, + GL_TEXTURE_TYPE_ENUM type, + int param, + int pallette_width, + const u16 *palette, + const uint8 *texture) +{ + int textureID; + + glGenTextures(1, &textureID); + glBindTexture(0, textureID); + glTexImage2D(0, 0, type, texture_width, texture_height, 0, param, texture); + glColorTableEXT(0, 0, pallette_width, 0, 0, palette); + + sprite->width = sprite_width; + sprite->height = sprite_height; + sprite->textureID = textureID; + + return textureID; +} + +/* + * I made this since the scale wrappers are either the vectorized mode + * or does not permit you to scale only the axis you want to + * scale. Needed for sprite scaling. + */ +static inline void gxScalef32(s32 x, s32 y, s32 z) +{ + MATRIX_SCALE = x; + MATRIX_SCALE = y; + MATRIX_SCALE = z; +} + +/* + * I this made for future naming conflicts. + */ +static inline void gxTranslate3f32(int32 x, int32 y, int32 z) +{ + MATRIX_TRANSLATE = x; + MATRIX_TRANSLATE = y; + MATRIX_TRANSLATE = z; +} + +/* + * Draws an axis exclusive scaled sprite + * Parameters: + * x -> x position of the sprite + * y -> y position of the sprite + * scaleX -> 20.12 FP X axis scale value (1 << 12 is normal) + * scaleY -> 20.12 FP Y axis scale value (1 << 12 is normal) + * flipmode -> mode for flipping (see GL_FLIP_MODE enum) + * *spr -> pointer to a glImage + */ +void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr) +{ + const int x1 = 0; + const int y1 = 0; + const int x2 = spr->width; + const int y2 = spr->height; + const int u1 = ((flipmode & GL_FLIP_H) ? spr->width-1 : 0); + const int u2 = ((flipmode & GL_FLIP_H) ? 0 : spr->width-1); + const int v1 = ((flipmode & GL_FLIP_V) ? spr->height-1 : 0); + const int v2 = ((flipmode & GL_FLIP_V) ? 0 : spr->height-1); + + if (spr->textureID != gCurrentTexture) + { + glBindTexture(GL_TEXTURE_2D, spr->textureID); + gCurrentTexture = spr->textureID; + } + + glPushMatrix(); + + gxTranslate3f32(x, y, 0); + gxScalef32(scaleX, scaleY, 1 << 12); + + glBegin(GL_QUADS); + + gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth); + gxTexcoord2i(u1, v2); gxVertex2i(x1, y2); + gxTexcoord2i(u2, v2); gxVertex2i(x2, y2); + gxTexcoord2i(u2, v1); gxVertex2i(x2, y1); + + glEnd(); + + glPopMatrix(1); + g_depth++; +} + +#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.h b/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.h new file mode 100644 index 000000000..4d56f0e89 --- /dev/null +++ b/project/jni/sdl-1.3/src/render/nds/SDL_libgl2D.h @@ -0,0 +1,154 @@ +/* + * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, + * with permission of the original author. The following is mostly his + * code/comments. + * + * + * Easy GL2D + * + * Relminator 2010 + * Richard Eric M. Lope BSN RN + * + * http://rel.betterwebber.com + * + * A very small and simple DS rendering lib using the 3d core to render 2D stuff + */ +#include "SDL_config.h" + +#if SDL_VIDEO_RENDER_NDS + +#include + +/* LibGL extension(s) */ +static inline void gxTexcoord2i(t16 u, t16 v) +{ + GFX_TEX_COORD = (v << 20) | ((u << 4) & 0xFFFF); +} + +static inline void gxVertex3i(v16 x, v16 y, v16 z) +{ + GFX_VERTEX16 = (y << 16) | (x & 0xFFFF); + GFX_VERTEX16 = ((uint32)(uint16)z); +} + +static inline void gxVertex2i(v16 x, v16 y) +{ + GFX_VERTEX_XY = (y << 16) | (x & 0xFFFF); +} + +/* + * Enums selecting flipping mode. + * + * These enums are bits for flipping the sprites. + * You can "|" (or) GL_FLIP_V and GL_FLIP_H to flip + * both ways. + */ +typedef enum +{ + GL_FLIP_NONE = (1 << 0), /* No flipping */ + GL_FLIP_V = (1 << 1), /* Sprite is rendered vertically flipped */ + GL_FLIP_H = (1 << 2), /* Sprite is rendered horizontally flipped */ +} GL_FLIP_MODE; + +/* Struct for out GL-Based Images. */ +typedef struct +{ + int width; /* Width of the Sprite */ + int height; /* Height of the Sprite */ + int textureID; /* Texture handle (used in glDeleteTextures()) + The texture handle in VRAM (returned by glGenTextures()) + ie. This references the actual texture stored in VRAM. */ +} glImage; + +extern v16 g_depth; +extern int gCurrentTexture; + +/* + * Draws an Axis Exclusive Scaled Sprite + * Parameters: + * x X position of the sprite. + * y Y position of the sprite. + * scaleX 20.12 fixed-point X-Axis scale value (1 << 12 is normal). + * scaleY 20.12 fixed-point Y-Axis scale value (1 << 12 is normal). + * flipmode mode for flipping (see GL_FLIP_MODE enum). + * *spr pointer to a glImage. +*/ +void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr); + +/* Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files. + * Can only be used when tiles in a tilset are of the same dimensions. + * Parameters: + * *sprite Pointer to an array of glImage. + * tile_wid Width of each tile in the texture. + * tile_hei Height of each tile in the texture. + * bmp_wid Width of of the texture or tileset. + * bmp_hei height of of the texture or tileset. + * type The format of the texture (see glTexImage2d()). + * sizeX The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). + * sizeY The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). + * param parameters for the texture (see glTexImage2d()). + * pallette_width Length of the palette. Valid values are 4, 16, 32, 256 (if 0, then palette is removed from currently bound texture). + * *palette Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture). + * *texture Pointer to the texture data to load. +*/ +int glLoadTile(glImage *sprite, + int texture_width, + int texture_height, + int sprite_width, + int sprite_height, + GL_TEXTURE_TYPE_ENUM type, + int param, + int pallette_width, + const u16 *palette, + const uint8 *texture); + +/* Initializes GL in 2D mode */ +void glScreen2D(void); + +/* + * Sets up OpenGL for 2d rendering. + * + * Call this before drawing any of GL2D's drawing or sprite functions. + */ +void glBegin2D(void); + +/* + * Issue this after drawing 2d so that we don't mess the matrix stack. + * + * The complement of glBegin2D(). + */ +void glEnd2D(void); + +/* + * Draws a Pixel + * x X position of the pixel. + * y Y position of the pixel. + * color RGB15/ARGB16 color. + */ +void glPutPixel(int x, int y, int color); + +/* + * Draws a Line + * x1,y1 Top-Left coordinate of the line. + * x2,y2 Bottom-Right coordinate of the line. + * color RGB15/ARGB16 color. + */ +void glLine(int x1, int y1, int x2, int y2, int color); + +/* + * Draws a Box + * x1,y1 Top-Left coordinate of the box. + * x2,y2 Bottom-Right coordinate of the box. + * color RGB15/ARGB16 color. +*/ +void glBox(int x1, int y1, int x2, int y2, int color); + +/* + * Draws a Filled Box + * x1,y1 Top-Left coordinate of the box. + * x2,y2 Bottom-Right coordinate of the box. + * color RGB15/ARGB16 color. + */ +void glBoxFilled(int x1, int y1, int x2, int y2, int color); + +#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/project/jni/sdl-1.3/src/render/nds/SDL_ndsrender.c b/project/jni/sdl-1.3/src/render/nds/SDL_ndsrender.c old mode 100644 new mode 100755 index 5edfea136..4666bb031 --- a/project/jni/sdl-1.3/src/render/nds/SDL_ndsrender.c +++ b/project/jni/sdl-1.3/src/render/nds/SDL_ndsrender.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include #include -#include +#include "SDL_libgl2D.h" #include "SDL_video.h" #include "../../video/SDL_sysvideo.h" @@ -34,6 +34,36 @@ #include "../SDL_sysrender.h" #include "SDL_log.h" +/* Draws a partial sprite. Based on glSprite. */ +static void glSpritePartial(const SDL_Rect * srcrect, int x, int y, int flipmode, const glImage *spr) +{ + int x1 = x; + int y1 = y; + int x2 = x + srcrect->w; + int y2 = y + srcrect->h; + + int u1 = srcrect->x + ((flipmode & GL_FLIP_H) ? spr->width-1 : 0); + int u2 = srcrect->x + ((flipmode & GL_FLIP_H) ? 0 : srcrect->h); + int v1 = srcrect->y + ((flipmode & GL_FLIP_V) ? spr->height-1 : 0); + int v2 = srcrect->y + ((flipmode & GL_FLIP_V) ? 0 : srcrect->h); + + if (spr->textureID != gCurrentTexture) { + glBindTexture(GL_TEXTURE_2D, spr->textureID); + gCurrentTexture = spr->textureID; + } + + glBegin(GL_QUADS); + + gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth); + gxTexcoord2i(u1, v2); gxVertex2i(x1, y2); + gxTexcoord2i(u2, v2); gxVertex2i(x2, y2); + gxTexcoord2i(u2, v1); gxVertex2i(x2, y1); + + glEnd(); + + g_depth++; +} + /* SDL NDS renderer implementation */ extern SDL_RenderDriver NDS_RenderDriver; @@ -49,7 +79,6 @@ typedef struct glImage image[1]; } NDS_TextureData; - static int NDS_UpdateViewport(SDL_Renderer *renderer) { /* Nothing to do. */ @@ -70,9 +99,9 @@ NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, dest_y = dstrect->y-SCREEN_HEIGHT; } - if (texture->w == dstrect->w && texture->h == dstrect->h) { + if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { /* No scaling */ - glSprite(dstrect->x, dest_y, GL_FLIP_NONE, txdat->image); + glSpritePartial(srcrect, dstrect->x, dest_y, GL_FLIP_NONE, txdat->image); } else { /* Convert the scaling proportion into a 20.12 value. */ s32 scale_w = divf32(dstrect->w << 12, texture->w << 12); @@ -153,15 +182,42 @@ static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; + char *new_pixels = NULL; + const int gl_w = get_gltexture_size(rect->w); + const int gl_h = get_gltexture_size(rect->h); + const int w = 1 << (3+gl_w); /* Texture sizes must be a power of 2. */ + const int h = 1 << (3+gl_h); /* Texture sizes must be a power of 2. */ - glLoadTileSet(txdat->image, - rect->w, rect->h, + if (w != rect->w || h != rect->h) { + /* Allocate a temporary surface and copy pixels into it while + * enlarging the pitch. */ + const char *src; + char *dst; + int new_pitch = 2 * w; + int i; + + new_pixels = malloc(2 * w * h); + if (!new_pixels) + return SDL_ENOMEM; + + src = pixels; + dst = new_pixels; + for (i=0; ih; i++) { + memcpy(dst, src, pitch); + src += pitch; + dst += new_pitch; + } + } + + glLoadTile(txdat->image, + gl_w, gl_h, rect->w, rect->h, texture->format == SDL_PIXELFORMAT_ABGR1555 ? GL_RGBA : GL_RGB, - get_gltexture_size(rect->w), - get_gltexture_size(rect->h), TEXGEN_OFF, 0, NULL, - pixels); + new_pixels? new_pixels : pixels); + + if (new_pixels) + free(new_pixels); return 0; } @@ -193,7 +249,6 @@ static int NDS_RenderClear(SDL_Renderer *renderer) static void NDS_RenderPresent(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - static int frame =0; glEnd2D(); @@ -324,18 +379,20 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info = NDS_RenderDriver.info; renderer->info.flags = SDL_RENDERER_ACCELERATED; - renderer->UpdateViewport = NDS_UpdateViewport; - renderer->CreateTexture = NDS_CreateTexture; - renderer->DestroyTexture = NDS_DestroyTexture; - renderer->RenderCopy = NDS_RenderCopy; + renderer->CreateTexture = NDS_CreateTexture; renderer->UpdateTexture = NDS_UpdateTexture; renderer->LockTexture = NDS_LockTexture; renderer->UnlockTexture = NDS_UnlockTexture; + renderer->UpdateViewport = NDS_UpdateViewport; renderer->RenderClear = NDS_RenderClear; - renderer->RenderPresent = NDS_RenderPresent; renderer->RenderDrawPoints = NDS_RenderDrawPoints; renderer->RenderDrawLines = NDS_RenderDrawLines; renderer->RenderFillRects = NDS_RenderFillRects; + renderer->RenderCopy = NDS_RenderCopy; + /* renderer->RenderReadPixels = NDS_RenderReadPixels; - todo ? */ + renderer->RenderPresent = NDS_RenderPresent; + renderer->DestroyTexture = NDS_DestroyTexture; + /* renderer->DestroyRenderer = NDS_DestroyRenderer; - todo ? */ renderer->driverdata = data; diff --git a/project/jni/sdl-1.3/src/render/opengl/SDL_render_gl.c b/project/jni/sdl-1.3/src/render/opengl/SDL_render_gl.c old mode 100644 new mode 100755 index 320044645..816ceb7cc --- a/project/jni/sdl-1.3/src/render/opengl/SDL_render_gl.c +++ b/project/jni/sdl-1.3/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateViewport(SDL_Renderer * renderer); static int GL_RenderClear(SDL_Renderer * renderer); static int GL_RenderDrawPoints(SDL_Renderer * renderer, @@ -75,13 +76,22 @@ SDL_RenderDriver GL_RenderDriver = { GL_CreateRenderer, { "opengl", - (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), 1, {SDL_PIXELFORMAT_ARGB8888}, 0, 0} }; +typedef struct GL_FBOList GL_FBOList; + +struct GL_FBOList +{ + Uint32 w, h; + GLuint FBO; + GL_FBOList *next; +}; + typedef struct { SDL_GLContext context; @@ -91,6 +101,9 @@ typedef struct Uint32 color; int blendMode; } current; + + SDL_bool GL_EXT_framebuffer_object_supported; + GL_FBOList *framebuffers; /* OpenGL functions */ #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; @@ -101,6 +114,12 @@ typedef struct SDL_bool GL_ARB_multitexture_supported; PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; GLint num_texture_units; + + PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; + PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; + PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; + PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; + PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; /* Shader support */ GL_ShaderContext *shaders; @@ -123,6 +142,8 @@ typedef struct SDL_bool yuv; GLuint utexture; GLuint vtexture; + + GL_FBOList *fbo; } GL_TextureData; @@ -227,6 +248,29 @@ GL_ResetState(SDL_Renderer *renderer) data->glLoadIdentity(); } + +GL_FBOList * +GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h) +{ + GL_FBOList *result = data->framebuffers; + + while (result && ((result->w != w) || (result->h != h))) { + result = result->next; + } + + if (!result) { + result = SDL_malloc(sizeof(GL_FBOList)); + if (result) { + result->w = w; + result->h = h; + data->glGenFramebuffersEXT(1, &result->FBO); + result->next = data->framebuffers; + data->framebuffers = result; + } + } + return result; +} + SDL_Renderer * GL_CreateRenderer(SDL_Window * window, Uint32 flags) { @@ -239,6 +283,8 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) window_flags = SDL_GetWindowFlags(window); if (!(window_flags & SDL_WINDOW_OPENGL)) { if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) { + /* Uh oh, better try to put it back... */ + SDL_RecreateWindow(window, window_flags); return NULL; } } @@ -261,6 +307,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = GL_UpdateTexture; renderer->LockTexture = GL_LockTexture; renderer->UnlockTexture = GL_UnlockTexture; + renderer->SetRenderTarget = GL_SetRenderTarget; renderer->UpdateViewport = GL_UpdateViewport; renderer->RenderClear = GL_RenderClear; renderer->RenderDrawPoints = GL_RenderDrawPoints; @@ -274,6 +321,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info = GL_RenderDriver.info; renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->driverdata = data; + renderer->window = window; data->context = SDL_GL_CreateContext(window); if (!data->context) { @@ -338,6 +386,22 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; } + + if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) { + data->GL_EXT_framebuffer_object_supported = SDL_TRUE; + data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) + SDL_GL_GetProcAddress("glGenFramebuffersEXT"); + data->glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC) + SDL_GL_GetProcAddress("glDeleteFramebuffersEXT"); + data->glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) + SDL_GL_GetProcAddress("glFramebufferTexture2DEXT"); + data->glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) + SDL_GL_GetProcAddress("glBindFramebufferEXT"); + data->glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) + SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT"); + renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE; + } + data->framebuffers = NULL; /* Set up parameters for rendering */ GL_ResetState(renderer); @@ -348,7 +412,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) static void GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) { - if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) { + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { /* Rebind the context to the window area and update matrices */ SDL_CurrentContext = NULL; } @@ -443,10 +509,17 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } texture->driverdata = data; + + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + data->fbo = GL_GetFBO(renderdata, texture->w, texture->h); + } else { + data->fbo = NULL; + } renderdata->glGetError(); renderdata->glGenTextures(1, &data->texture); - if (renderdata->GL_ARB_texture_rectangle_supported) { + if ((renderdata->GL_ARB_texture_rectangle_supported) + /*&& texture->access != SDL_TEXTUREACCESS_TARGET*/){ data->type = GL_TEXTURE_RECTANGLE_ARB; texture_w = texture->w; texture_h = texture->h; @@ -467,10 +540,15 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) renderdata->glBindTexture(data->type, data->texture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode); renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode); - renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); + /* According to the spec, CLAMP_TO_EDGE is the default for TEXTURE_RECTANGLE + and setting it causes an INVALID_ENUM error in the latest NVidia drivers. + */ + if (data->type != GL_TEXTURE_RECTANGLE_ARB) { + renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, + GL_CLAMP_TO_EDGE); + renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, + GL_CLAMP_TO_EDGE); + } #ifdef __MACOSX__ #ifndef GL_TEXTURE_STORAGE_HINT_APPLE #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC @@ -569,15 +647,10 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->h, data->format, data->formattype, pixels); if (data->yuv) { - const void *top; - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); - /* Skip to the top of the next texture */ - top = (const void*)((const Uint8*)pixels + (texture->h-rect->y) * pitch - rect->x); - /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2); + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->vtexture); } else { @@ -587,11 +660,8 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->w/2, rect->h/2, data->format, data->formattype, pixels); - /* Skip to the top of the next texture */ - top = (const void*)((const Uint8*)top + (texture->h * pitch)/4); - /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2); + pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else { @@ -638,6 +708,33 @@ GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_UpdateTexture(renderer, texture, rect, pixels, data->pitch); } +static int +GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + GL_TextureData *texturedata; + GLenum status; + + GL_ActivateRenderer(renderer); + + if (texture == NULL) { + data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + return 0; + } + + texturedata = (GL_TextureData *) texture->driverdata; + data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, texturedata->fbo->FBO); + /* TODO: check if texture pixel format allows this operation */ + data->glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, texturedata->type, texturedata->texture, 0); + /* Check FBO status */ + status = data->glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + SDL_SetError("glFramebufferTexture2DEXT() failed"); + return -1; + } + return 0; +} + static int GL_UpdateViewport(SDL_Renderer * renderer) { @@ -653,10 +750,19 @@ GL_UpdateViewport(SDL_Renderer * renderer) data->glMatrixMode(GL_PROJECTION); data->glLoadIdentity(); - data->glOrtho((GLdouble) 0, - (GLdouble) renderer->viewport.w, - (GLdouble) renderer->viewport.h, - (GLdouble) 0, 0.0, 1.0); + if (renderer->target) { + data->glOrtho((GLdouble) 0, + (GLdouble) renderer->viewport.w, + (GLdouble) 0, + (GLdouble) renderer->viewport.h, + 0.0, 1.0); + } else { + data->glOrtho((GLdouble) 0, + (GLdouble) renderer->viewport.w, + (GLdouble) renderer->viewport.h, + (GLdouble) 0, + 0.0, 1.0); + } return 0; } @@ -1013,6 +1119,13 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_DestroyShaderContext(data->shaders); } if (data->context) { + while (data->framebuffers) { + GL_FBOList *nextnode = data->framebuffers->next; + /* delete the framebuffer object */ + data->glDeleteFramebuffersEXT(1, &data->framebuffers->FBO); + SDL_free(data->framebuffers); + data->framebuffers = nextnode; + } /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */ SDL_GL_DeleteContext(data->context); } diff --git a/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.c b/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.c old mode 100644 new mode 100755 index 1bf351d72..88876c789 --- a/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.c +++ b/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.h b/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.h old mode 100644 new mode 100755 index eb26cf53c..959582ac2 --- a/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.h +++ b/project/jni/sdl-1.3/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/opengles/SDL_glesfuncs.h b/project/jni/sdl-1.3/src/render/opengles/SDL_glesfuncs.h new file mode 100644 index 000000000..aab15a18a --- /dev/null +++ b/project/jni/sdl-1.3/src/render/opengles/SDL_glesfuncs.h @@ -0,0 +1,40 @@ +SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glClear, (GLbitfield)) +SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) +SDL_PROC(void, glColor4f, (GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *)) +SDL_PROC(void, glDisable, (GLenum)) +SDL_PROC(void, glDisableClientState, (GLenum array)) +SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei)) +SDL_PROC(void, glDrawTexiOES, (GLint, GLint, GLint, GLint, GLint)) +SDL_PROC(void, glEnable, (GLenum)) +SDL_PROC(void, glEnableClientState, (GLenum)) +SDL_PROC(void, glFinish, (void)) +SDL_PROC(void, glGenFramebuffersOES, (GLsizei, GLuint *)) +SDL_PROC(void, glGenTextures, (GLsizei, GLuint *)) +SDL_PROC(GLenum, glGetError, (void)) +SDL_PROC(void, glGetIntegerv, (GLenum, GLint *)) +SDL_PROC(void, glLoadIdentity, (void)) +SDL_PROC(void, glMatrixMode, (GLenum)) +SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glPixelStorei, (GLenum, GLint)) +SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *)) +SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat)) +SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) +SDL_PROC(void, glTexParameteriv, (GLenum, GLenum, const GLint *)) +SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glVertexPointer, (GLint, GLenum, GLsizei, const GLvoid *)) +SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei)) +SDL_PROC(void, glBindFramebufferOES, (GLenum, GLuint)) +SDL_PROC(void, glFramebufferTexture2DOES, (GLenum, GLenum, GLenum, GLuint, GLint)) +SDL_PROC(GLenum, glCheckFramebufferStatusOES, (GLenum)) +SDL_PROC(void, glPushMatrix, (void)) +SDL_PROC(void, glTranslatef, (GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glRotatef, (GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glPopMatrix, (void)) +SDL_PROC(void, glDeleteFramebuffersOES, (GLsizei, const GLuint*)) + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c b/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c old mode 100644 new mode 100755 index 5deda8dd8..01a7050a3 --- a/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c +++ b/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,6 @@ #include "SDL_hints.h" #include "SDL_opengles.h" #include "../SDL_sysrender.h" -#include #if defined(SDL_VIDEO_DRIVER_PANDORA) @@ -41,6 +40,9 @@ glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */ +/* Used to re-create the window with OpenGL ES capability */ +extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); + static const float inv255f = 1.0f / 255.0f; static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); @@ -54,6 +56,8 @@ static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int GLES_SetRenderTarget(SDL_Renderer * renderer, + SDL_Texture * texture); static int GLES_UpdateViewport(SDL_Renderer * renderer); static int GLES_RenderClear(SDL_Renderer * renderer); static int GLES_RenderDrawPoints(SDL_Renderer * renderer, @@ -72,12 +76,21 @@ static void GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); static void GLES_DestroyRenderer(SDL_Renderer * renderer); +typedef struct GLES_FBOList GLES_FBOList; + +struct GLES_FBOList +{ + Uint32 w, h; + GLuint FBO; + GLES_FBOList *next; +}; + SDL_RenderDriver GLES_RenderDriver = { GLES_CreateRenderer, { "opengles", - (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), 5, {SDL_PIXELFORMAT_ABGR8888,SDL_PIXELFORMAT_RGB565,SDL_PIXELFORMAT_RGBA5551,SDL_PIXELFORMAT_RGBA4444,SDL_PIXELFORMAT_RGB24}, 0, @@ -93,6 +106,13 @@ typedef struct SDL_bool tex_coords; } current; +#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; +#include "SDL_glesfuncs.h" +#undef SDL_PROC + SDL_bool GL_OES_framebuffer_object_supported; + GLES_FBOList *framebuffers; + GLuint window_framebuffer; + SDL_bool useDrawTexture; SDL_bool GL_OES_draw_texture_supported; } GLES_RenderData; @@ -107,6 +127,7 @@ typedef struct GLenum formattype; void *pixels; int pitch; + GLES_FBOList *fbo; } GLES_TextureData; static void @@ -143,8 +164,57 @@ GLES_SetError(const char *prefix, GLenum result) SDL_SetError("%s: %s", prefix, error); } +static int GLES_LoadFunctions(GLES_RenderData * data) +{ +#if SDL_VIDEO_DRIVER_UIKIT +#define __SDL_NOGETPROCADDR__ +#elif SDL_VIDEO_DRIVER_ANDROID +#define __SDL_NOGETPROCADDR__ +#elif SDL_VIDEO_DRIVER_PANDORA +#define __SDL_NOGETPROCADDR__ +#endif + +#ifdef __SDL_NOGETPROCADDR__ +#define SDL_PROC(ret,func,params) data->func=func; +#else +#define SDL_PROC(ret,func,params) \ + do { \ + data->func = SDL_GL_GetProcAddress(#func); \ + if ( ! data->func ) { \ + SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \ + return -1; \ + } \ + } while ( 0 ); +#endif /* _SDL_NOGETPROCADDR_ */ + +#include "SDL_glesfuncs.h" +#undef SDL_PROC + return 0; +} + static SDL_GLContext SDL_CurrentContext = NULL; +GLES_FBOList * +GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) +{ + GLES_FBOList *result = data->framebuffers; + while ((result) && ((result->w != w) || (result->h != h)) ) + { + result = result->next; + } + if (result == NULL) + { + result = SDL_malloc(sizeof(GLES_FBOList)); + result->w = w; + result->h = h; + data->glGenFramebuffersOES(1, &result->FBO); + result->next = data->framebuffers; + data->framebuffers = result; + } + return result; +} + + static int GLES_ActivateRenderer(SDL_Renderer * renderer) { @@ -177,24 +247,36 @@ GLES_ResetState(SDL_Renderer *renderer) data->current.blendMode = -1; data->current.tex_coords = SDL_FALSE; - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); + data->glDisable(GL_DEPTH_TEST); + data->glDisable(GL_CULL_FACE); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + data->glMatrixMode(GL_MODELVIEW); + data->glLoadIdentity(); - glEnableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); + data->glEnableClientState(GL_VERTEX_ARRAY); + data->glDisableClientState(GL_TEXTURE_COORD_ARRAY); } SDL_Renderer * GLES_CreateRenderer(SDL_Window * window, Uint32 flags) { + SDL_Renderer *renderer; GLES_RenderData *data; GLint value; - - __android_log_print(ANDROID_LOG_INFO, "SDL", "GLES_CreateRenderer(): creating GLES 1.x renderer"); + Uint32 windowFlags; + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + + windowFlags = SDL_GetWindowFlags(window); + if (!(windowFlags & SDL_WINDOW_OPENGL)) { + if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) { + /* Uh oh, better try to put it back... */ + SDL_RecreateWindow(window, windowFlags); + return NULL; + } + } renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); if (!renderer) { @@ -214,6 +296,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; renderer->UnlockTexture = GLES_UnlockTexture; + renderer->SetRenderTarget = GLES_SetRenderTarget; renderer->UpdateViewport = GLES_UpdateViewport; renderer->RenderClear = GLES_RenderClear; renderer->RenderDrawPoints = GLES_RenderDrawPoints; @@ -227,9 +310,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info = GLES_RenderDriver.info; renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->driverdata = data; - - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + renderer->window = window; data->context = SDL_GL_CreateContext(window); if (!data->context) { @@ -241,6 +322,11 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) return NULL; } + if (GLES_LoadFunctions(data) < 0) { + GLES_DestroyRenderer(renderer); + return NULL; + } + if (flags & SDL_RENDERER_PRESENTVSYNC) { SDL_GL_SetSwapInterval(1); } else { @@ -263,11 +349,23 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) } #endif - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); + value = 0; + data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); renderer->info.max_texture_width = value; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); + value = 0; + data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); renderer->info.max_texture_height = value; + if (SDL_GL_ExtensionSupported("GL_OES_framebuffer_object")) { + data->GL_OES_framebuffer_object_supported = SDL_TRUE; + renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE; + + value = 0; + data->glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &value); + data->window_framebuffer = (GLuint)value; + } + data->framebuffers = NULL; + /* Set up parameters for rendering */ GLES_ResetState(renderer); @@ -277,16 +375,18 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) static void GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) { -__android_log_print(ANDROID_LOG_INFO, "SDL", "GLES_WindowEvent() called"); -#ifndef ANDROID - if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { /* Rebind the context to the window area and update matrices */ SDL_CurrentContext = NULL; } -#endif + if (event->event == SDL_WINDOWEVENT_MINIMIZED) { /* According to Apple documentation, we need to finish drawing NOW! */ - glFinish(); + data->glFinish(); } } @@ -316,6 +416,7 @@ GetScaleQuality(void) static int GLES_CreateTextureInternal(SDL_Renderer * renderer, SDL_Texture * texture, GLES_TextureData *data) { + GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; GLint internalFormat; GLenum format, type; int texture_w, texture_h; @@ -374,10 +475,15 @@ GLES_CreateTextureInternal(SDL_Renderer * renderer, SDL_Texture * texture, GLES_ } texture->driverdata = data; + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + data->fbo = GLES_GetFBO(renderer->driverdata, texture->w, texture->h); + } else { + data->fbo = NULL; + } - glGetError(); - glEnable(GL_TEXTURE_2D); - glGenTextures(1, &data->texture); + renderdata->glGetError(); + renderdata->glEnable(GL_TEXTURE_2D); + renderdata->glGenTextures(1, &data->texture); data->type = GL_TEXTURE_2D; /* no NPOV textures allowed in OpenGL ES (yet) */ @@ -389,17 +495,17 @@ GLES_CreateTextureInternal(SDL_Renderer * renderer, SDL_Texture * texture, GLES_ data->format = format; data->formattype = type; scaleMode = GetScaleQuality(); - glBindTexture(data->type, data->texture); - glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode); - glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode); - glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + renderdata->glBindTexture(data->type, data->texture); + renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode); + renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode); + renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(data->type, 0, internalFormat, texture_w, + renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, texture_h, 0, format, type, NULL); - glDisable(GL_TEXTURE_2D); + renderdata->glDisable(GL_TEXTURE_2D); - result = glGetError(); + result = renderdata->glGetError(); if (result != GL_NO_ERROR) { GLES_SetError("glTexImage2D()", result); return -1; @@ -423,6 +529,7 @@ static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { + GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; Uint8 *blob = NULL; Uint8 *src; @@ -457,11 +564,11 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, } /* Create a texture subimage with the supplied data */ - glGetError(); - glEnable(data->type); - glBindTexture(data->type, data->texture); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexSubImage2D(data->type, + renderdata->glGetError(); + renderdata->glEnable(data->type); + renderdata->glBindTexture(data->type, data->texture); + renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, @@ -474,7 +581,7 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, SDL_free(blob); } - if (glGetError() != GL_NO_ERROR) + if (renderdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to update texture"); return -1; @@ -509,6 +616,33 @@ GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) GLES_UpdateTexture(renderer, texture, &rect, data->pixels, data->pitch); } +static int +GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + GLES_TextureData *texturedata = NULL; + GLenum status; + + GLES_ActivateRenderer(renderer); + + if (texture == NULL) { + data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer); + return 0; + } + + texturedata = (GLES_TextureData *) texture->driverdata; + data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, texturedata->fbo->FBO); + /* TODO: check if texture pixel format allows this operation */ + data->glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, texturedata->type, texturedata->texture, 0); + /* Check FBO status */ + status = data->glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); + if (status != GL_FRAMEBUFFER_COMPLETE_OES) { + SDL_SetError("glFramebufferTexture2DOES() failed"); + return -1; + } + return 0; +} + static int GLES_UpdateViewport(SDL_Renderer * renderer) { @@ -519,12 +653,12 @@ GLES_UpdateViewport(SDL_Renderer * renderer) return 0; } - glViewport(renderer->viewport.x, renderer->viewport.y, + data->glViewport(renderer->viewport.x, renderer->viewport.y, renderer->viewport.w, renderer->viewport.h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrthof((GLfloat) 0, + data->glMatrixMode(GL_PROJECTION); + data->glLoadIdentity(); + data->glOrthof((GLfloat) 0, (GLfloat) renderer->viewport.w, (GLfloat) renderer->viewport.h, (GLfloat) 0, 0.0, 1.0); @@ -537,7 +671,7 @@ GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) Uint32 color = ((a << 24) | (r << 16) | (g << 8) | b); if (color != data->current.color) { - glColor4f((GLfloat) r * inv255f, + data->glColor4f((GLfloat) r * inv255f, (GLfloat) g * inv255f, (GLfloat) b * inv255f, (GLfloat) a * inv255f); @@ -551,23 +685,23 @@ GLES_SetBlendMode(GLES_RenderData * data, int blendMode) if (blendMode != data->current.blendMode) { switch (blendMode) { case SDL_BLENDMODE_NONE: - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glDisable(GL_BLEND); + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + data->glDisable(GL_BLEND); break; case SDL_BLENDMODE_BLEND: - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + data->glEnable(GL_BLEND); + data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case SDL_BLENDMODE_ADD: - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + data->glEnable(GL_BLEND); + data->glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; case SDL_BLENDMODE_MOD: - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glEnable(GL_BLEND); - glBlendFunc(GL_ZERO, GL_SRC_COLOR); + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + data->glEnable(GL_BLEND); + data->glBlendFunc(GL_ZERO, GL_SRC_COLOR); break; } data->current.blendMode = blendMode; @@ -579,9 +713,9 @@ GLES_SetTexCoords(GLES_RenderData * data, SDL_bool enabled) { if (enabled != data->current.tex_coords) { if (enabled) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); + data->glEnableClientState(GL_TEXTURE_COORD_ARRAY); } else { - glDisableClientState(GL_TEXTURE_COORD_ARRAY); + data->glDisableClientState(GL_TEXTURE_COORD_ARRAY); } data->current.tex_coords = enabled; } @@ -607,14 +741,16 @@ GLES_SetDrawingState(SDL_Renderer * renderer) static int GLES_RenderClear(SDL_Renderer * renderer) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + GLES_ActivateRenderer(renderer); - glClearColor((GLfloat) renderer->r * inv255f, + data->glClearColor((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); - glClear(GL_COLOR_BUFFER_BIT); + data->glClear(GL_COLOR_BUFFER_BIT); return 0; } @@ -623,6 +759,7 @@ static int GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLshort *vertices; @@ -633,8 +770,8 @@ GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, vertices[2*i+0] = (GLshort)points[i].x; vertices[2*i+1] = (GLshort)points[i].y; } - glVertexPointer(2, GL_SHORT, 0, vertices); - glDrawArrays(GL_POINTS, 0, count); + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glDrawArrays(GL_POINTS, 0, count); SDL_stack_free(vertices); return 0; @@ -644,6 +781,7 @@ static int GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLshort *vertices; @@ -654,16 +792,16 @@ GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, vertices[2*i+0] = (GLshort)points[i].x; vertices[2*i+1] = (GLshort)points[i].y; } - glVertexPointer(2, GL_SHORT, 0, vertices); + data->glVertexPointer(2, GL_SHORT, 0, vertices); if (count > 2 && points[0].x == points[count-1].x && points[0].y == points[count-1].y) { /* GL_LINE_LOOP takes care of the final segment */ --count; - glDrawArrays(GL_LINE_LOOP, 0, count); + data->glDrawArrays(GL_LINE_LOOP, 0, count); } else { - glDrawArrays(GL_LINE_STRIP, 0, count); + data->glDrawArrays(GL_LINE_STRIP, 0, count); /* We need to close the endpoint of the line */ - glDrawArrays(GL_POINTS, count-1, 1); + data->glDrawArrays(GL_POINTS, count-1, 1); } SDL_stack_free(vertices); @@ -674,6 +812,7 @@ static int GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLES_SetDrawingState(renderer); @@ -694,8 +833,8 @@ GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, vertices[6] = maxx; vertices[7] = maxy; - glVertexPointer(2, GL_SHORT, 0, vertices); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } return 0; @@ -705,7 +844,7 @@ static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect) { - //__android_log_print(ANDROID_LOG_INFO, "SDL", "GLES_RenderCopy %dx%d+%d+%d -> %dx%d+%d+%d", srcrect->x, srcrect->y, srcrect->w, srcrect->h, dstrect->x, dstrect->y, dstrect->w, dstrect->h); + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata; int minx, miny, maxx, maxy; @@ -713,9 +852,9 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, GLES_ActivateRenderer(renderer); - glEnable(GL_TEXTURE_2D); + data->glEnable(GL_TEXTURE_2D); - glBindTexture(texturedata->type, texturedata->texture); + data->glBindTexture(texturedata->type, texturedata->texture); if (texture->modMode) { GLES_SetColor(data, texture->r, texture->g, texture->b, texture->a); @@ -734,15 +873,26 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Window *window = renderer->window; SDL_GetWindowSize(window, &w, &h); - cropRect[0] = srcrect->x; - cropRect[1] = srcrect->y + srcrect->h; - cropRect[2] = srcrect->w; - cropRect[3] = -srcrect->h; - glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, - cropRect); - glDrawTexiOES(renderer->viewport.x + dstrect->x, - h - (renderer->viewport.y + dstrect->y) - dstrect->h, 0, - dstrect->w, dstrect->h); + if (renderer->target) { + cropRect[0] = srcrect->x; + cropRect[1] = srcrect->y; + cropRect[2] = srcrect->w; + cropRect[3] = srcrect->h; + data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, + cropRect); + data->glDrawTexiOES(renderer->viewport.x + dstrect->x, renderer->viewport.y + dstrect->y, 0, + dstrect->w, dstrect->h); + } else { + cropRect[0] = srcrect->x; + cropRect[1] = srcrect->y + srcrect->h; + cropRect[2] = srcrect->w; + cropRect[3] = -srcrect->h; + data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, + cropRect); + data->glDrawTexiOES(renderer->viewport.x + dstrect->x, + h - (renderer->viewport.y + dstrect->y) - dstrect->h, 0, + dstrect->w, dstrect->h); + } } else { minx = dstrect->x; @@ -780,11 +930,11 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, texCoords[6] = maxu; texCoords[7] = maxv; - glVertexPointer(2, GL_SHORT, 0, vertices); - glTexCoordPointer(2, GL_FLOAT, 0, texCoords); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords); + data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } - glDisable(GL_TEXTURE_2D); + data->glDisable(GL_TEXTURE_2D); return 0; } @@ -793,6 +943,7 @@ static int GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; SDL_Window *window = renderer->window; Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888; void *temp_pixels; @@ -812,9 +963,9 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_GetWindowSize(window, &w, &h); - glPixelStorei(GL_PACK_ALIGNMENT, 1); + data->glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, + data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); /* Flip the rows to be top-down */ @@ -851,6 +1002,8 @@ GLES_RenderPresent(SDL_Renderer * renderer) static void GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) { + GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; + GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; GLES_ActivateRenderer(renderer); @@ -859,7 +1012,7 @@ GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) return; } if (data->texture) { - glDeleteTextures(1, &data->texture); + renderdata->glDeleteTextures(1, &data->texture); } if (data->pixels) { SDL_free(data->pixels); @@ -875,6 +1028,12 @@ GLES_DestroyRenderer(SDL_Renderer * renderer) if (data) { if (data->context) { + while (data->framebuffers) { + GLES_FBOList *nextnode = data->framebuffers->next; + data->glDeleteFramebuffersOES(1, &data->framebuffers->FBO); + SDL_free(data->framebuffers); + data->framebuffers = nextnode; + } SDL_GL_DeleteContext(data->context); } SDL_free(data); diff --git a/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c.diff b/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c.diff new file mode 100644 index 000000000..75ef0c99a --- /dev/null +++ b/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c.diff @@ -0,0 +1,112 @@ +--- SDL_render_gles.c 2012-05-23 17:07:14.431483827 +0300 ++++ /home/pelya/src/endless_space/SDL-android/project/jni/sdl-1.3/src/render/opengles/SDL_render_gles.c 2012-05-23 17:20:18.467476658 +0300 +@@ -91,8 +91,8 @@ + { + "opengles", + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), +- 1, +- {SDL_PIXELFORMAT_ABGR8888}, ++ 5, ++ {SDL_PIXELFORMAT_ABGR8888,SDL_PIXELFORMAT_RGB565,SDL_PIXELFORMAT_RGBA5551,SDL_PIXELFORMAT_RGBA4444,SDL_PIXELFORMAT_RGB24}, + 0, + 0} + }; +@@ -232,7 +232,7 @@ + } + + /* This is called if we need to invalidate all of the SDL OpenGL state */ +-static void ++extern void + GLES_ResetState(SDL_Renderer *renderer) + { + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; +@@ -414,10 +414,9 @@ + } + + static int +-GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ++GLES_CreateTextureInternal(SDL_Renderer * renderer, SDL_Texture * texture, GLES_TextureData *data) + { + GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; +- GLES_TextureData *data; + GLint internalFormat; + GLenum format, type; + int texture_w, texture_h; +@@ -432,25 +431,47 @@ + format = GL_RGBA; + type = GL_UNSIGNED_BYTE; + break; ++ case SDL_PIXELFORMAT_RGB565: ++ internalFormat = GL_RGB; ++ format = GL_RGB; ++ type = GL_UNSIGNED_SHORT_5_6_5; ++ break; ++ case SDL_PIXELFORMAT_RGBA5551: ++ internalFormat = GL_RGBA; ++ format = GL_RGBA; ++ type = GL_UNSIGNED_SHORT_5_5_5_1; ++ break; ++ case SDL_PIXELFORMAT_RGBA4444: ++ internalFormat = GL_RGBA; ++ format = GL_RGBA; ++ type = GL_UNSIGNED_SHORT_4_4_4_4; ++ break; ++ case SDL_PIXELFORMAT_RGB24: ++ internalFormat = GL_RGB; ++ format = GL_RGB; ++ type = GL_UNSIGNED_BYTE; ++ break; + default: + SDL_SetError("Texture format not supported"); + return -1; + } + +- data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data)); +- if (!data) { +- SDL_OutOfMemory(); +- return -1; +- } +- +- if (texture->access == SDL_TEXTUREACCESS_STREAMING) { +- data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); +- data->pixels = SDL_calloc(1, texture->h * data->pitch); +- if (!data->pixels) { ++ if(data == NULL) { ++ data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data)); ++ if (!data) { + SDL_OutOfMemory(); +- SDL_free(data); + return -1; + } ++ ++ if (texture->access == SDL_TEXTUREACCESS_STREAMING) { ++ data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); ++ data->pixels = SDL_calloc(1, texture->h * data->pitch); ++ if (!data->pixels) { ++ SDL_OutOfMemory(); ++ SDL_free(data); ++ return -1; ++ } ++ } + } + + texture->driverdata = data; +@@ -493,6 +514,18 @@ + } + + static int ++GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ++{ ++ return GLES_CreateTextureInternal(renderer, texture, NULL); ++} ++ ++extern int ++GLES_ReinitTextureAndroid(SDL_Renderer * renderer, SDL_Texture * texture, void * data) ++{ ++ return GLES_CreateTextureInternal(renderer, texture, (GLES_TextureData *)data); ++} ++ ++static int + GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, int pitch) + { diff --git a/project/jni/sdl-1.3/src/render/opengles2/SDL_gles2funcs.h b/project/jni/sdl-1.3/src/render/opengles2/SDL_gles2funcs.h new file mode 100644 index 000000000..7b7d5e17d --- /dev/null +++ b/project/jni/sdl-1.3/src/render/opengles2/SDL_gles2funcs.h @@ -0,0 +1,47 @@ +SDL_PROC(void, glActiveTexture, (GLenum)) +SDL_PROC(void, glAttachShader, (GLuint, GLuint)) +SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *)) +SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glClear, (GLbitfield)) +SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) +SDL_PROC(void, glCompileShader, (GLuint)) +SDL_PROC(GLuint, glCreateProgram, (void)) +SDL_PROC(GLuint, glCreateShader, (GLenum)) +SDL_PROC(void, glDeleteProgram, (GLuint)) +SDL_PROC(void, glDeleteShader, (GLuint)) +SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *)) +SDL_PROC(void, glDisable, (GLenum)) +SDL_PROC(void, glDisableVertexAttribArray, (GLuint)) +SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei)) +SDL_PROC(void, glEnable, (GLenum)) +SDL_PROC(void, glEnableVertexAttribArray, (GLuint)) +SDL_PROC(void, glFinish, (void)) +SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *)) +SDL_PROC(void, glGenTextures, (GLsizei, GLuint *)) +SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *)) +SDL_PROC(const GLubyte *, glGetString, (GLenum)) +SDL_PROC(GLenum, glGetError, (void)) +SDL_PROC(void, glGetIntegerv, (GLenum, GLint *)) +SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *)) +SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *)) +SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *)) +SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *)) +SDL_PROC(void, glLinkProgram, (GLuint)) +SDL_PROC(void, glPixelStorei, (GLenum, GLint)) +SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) +SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const char **, const GLint *)) +SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) +SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) +SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glUniform1i, (GLint, GLint)) +SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) +SDL_PROC(void, glUseProgram, (GLuint)) +SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *)) +SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei)) +SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint)) +SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint)) +SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum)) +SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *)) diff --git a/project/jni/sdl-1.3/src/render/opengles2/SDL_render_gles2.c b/project/jni/sdl-1.3/src/render/opengles2/SDL_render_gles2.c old mode 100644 new mode 100755 index 0122a298d..ce1b696f4 --- a/project/jni/sdl-1.3/src/render/opengles2/SDL_render_gles2.c +++ b/project/jni/sdl-1.3/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,9 @@ #include "../SDL_sysrender.h" #include "SDL_shaders_gles2.h" +/* Used to re-create the window with OpenGL ES capability */ +extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); + /************************************************************************************************* * Bootstrap data * *************************************************************************************************/ @@ -37,9 +40,12 @@ SDL_RenderDriver GLES2_RenderDriver = { GLES2_CreateRenderer, { "opengles2", - (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), - 1, - {SDL_PIXELFORMAT_ABGR8888}, + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), + 4, + {SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_RGB888, + SDL_PIXELFORMAT_BGR888}, 0, 0 } @@ -49,6 +55,15 @@ SDL_RenderDriver GLES2_RenderDriver = { * Context structures * *************************************************************************************************/ +typedef struct GLES2_FBOList GLES2_FBOList; + +struct GLES2_FBOList +{ + Uint32 w, h; + GLuint FBO; + GLES2_FBOList *next; +}; + typedef struct GLES2_TextureData { GLenum texture; @@ -57,6 +72,7 @@ typedef struct GLES2_TextureData GLenum pixel_type; void *pixel_data; size_t pitch; + GLES2_FBOList *fbo; } GLES2_TextureData; typedef struct GLES2_ShaderCacheEntry @@ -111,7 +127,10 @@ typedef enum typedef enum { GLES2_IMAGESOURCE_SOLID, - GLES2_IMAGESOURCE_TEXTURE + GLES2_IMAGESOURCE_TEXTURE_ABGR, + GLES2_IMAGESOURCE_TEXTURE_ARGB, + GLES2_IMAGESOURCE_TEXTURE_RGB, + GLES2_IMAGESOURCE_TEXTURE_BGR } GLES2_ImageSource; typedef struct GLES2_DriverContext @@ -122,6 +141,12 @@ typedef struct GLES2_DriverContext SDL_bool tex_coords; } current; +#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; +#include "SDL_gles2funcs.h" +#undef SDL_PROC + GLES2_FBOList *framebuffers; + GLuint window_framebuffer; + int shader_format_count; GLenum *shader_formats; GLES2_ShaderCache shader_cache; @@ -140,9 +165,59 @@ static void GLES2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GLES2_UpdateViewport(SDL_Renderer * renderer); static void GLES2_DestroyRenderer(SDL_Renderer *renderer); +static int GLES2_SetOrthographicProjection(SDL_Renderer *renderer); + static SDL_GLContext SDL_CurrentContext = NULL; +static int GLES2_LoadFunctions(GLES2_DriverContext * data) +{ +#if SDL_VIDEO_DRIVER_UIKIT +#define __SDL_NOGETPROCADDR__ +#elif SDL_VIDEO_DRIVER_ANDROID +#define __SDL_NOGETPROCADDR__ +#elif SDL_VIDEO_DRIVER_PANDORA +#define __SDL_NOGETPROCADDR__ +#endif + +#if defined __SDL_NOGETPROCADDR__ +#define SDL_PROC(ret,func,params) data->func=func; +#else +#define SDL_PROC(ret,func,params) \ + do { \ + data->func = SDL_GL_GetProcAddress(#func); \ + if ( ! data->func ) { \ + SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return -1; \ + } \ + } while ( 0 ); +#endif /* _SDL_NOGETPROCADDR_ */ + +#include "SDL_gles2funcs.h" +#undef SDL_PROC + return 0; +} + +GLES2_FBOList * +GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h) +{ + GLES2_FBOList *result = data->framebuffers; + while ((result) && ((result->w != w) || (result->h != h)) ) + { + result = result->next; + } + if (result == NULL) + { + result = SDL_malloc(sizeof(GLES2_FBOList)); + result->w = w; + result->h = h; + data->glGenFramebuffers(1, &result->FBO); + result->next = data->framebuffers; + data->framebuffers = result; + } + return result; +} + static int GLES2_ActivateRenderer(SDL_Renderer * renderer) { @@ -165,14 +240,18 @@ GLES2_ActivateRenderer(SDL_Renderer * renderer) static void GLES2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) { - if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; + + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { /* Rebind the context to the window area */ SDL_CurrentContext = NULL; } if (event->event == SDL_WINDOWEVENT_MINIMIZED) { /* According to Apple documentation, we need to finish drawing NOW! */ - glFinish(); + rdata->glFinish(); } } @@ -186,8 +265,12 @@ GLES2_UpdateViewport(SDL_Renderer * renderer) return 0; } - glViewport(renderer->viewport.x, renderer->viewport.y, + rdata->glViewport(renderer->viewport.x, renderer->viewport.y, renderer->viewport.w, renderer->viewport.h); + + if (rdata->current_program) { + GLES2_SetOrthographicProjection(renderer); + } return 0; } @@ -200,30 +283,36 @@ GLES2_DestroyRenderer(SDL_Renderer *renderer) if (rdata) { GLES2_ActivateRenderer(renderer); - { - GLES2_ShaderCacheEntry *entry; - GLES2_ShaderCacheEntry *next; - entry = rdata->shader_cache.head; - while (entry) - { - glDeleteShader(entry->id); - next = entry->next; - SDL_free(entry); - entry = next; - } - } - { - GLES2_ProgramCacheEntry *entry; - GLES2_ProgramCacheEntry *next; - entry = rdata->program_cache.head; - while (entry) { - glDeleteProgram(entry->id); + { + GLES2_ShaderCacheEntry *entry; + GLES2_ShaderCacheEntry *next; + entry = rdata->shader_cache.head; + while (entry) + { + rdata->glDeleteShader(entry->id); next = entry->next; SDL_free(entry); entry = next; } - } + } + { + GLES2_ProgramCacheEntry *entry; + GLES2_ProgramCacheEntry *next; + entry = rdata->program_cache.head; + while (entry) { + rdata->glDeleteProgram(entry->id); + next = entry->next; + SDL_free(entry); + entry = next; + } + } if (rdata->context) { + while (rdata->framebuffers) { + GLES2_FBOList *nextnode = rdata->framebuffers->next; + rdata->glDeleteFramebuffers(1, &rdata->framebuffers->FBO); + SDL_free(rdata->framebuffers); + rdata->framebuffers = nextnode; + } SDL_GL_DeleteContext(rdata->context); } if (rdata->shader_formats) { @@ -245,6 +334,7 @@ static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture); static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch); +static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static GLenum GetScaleQuality(void) @@ -261,6 +351,7 @@ GetScaleQuality(void) static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata; GLenum format; GLenum type; @@ -272,6 +363,9 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) switch (texture->format) { case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGB888: format = GL_RGBA; type = GL_UNSIGNED_BYTE; break; @@ -307,29 +401,37 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } /* Allocate the texture */ - glGetError(); - glGenTextures(1, &tdata->texture); - glActiveTexture(GL_TEXTURE0); - glBindTexture(tdata->texture_type, tdata->texture); - glTexParameteri(tdata->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode); - glTexParameteri(tdata->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); - glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(tdata->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); - if (glGetError() != GL_NO_ERROR) + rdata->glGetError(); + rdata->glGenTextures(1, &tdata->texture); + rdata->glActiveTexture(GL_TEXTURE0); + rdata->glBindTexture(tdata->texture_type, tdata->texture); + rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode); + rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); + rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + rdata->glTexImage2D(tdata->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Texture creation failed"); - glDeleteTextures(1, &tdata->texture); + rdata->glDeleteTextures(1, &tdata->texture); SDL_free(tdata); return -1; } texture->driverdata = tdata; + + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + tdata->fbo = GLES2_GetFBO(renderer->driverdata, texture->w, texture->h); + } else { + tdata->fbo = NULL; + } + return 0; } static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata; GLES2_ActivateRenderer(renderer); @@ -337,7 +439,7 @@ GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) /* Destroy the texture */ if (tdata) { - glDeleteTextures(1, &tdata->texture); + rdata->glDeleteTextures(1, &tdata->texture); SDL_free(tdata->pixel_data); SDL_free(tdata); texture->driverdata = NULL; @@ -377,6 +479,7 @@ static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata; Uint8 *blob = NULL; Uint8 *src; @@ -411,11 +514,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect } /* Create a texture subimage with the supplied data */ - glGetError(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(tdata->texture_type, tdata->texture); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexSubImage2D(tdata->texture_type, + rdata->glGetError(); + rdata->glActiveTexture(GL_TEXTURE0); + rdata->glBindTexture(tdata->texture_type, tdata->texture); + rdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + rdata->glTexSubImage2D(tdata->texture_type, 0, rect->x, rect->y, @@ -428,7 +531,7 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect SDL_free(blob); } - if (glGetError() != GL_NO_ERROR) + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to update texture"); return -1; @@ -436,6 +539,30 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect return 0; } +static int +GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata; + GLES2_TextureData *texturedata = NULL; + GLenum status; + + if (texture == NULL) { + data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer); + } else { + texturedata = (GLES2_TextureData *) texture->driverdata; + data->glBindFramebuffer(GL_FRAMEBUFFER, texturedata->fbo->FBO); + /* TODO: check if texture pixel format allows this operation */ + data->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texturedata->texture_type, texturedata->texture, 0); + /* Check FBO status */ + status = data->glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + SDL_SetError("glFramebufferTexture2D() failed"); + return -1; + } + } + return 0; +} + /************************************************************************************************* * Shader management functions * *************************************************************************************************/ @@ -449,7 +576,6 @@ static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer, SDL_BlendMode blendMode); static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendMode blendMode); -static int GLES2_SetOrthographicProjection(SDL_Renderer *renderer); static GLES2_ProgramCacheEntry * GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, @@ -494,35 +620,35 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, entry->vertex_shader = vertex; entry->fragment_shader = fragment; entry->blend_mode = blendMode; - + /* Create the program and link it */ - glGetError(); - entry->id = glCreateProgram(); - glAttachShader(entry->id, vertex->id); - glAttachShader(entry->id, fragment->id); - glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_POSITION, "a_position"); - glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_TEXCOORD, "a_texCoord"); - glLinkProgram(entry->id); - glGetProgramiv(entry->id, GL_LINK_STATUS, &linkSuccessful); - if (glGetError() != GL_NO_ERROR || !linkSuccessful) + rdata->glGetError(); + entry->id = rdata->glCreateProgram(); + rdata->glAttachShader(entry->id, vertex->id); + rdata->glAttachShader(entry->id, fragment->id); + rdata->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_POSITION, "a_position"); + rdata->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_TEXCOORD, "a_texCoord"); + rdata->glLinkProgram(entry->id); + rdata->glGetProgramiv(entry->id, GL_LINK_STATUS, &linkSuccessful); + if (rdata->glGetError() != GL_NO_ERROR || !linkSuccessful) { SDL_SetError("Failed to link shader program"); - glDeleteProgram(entry->id); + rdata->glDeleteProgram(entry->id); SDL_free(entry); return NULL; } - + /* Predetermine locations of uniform variables */ entry->uniform_locations[GLES2_UNIFORM_PROJECTION] = - glGetUniformLocation(entry->id, "u_projection"); + rdata->glGetUniformLocation(entry->id, "u_projection"); entry->uniform_locations[GLES2_UNIFORM_TEXTURE] = - glGetUniformLocation(entry->id, "u_texture"); + rdata->glGetUniformLocation(entry->id, "u_texture"); entry->uniform_locations[GLES2_UNIFORM_MODULATION] = - glGetUniformLocation(entry->id, "u_modulation"); + rdata->glGetUniformLocation(entry->id, "u_modulation"); entry->uniform_locations[GLES2_UNIFORM_COLOR] = - glGetUniformLocation(entry->id, "u_color"); + rdata->glGetUniformLocation(entry->id, "u_color"); entry->uniform_locations[GLES2_UNIFORM_COLORTABLE] = - glGetUniformLocation(entry->id, "u_colorTable"); + rdata->glGetUniformLocation(entry->id, "u_colorTable"); /* Cache the linked program */ if (rdata->program_cache.head) @@ -550,7 +676,7 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, shaderEntry = rdata->program_cache.tail->fragment_shader; if (--shaderEntry->references <= 0) GLES2_EvictShader(renderer, shaderEntry); - glDeleteProgram(rdata->program_cache.tail->id); + rdata->glDeleteProgram(rdata->program_cache.tail->id); rdata->program_cache.tail = rdata->program_cache.tail->prev; SDL_free(rdata->program_cache.tail->next); rdata->program_cache.tail->next = NULL; @@ -576,7 +702,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b SDL_SetError("No shader matching the requested characteristics was found"); return NULL; } - + /* Find a matching shader instance that's supported on this hardware */ for (i = 0; i < shader->instance_count && !instance; ++i) { @@ -619,29 +745,29 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b entry->instance = instance; /* Compile or load the selected shader instance */ - glGetError(); - entry->id = glCreateShader(instance->type); + rdata->glGetError(); + entry->id = rdata->glCreateShader(instance->type); if (instance->format == (GLenum)-1) { - glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); - glCompileShader(entry->id); - glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); + rdata->glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); + rdata->glCompileShader(entry->id); + rdata->glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); } else { - glShaderBinary(1, &entry->id, instance->format, instance->data, instance->length); + rdata->glShaderBinary(1, &entry->id, instance->format, instance->data, instance->length); compileSuccessful = GL_TRUE; } - if (glGetError() != GL_NO_ERROR || !compileSuccessful) + if (rdata->glGetError() != GL_NO_ERROR || !compileSuccessful) { char *info = NULL; - int length; + int length = 0; - glGetShaderiv(entry->id, GL_INFO_LOG_LENGTH, &length); + rdata->glGetShaderiv(entry->id, GL_INFO_LOG_LENGTH, &length); if (length > 0) { info = SDL_stack_alloc(char, length); if (info) { - glGetShaderInfoLog(entry->id, length, &length, info); + rdata->glGetShaderInfoLog(entry->id, length, &length, info); } } if (info) { @@ -650,7 +776,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b } else { SDL_SetError("Failed to load the shader"); } - glDeleteShader(entry->id); + rdata->glDeleteShader(entry->id); SDL_free(entry); return NULL; } @@ -681,7 +807,7 @@ GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry) --rdata->shader_cache.count; /* Deallocate the shader */ - glDeleteShader(entry->id); + rdata->glDeleteShader(entry->id); SDL_free(entry); } @@ -701,9 +827,20 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM case GLES2_IMAGESOURCE_SOLID: ftype = GLES2_SHADER_FRAGMENT_SOLID_SRC; break; - case GLES2_IMAGESOURCE_TEXTURE: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_SRC; + case GLES2_IMAGESOURCE_TEXTURE_ABGR: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC; + break; + case GLES2_IMAGESOURCE_TEXTURE_ARGB: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC; break; + case GLES2_IMAGESOURCE_TEXTURE_RGB: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC; + break; + case GLES2_IMAGESOURCE_TEXTURE_BGR: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC; + break; + default: + goto fault; } /* Load the requested shaders */ @@ -726,9 +863,9 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM goto fault; /* Select that program in OpenGL */ - glGetError(); - glUseProgram(program->id); - if (glGetError() != GL_NO_ERROR) + rdata->glGetError(); + rdata->glUseProgram(program->id); + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to select program"); goto fault; @@ -779,9 +916,9 @@ GLES2_SetOrthographicProjection(SDL_Renderer *renderer) /* Set the projection matrix */ locProjection = rdata->current_program->uniform_locations[GLES2_UNIFORM_PROJECTION]; - glGetError(); - glUniformMatrix4fv(locProjection, 1, GL_FALSE, (GLfloat *)projection); - if (glGetError() != GL_NO_ERROR) + rdata->glGetError(); + rdata->glUniformMatrix4fv(locProjection, 1, GL_FALSE, (GLfloat *)projection); + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to set orthographic projection"); return -1; @@ -809,14 +946,16 @@ static void GLES2_RenderPresent(SDL_Renderer *renderer); static int GLES2_RenderClear(SDL_Renderer * renderer) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; + GLES2_ActivateRenderer(renderer); - glClearColor((GLfloat) renderer->r * inv255f, + rdata->glClearColor((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); - glClear(GL_COLOR_BUFFER_BIT); + rdata->glClear(GL_COLOR_BUFFER_BIT); return 0; } @@ -828,19 +967,19 @@ GLES2_SetBlendMode(GLES2_DriverContext *rdata, int blendMode) switch (blendMode) { default: case SDL_BLENDMODE_NONE: - glDisable(GL_BLEND); + rdata->glDisable(GL_BLEND); break; case SDL_BLENDMODE_BLEND: - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + rdata->glEnable(GL_BLEND); + rdata->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case SDL_BLENDMODE_ADD: - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + rdata->glEnable(GL_BLEND); + rdata->glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; case SDL_BLENDMODE_MOD: - glEnable(GL_BLEND); - glBlendFunc(GL_ZERO, GL_SRC_COLOR); + rdata->glEnable(GL_BLEND); + rdata->glBlendFunc(GL_ZERO, GL_SRC_COLOR); break; } rdata->current.blendMode = blendMode; @@ -852,9 +991,9 @@ GLES2_SetTexCoords(GLES2_DriverContext * rdata, SDL_bool enabled) { if (enabled != rdata->current.tex_coords) { if (enabled) { - glEnableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); + rdata->glEnableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); } else { - glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); + rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); } rdata->current.tex_coords = enabled; } @@ -867,7 +1006,7 @@ GLES2_SetDrawingState(SDL_Renderer * renderer) int blendMode = renderer->blendMode; GLuint locColor; - glGetError(); + rdata->glGetError(); GLES2_ActivateRenderer(renderer); @@ -881,7 +1020,7 @@ GLES2_SetDrawingState(SDL_Renderer * renderer) /* Select the color to draw with */ locColor = rdata->current_program->uniform_locations[GLES2_UNIFORM_COLOR]; - glUniform4f(locColor, + rdata->glUniform4f(locColor, renderer->r * inv255f, renderer->g * inv255f, renderer->b * inv255f, @@ -892,6 +1031,7 @@ GLES2_SetDrawingState(SDL_Renderer * renderer) static int GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat *vertices; int idx; @@ -909,11 +1049,11 @@ GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int coun vertices[idx * 2] = x; vertices[(idx * 2) + 1] = y; } - glGetError(); - glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); - glDrawArrays(GL_POINTS, 0, count); + rdata->glGetError(); + rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + rdata->glDrawArrays(GL_POINTS, 0, count); SDL_stack_free(vertices); - if (glGetError() != GL_NO_ERROR) + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to render lines"); return -1; @@ -924,6 +1064,7 @@ GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int coun static int GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat *vertices; int idx; @@ -941,17 +1082,17 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count vertices[idx * 2] = x; vertices[(idx * 2) + 1] = y; } - glGetError(); - glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); - glDrawArrays(GL_LINE_STRIP, 0, count); + rdata->glGetError(); + rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + rdata->glDrawArrays(GL_LINE_STRIP, 0, count); /* We need to close the endpoint of the line */ if (count == 2 || points[0].x != points[count-1].x || points[0].y != points[count-1].y) { - glDrawArrays(GL_POINTS, count-1, 1); + rdata->glDrawArrays(GL_POINTS, count-1, 1); } SDL_stack_free(vertices); - if (glGetError() != GL_NO_ERROR) + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to render lines"); return -1; @@ -962,6 +1103,7 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count static int GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat vertices[8]; int idx; @@ -970,7 +1112,7 @@ GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count) } /* Emit a line loop for each rectangle */ - glGetError(); + rdata->glGetError(); for (idx = 0; idx < count; ++idx) { const SDL_Rect *rect = &rects[idx]; @@ -987,10 +1129,10 @@ GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count) vertices[5] = yMax; vertices[6] = xMax; vertices[7] = yMax; - glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } - if (glGetError() != GL_NO_ERROR) + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to render lines"); return -1; @@ -1015,20 +1157,97 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s /* Activate an appropriate shader and set the projection matrix */ blendMode = texture->blendMode; - sourceType = GLES2_IMAGESOURCE_TEXTURE; + if (renderer->target) { + /* Check if we need to do color mapping between the source and render target textures */ + if (renderer->target->format != texture->format) { + switch (texture->format) + { + case SDL_PIXELFORMAT_ABGR8888: + switch (renderer->target->format) + { + case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_RGB888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + case SDL_PIXELFORMAT_BGR888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; + break; + } + break; + case SDL_PIXELFORMAT_ARGB8888: + switch (renderer->target->format) + { + case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_BGR888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + case SDL_PIXELFORMAT_RGB888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; + break; + } + break; + case SDL_PIXELFORMAT_BGR888: + switch (renderer->target->format) + { + case SDL_PIXELFORMAT_ABGR8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; + break; + case SDL_PIXELFORMAT_ARGB8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; + break; + case SDL_PIXELFORMAT_RGB888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + } + break; + case SDL_PIXELFORMAT_RGB888: + switch (renderer->target->format) + { + case SDL_PIXELFORMAT_ABGR8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + case SDL_PIXELFORMAT_ARGB8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; + break; + case SDL_PIXELFORMAT_BGR888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + } + break; + } + } + else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; // Texture formats match, use the non color mapping shader (even if the formats are not ABGR) + } + else { + switch (texture->format) + { + case SDL_PIXELFORMAT_ABGR8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; + break; + case SDL_PIXELFORMAT_ARGB8888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; + break; + case SDL_PIXELFORMAT_BGR888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; + break; + case SDL_PIXELFORMAT_RGB888: + sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; + break; + } + } if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) return -1; /* Select the target texture */ locTexture = rdata->current_program->uniform_locations[GLES2_UNIFORM_TEXTURE]; - glGetError(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(tdata->texture_type, tdata->texture); - glUniform1i(locTexture, 0); + rdata->glGetError(); + rdata->glActiveTexture(GL_TEXTURE0); + rdata->glBindTexture(tdata->texture_type, tdata->texture); + rdata->glUniform1i(locTexture, 0); /* Configure color modulation */ locModulation = rdata->current_program->uniform_locations[GLES2_UNIFORM_MODULATION]; - glUniform4f(locModulation, + rdata->glUniform4f(locModulation, texture->r * inv255f, texture->g * inv255f, texture->b * inv255f, @@ -1040,15 +1259,29 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s GLES2_SetTexCoords(rdata, SDL_TRUE); /* Emit the textured quad */ - vertices[0] = (GLfloat)dstrect->x; - vertices[1] = (GLfloat)dstrect->y; - vertices[2] = (GLfloat)(dstrect->x + dstrect->w); - vertices[3] = (GLfloat)dstrect->y; - vertices[4] = (GLfloat)dstrect->x; - vertices[5] = (GLfloat)(dstrect->y + dstrect->h); - vertices[6] = (GLfloat)(dstrect->x + dstrect->w); - vertices[7] = (GLfloat)(dstrect->y + dstrect->h); - glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + if (renderer->target) { + // Flip the texture vertically to compensate for the inversion it'll be subjected to later when it's rendered to the screen + vertices[0] = (GLfloat)dstrect->x; + vertices[1] = (GLfloat)renderer->viewport.h-dstrect->y; + vertices[2] = (GLfloat)(dstrect->x + dstrect->w); + vertices[3] = (GLfloat)renderer->viewport.h-dstrect->y; + vertices[4] = (GLfloat)dstrect->x; + vertices[5] = (GLfloat)renderer->viewport.h-(dstrect->y + dstrect->h); + vertices[6] = (GLfloat)(dstrect->x + dstrect->w); + vertices[7] = (GLfloat)renderer->viewport.h-(dstrect->y + dstrect->h); + } + else { + vertices[0] = (GLfloat)dstrect->x; + vertices[1] = (GLfloat)dstrect->y; + vertices[2] = (GLfloat)(dstrect->x + dstrect->w); + vertices[3] = (GLfloat)dstrect->y; + vertices[4] = (GLfloat)dstrect->x; + vertices[5] = (GLfloat)(dstrect->y + dstrect->h); + vertices[6] = (GLfloat)(dstrect->x + dstrect->w); + vertices[7] = (GLfloat)(dstrect->y + dstrect->h); + } + rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + texCoords[0] = srcrect->x / (GLfloat)texture->w; texCoords[1] = srcrect->y / (GLfloat)texture->h; texCoords[2] = (srcrect->x + srcrect->w) / (GLfloat)texture->w; @@ -1057,9 +1290,9 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s texCoords[5] = (srcrect->y + srcrect->h) / (GLfloat)texture->h; texCoords[6] = (srcrect->x + srcrect->w) / (GLfloat)texture->w; texCoords[7] = (srcrect->y + srcrect->h) / (GLfloat)texture->h; - glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - if (glGetError() != GL_NO_ERROR) + rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords); + rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + if (rdata->glGetError() != GL_NO_ERROR) { SDL_SetError("Failed to render texture"); return -1; @@ -1071,6 +1304,7 @@ static int GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; SDL_Window *window = renderer->window; Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888; void *temp_pixels; @@ -1090,9 +1324,9 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_GetWindowSize(window, &w, &h); - glPixelStorei(GL_PACK_ALIGNMENT, 1); + rdata->glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, + rdata->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); /* Flip the rows to be top-down */ @@ -1147,8 +1381,8 @@ GLES2_ResetState(SDL_Renderer *renderer) rdata->current.blendMode = -1; rdata->current.tex_coords = SDL_FALSE; - glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION); - glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); + rdata->glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION); + rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); } static SDL_Renderer * @@ -1160,6 +1394,20 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) #ifndef ZUNE_HD GLboolean hasCompiler; #endif + Uint32 windowFlags; + GLint window_framebuffer; + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); + + windowFlags = SDL_GetWindowFlags(window); + if (!(windowFlags & SDL_WINDOW_OPENGL)) { + if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) { + /* Uh oh, better try to put it back... */ + SDL_RecreateWindow(window, windowFlags); + return NULL; + } + } /* Create the renderer struct */ renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(SDL_Renderer)); @@ -1175,13 +1423,11 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) return NULL; } renderer->info = GLES2_RenderDriver.info; - renderer->info.flags = SDL_RENDERER_ACCELERATED; + renderer->info.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; renderer->driverdata = rdata; + renderer->window = window; /* Create an OpenGL ES 2.0 context */ - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); - rdata->context = SDL_GL_CreateContext(window); if (!rdata->context) { @@ -1193,6 +1439,11 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) return NULL; } + if (GLES2_LoadFunctions(rdata) < 0) { + GLES2_DestroyRenderer(renderer); + return NULL; + } + if (flags & SDL_RENDERER_PRESENTVSYNC) { SDL_GL_SetSwapInterval(1); } else { @@ -1204,12 +1455,12 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) /* Determine supported shader formats */ /* HACK: glGetInteger is broken on the Zune HD's compositor, so we just hardcode this */ - glGetError(); + rdata->glGetError(); #ifdef ZUNE_HD nFormats = 1; #else /* !ZUNE_HD */ - glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &nFormats); - glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler); + rdata->glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &nFormats); + rdata->glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler); if (hasCompiler) ++nFormats; #endif /* ZUNE_HD */ @@ -1224,8 +1475,8 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) #ifdef ZUNE_HD rdata->shader_formats[0] = GL_NVIDIA_PLATFORM_BINARY_NV; #else /* !ZUNE_HD */ - glGetIntegerv(GL_SHADER_BINARY_FORMATS, (GLint *)rdata->shader_formats); - if (glGetError() != GL_NO_ERROR) + rdata->glGetIntegerv(GL_SHADER_BINARY_FORMATS, (GLint *)rdata->shader_formats); + if (rdata->glGetError() != GL_NO_ERROR) { GLES2_DestroyRenderer(renderer); SDL_SetError("Failed to query supported shader formats"); @@ -1235,12 +1486,17 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) rdata->shader_formats[nFormats - 1] = (GLenum)-1; #endif /* ZUNE_HD */ + rdata->framebuffers = NULL; + rdata->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &window_framebuffer); + rdata->window_framebuffer = (GLuint)window_framebuffer; + /* Populate the function pointers for the module */ renderer->WindowEvent = &GLES2_WindowEvent; renderer->CreateTexture = &GLES2_CreateTexture; renderer->UpdateTexture = &GLES2_UpdateTexture; renderer->LockTexture = &GLES2_LockTexture; renderer->UnlockTexture = &GLES2_UnlockTexture; + renderer->SetRenderTarget = &GLES2_SetRenderTarget; renderer->UpdateViewport = &GLES2_UpdateViewport; renderer->RenderClear = &GLES2_RenderClear; renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; diff --git a/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.c b/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.c old mode 100644 new mode 100755 index e82716b14..9c2fcb865 --- a/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.c +++ b/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ static const Uint8 GLES2_FragmentSrc_SolidSrc_[] = " \ } \ "; -static const Uint8 GLES2_FragmentSrc_TextureSrc_[] = " \ +static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \ precision mediump float; \ uniform sampler2D u_texture; \ uniform vec4 u_modulation; \ @@ -68,6 +68,57 @@ static const Uint8 GLES2_FragmentSrc_TextureSrc_[] = " \ } \ "; +// ARGB to ABGR conversion +static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.r = abgr.b; \ + gl_FragColor.b = abgr.r; \ + gl_FragColor *= u_modulation; \ + } \ +"; + +// RGB to ABGR conversion +static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.r = abgr.b; \ + gl_FragColor.b = abgr.r; \ + gl_FragColor.a = 1.0; \ + gl_FragColor *= u_modulation; \ + } \ +"; + +// BGR to ABGR conversion +static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.a = 1.0; \ + gl_FragColor *= u_modulation; \ + } \ +"; + static const GLES2_ShaderInstance GLES2_VertexSrc_Default = { GL_VERTEX_SHADER, GLES2_SOURCE_SHADER, @@ -82,11 +133,32 @@ static const GLES2_ShaderInstance GLES2_FragmentSrc_SolidSrc = { GLES2_FragmentSrc_SolidSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureABGRSrc = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureSrc_), - GLES2_FragmentSrc_TextureSrc_ + sizeof(GLES2_FragmentSrc_TextureABGRSrc_), + GLES2_FragmentSrc_TextureABGRSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureARGBSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureARGBSrc_), + GLES2_FragmentSrc_TextureARGBSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureRGBSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureRGBSrc_), + GLES2_FragmentSrc_TextureRGBSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureBGRSrc_), + GLES2_FragmentSrc_TextureBGRSrc_ }; /************************************************************************************************* @@ -404,7 +476,11 @@ static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_TextureSrc = { *************************************************************************************************/ static GLES2_Shader GLES2_VertexShader_Default = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_VertexTegra_Default, @@ -414,7 +490,11 @@ static GLES2_Shader GLES2_VertexShader_Default = { }; static GLES2_Shader GLES2_FragmentShader_None_SolidSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_None_SolidSrc, @@ -424,7 +504,11 @@ static GLES2_Shader GLES2_FragmentShader_None_SolidSrc = { }; static GLES2_Shader GLES2_FragmentShader_Alpha_SolidSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Alpha_SolidSrc, @@ -434,7 +518,11 @@ static GLES2_Shader GLES2_FragmentShader_Alpha_SolidSrc = { }; static GLES2_Shader GLES2_FragmentShader_Additive_SolidSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Additive_SolidSrc, @@ -444,7 +532,11 @@ static GLES2_Shader GLES2_FragmentShader_Additive_SolidSrc = { }; static GLES2_Shader GLES2_FragmentShader_Modulated_SolidSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Modulated_SolidSrc, @@ -453,43 +545,143 @@ static GLES2_Shader GLES2_FragmentShader_Modulated_SolidSrc = { } }; -static GLES2_Shader GLES2_FragmentShader_None_TextureSrc = { +static GLES2_Shader GLES2_FragmentShader_None_TextureABGRSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_None_TextureSrc, #endif - &GLES2_FragmentSrc_TextureSrc + &GLES2_FragmentSrc_TextureABGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureSrc = { +static GLES2_Shader GLES2_FragmentShader_Alpha_TextureABGRSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Alpha_TextureSrc, #endif - &GLES2_FragmentSrc_TextureSrc + &GLES2_FragmentSrc_TextureABGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Additive_TextureSrc = { +static GLES2_Shader GLES2_FragmentShader_Additive_TextureABGRSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Additive_TextureSrc, #endif - &GLES2_FragmentSrc_TextureSrc + &GLES2_FragmentSrc_TextureABGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureSrc = { +static GLES2_Shader GLES2_FragmentShader_Modulated_TextureABGRSrc = { +#if GLES2_INCLUDE_NVIDIA_SHADERS 2, +#else + 1, +#endif { #if GLES2_INCLUDE_NVIDIA_SHADERS &GLES2_FragmentTegra_Modulated_TextureSrc, #endif - &GLES2_FragmentSrc_TextureSrc + &GLES2_FragmentSrc_TextureABGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_None_TextureARGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureARGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Alpha_TextureARGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureARGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Additive_TextureARGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureARGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Modulated_TextureARGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureARGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_None_TextureRGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureRGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Alpha_TextureRGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureRGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Additive_TextureRGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureRGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Modulated_TextureRGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureRGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_None_TextureBGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureBGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Alpha_TextureBGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureBGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Additive_TextureBGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureBGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_Modulated_TextureBGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureBGRSrc } }; @@ -504,33 +696,78 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMo case GLES2_SHADER_VERTEX_DEFAULT: return &GLES2_VertexShader_Default; case GLES2_SHADER_FRAGMENT_SOLID_SRC: + switch (blendMode) + { + case SDL_BLENDMODE_NONE: + return &GLES2_FragmentShader_None_SolidSrc; + case SDL_BLENDMODE_BLEND: + return &GLES2_FragmentShader_Alpha_SolidSrc; + case SDL_BLENDMODE_ADD: + return &GLES2_FragmentShader_Additive_SolidSrc; + case SDL_BLENDMODE_MOD: + return &GLES2_FragmentShader_Modulated_SolidSrc; + default: + return NULL; + } + case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC: switch (blendMode) - { + { case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_SolidSrc; + return &GLES2_FragmentShader_None_TextureABGRSrc; case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_SolidSrc; + return &GLES2_FragmentShader_Alpha_TextureABGRSrc; case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_SolidSrc; + return &GLES2_FragmentShader_Additive_TextureABGRSrc; case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_SolidSrc; + return &GLES2_FragmentShader_Modulated_TextureABGRSrc; default: return NULL; - } - case GLES2_SHADER_FRAGMENT_TEXTURE_SRC: + } + case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC: switch (blendMode) - { + { case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureSrc; + return &GLES2_FragmentShader_None_TextureARGBSrc; case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureSrc; + return &GLES2_FragmentShader_Alpha_TextureARGBSrc; case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureSrc; + return &GLES2_FragmentShader_Additive_TextureARGBSrc; case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureSrc; + return &GLES2_FragmentShader_Modulated_TextureARGBSrc; default: return NULL; - } + } + + case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC: + switch (blendMode) + { + case SDL_BLENDMODE_NONE: + return &GLES2_FragmentShader_None_TextureRGBSrc; + case SDL_BLENDMODE_BLEND: + return &GLES2_FragmentShader_Alpha_TextureRGBSrc; + case SDL_BLENDMODE_ADD: + return &GLES2_FragmentShader_Additive_TextureRGBSrc; + case SDL_BLENDMODE_MOD: + return &GLES2_FragmentShader_Modulated_TextureRGBSrc; + default: + return NULL; + } + + case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC: + switch (blendMode) + { + case SDL_BLENDMODE_NONE: + return &GLES2_FragmentShader_None_TextureBGRSrc; + case SDL_BLENDMODE_BLEND: + return &GLES2_FragmentShader_Alpha_TextureBGRSrc; + case SDL_BLENDMODE_ADD: + return &GLES2_FragmentShader_Additive_TextureBGRSrc; + case SDL_BLENDMODE_MOD: + return &GLES2_FragmentShader_Modulated_TextureBGRSrc; + default: + return NULL; + } + default: return NULL; } diff --git a/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.h b/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.h old mode 100644 new mode 100755 index c34d7e587..53da41a54 --- a/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.h +++ b/project/jni/sdl-1.3/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,10 @@ typedef enum { GLES2_SHADER_VERTEX_DEFAULT, GLES2_SHADER_FRAGMENT_SOLID_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_SRC + GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC } GLES2_ShaderType; #define GLES2_SOURCE_SHADER (GLenum)-1 diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.c b/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.c old mode 100644 new mode 100755 index f7d7e705a..5b399d1f1 --- a/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.h b/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.h old mode 100644 new mode 100755 index ad4829f11..6ea88b56a --- a/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendline.c b/project/jni/sdl-1.3/src/render/software/SDL_blendline.c old mode 100644 new mode 100755 index 796bd91eb..3f73a64b6 --- a/project/jni/sdl-1.3/src/render/software/SDL_blendline.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendline.h b/project/jni/sdl-1.3/src/render/software/SDL_blendline.h old mode 100644 new mode 100755 index 407b60c41..c9da31c97 --- a/project/jni/sdl-1.3/src/render/software/SDL_blendline.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.c b/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.c old mode 100644 new mode 100755 index 96a07631a..4d5ac762d --- a/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.h b/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.h old mode 100644 new mode 100755 index 3189cf9ee..4c1e76dc0 --- a/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_draw.h b/project/jni/sdl-1.3/src/render/software/SDL_draw.h old mode 100644 new mode 100755 index 12cd6849c..e262f7d65 --- a/project/jni/sdl-1.3/src/render/software/SDL_draw.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_drawline.c b/project/jni/sdl-1.3/src/render/software/SDL_drawline.c old mode 100644 new mode 100755 index b3a963418..f48767784 --- a/project/jni/sdl-1.3/src/render/software/SDL_drawline.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_drawline.h b/project/jni/sdl-1.3/src/render/software/SDL_drawline.h old mode 100644 new mode 100755 index 2c582d747..9d8a5a4ee --- a/project/jni/sdl-1.3/src/render/software/SDL_drawline.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.c b/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.c old mode 100644 new mode 100755 index 9ee3686e0..8c19c618b --- a/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.h b/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.h old mode 100644 new mode 100755 index 481cf93e2..56f857538 --- a/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/render/software/SDL_render_sw.c b/project/jni/sdl-1.3/src/render/software/SDL_render_sw.c old mode 100644 new mode 100755 index ce63f1dee..d8e2d872d --- a/project/jni/sdl-1.3/src/render/software/SDL_render_sw.c +++ b/project/jni/sdl-1.3/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,6 +51,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int SW_UpdateViewport(SDL_Renderer * renderer); static int SW_RenderClear(SDL_Renderer * renderer); static int SW_RenderDrawPoints(SDL_Renderer * renderer, @@ -72,7 +73,7 @@ SDL_RenderDriver SW_RenderDriver = { SW_CreateRenderer, { "software", - SDL_RENDERER_SOFTWARE, + SDL_RENDERER_SOFTWARE | SDL_RENDERER_TARGETTEXTURE, 8, { SDL_PIXELFORMAT_RGB555, @@ -91,6 +92,7 @@ SDL_RenderDriver SW_RenderDriver = { typedef struct { SDL_Surface *surface; + SDL_Surface *window; } SW_RenderData; @@ -100,7 +102,10 @@ SW_ActivateRenderer(SDL_Renderer * renderer) SW_RenderData *data = (SW_RenderData *) renderer->driverdata; if (!data->surface) { - data->surface = SDL_GetWindowSurface(renderer->window); + data->surface = data->window; + } + if (!data->surface) { + data->surface = data->window = SDL_GetWindowSurface(renderer->window); SW_UpdateViewport(renderer); } @@ -140,8 +145,8 @@ SW_CreateRendererForSurface(SDL_Surface * surface) renderer->UpdateTexture = SW_UpdateTexture; renderer->LockTexture = SW_LockTexture; renderer->UnlockTexture = SW_UnlockTexture; + renderer->SetRenderTarget = SW_SetRenderTarget; renderer->UpdateViewport = SW_UpdateViewport; - renderer->DestroyTexture = SW_DestroyTexture; renderer->RenderClear = SW_RenderClear; renderer->RenderDrawPoints = SW_RenderDrawPoints; renderer->RenderDrawLines = SW_RenderDrawLines; @@ -149,6 +154,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface) renderer->RenderCopy = SW_RenderCopy; renderer->RenderReadPixels = SW_RenderReadPixels; renderer->RenderPresent = SW_RenderPresent; + renderer->DestroyTexture = SW_DestroyTexture; renderer->DestroyRenderer = SW_DestroyRenderer; renderer->info = SW_RenderDriver.info; renderer->driverdata = data; @@ -177,6 +183,7 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) { data->surface = NULL; + data->window = NULL; } } @@ -276,6 +283,19 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) { } +static int +SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + SW_RenderData *data = (SW_RenderData *) renderer->driverdata; + + if (texture ) { + data->surface = (SDL_Surface *) texture->driverdata; + } else { + data->surface = data->window; + } + return 0; +} + static int SW_UpdateViewport(SDL_Renderer * renderer) { diff --git a/project/jni/sdl-1.3/src/render/software/SDL_render_sw_c.h b/project/jni/sdl-1.3/src/render/software/SDL_render_sw_c.h old mode 100644 new mode 100755 index 3895563fa..e6218eeda --- a/project/jni/sdl-1.3/src/render/software/SDL_render_sw_c.h +++ b/project/jni/sdl-1.3/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_getenv.c b/project/jni/sdl-1.3/src/stdlib/SDL_getenv.c old mode 100644 new mode 100755 index 561b38d4b..d90bd2564 --- a/project/jni/sdl-1.3/src/stdlib/SDL_getenv.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_iconv.c b/project/jni/sdl-1.3/src/stdlib/SDL_iconv.c old mode 100644 new mode 100755 index 225e03368..e67be619b --- a/project/jni/sdl-1.3/src/stdlib/SDL_iconv.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_malloc.c b/project/jni/sdl-1.3/src/stdlib/SDL_malloc.c old mode 100644 new mode 100755 index fe3136f8d..142e5f59a --- a/project/jni/sdl-1.3/src/stdlib/SDL_malloc.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_qsort.c b/project/jni/sdl-1.3/src/stdlib/SDL_qsort.c index b91be69ca..6d56c6758 100644 --- a/project/jni/sdl-1.3/src/stdlib/SDL_qsort.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_qsort.c @@ -49,11 +49,12 @@ #include */ #include "SDL_stdinc.h" +#include "SDL_assert.h" #ifdef assert #undef assert #endif -#define assert(X) +#define assert(X) SDL_assert(X) #ifdef malloc #undef malloc #endif diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_stdlib.c b/project/jni/sdl-1.3/src/stdlib/SDL_stdlib.c old mode 100644 new mode 100755 index 70d31eb07..c4059f637 --- a/project/jni/sdl-1.3/src/stdlib/SDL_stdlib.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/stdlib/SDL_string.c b/project/jni/sdl-1.3/src/stdlib/SDL_string.c old mode 100644 new mode 100755 index 69a1c8c80..b8536e81e --- a/project/jni/sdl-1.3/src/stdlib/SDL_string.c +++ b/project/jni/sdl-1.3/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/SDL_systhread.h b/project/jni/sdl-1.3/src/thread/SDL_systhread.h old mode 100644 new mode 100755 index 6e4dba77b..51a95a4b3 --- a/project/jni/sdl-1.3/src/thread/SDL_systhread.h +++ b/project/jni/sdl-1.3/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/SDL_thread.c b/project/jni/sdl-1.3/src/thread/SDL_thread.c old mode 100644 new mode 100755 index 2f1aeb975..8b6d30ce0 --- a/project/jni/sdl-1.3/src/thread/SDL_thread.c +++ b/project/jni/sdl-1.3/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/SDL_thread_c.h b/project/jni/sdl-1.3/src/thread/SDL_thread_c.h old mode 100644 new mode 100755 index 08ebd7bc8..565eb3d0e --- a/project/jni/sdl-1.3/src/thread/SDL_thread_c.h +++ b/project/jni/sdl-1.3/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/beos/SDL_syssem.c b/project/jni/sdl-1.3/src/thread/beos/SDL_syssem.c old mode 100644 new mode 100755 index afaccaf1a..7237bd5ec --- a/project/jni/sdl-1.3/src/thread/beos/SDL_syssem.c +++ b/project/jni/sdl-1.3/src/thread/beos/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/beos/SDL_systhread.c b/project/jni/sdl-1.3/src/thread/beos/SDL_systhread.c old mode 100644 new mode 100755 index ff255ff76..9558e2937 --- a/project/jni/sdl-1.3/src/thread/beos/SDL_systhread.c +++ b/project/jni/sdl-1.3/src/thread/beos/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/beos/SDL_systhread_c.h b/project/jni/sdl-1.3/src/thread/beos/SDL_systhread_c.h old mode 100644 new mode 100755 index f1cc8d570..8acc3d990 --- a/project/jni/sdl-1.3/src/thread/beos/SDL_systhread_c.h +++ b/project/jni/sdl-1.3/src/thread/beos/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_syscond.c b/project/jni/sdl-1.3/src/thread/generic/SDL_syscond.c old mode 100644 new mode 100755 index eeec26ebd..7304badc1 --- a/project/jni/sdl-1.3/src/thread/generic/SDL_syscond.c +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex.c b/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex.c old mode 100644 new mode 100755 index b2d3fb71b..1a6b2715c --- a/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex.c +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex_c.h b/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex_c.h old mode 100644 new mode 100755 index 998229c95..ed546b689 --- a/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex_c.h +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_syssem.c b/project/jni/sdl-1.3/src/thread/generic/SDL_syssem.c old mode 100644 new mode 100755 index 5219a4433..f99e42acd --- a/project/jni/sdl-1.3/src/thread/generic/SDL_syssem.c +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_systhread.c b/project/jni/sdl-1.3/src/thread/generic/SDL_systhread.c old mode 100644 new mode 100755 index ecab2909f..ed557a461 --- a/project/jni/sdl-1.3/src/thread/generic/SDL_systhread.c +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/generic/SDL_systhread_c.h b/project/jni/sdl-1.3/src/thread/generic/SDL_systhread_c.h old mode 100644 new mode 100755 index 3287f9357..dd1fb6bc1 --- a/project/jni/sdl-1.3/src/thread/generic/SDL_systhread_c.h +++ b/project/jni/sdl-1.3/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_syscond.c b/project/jni/sdl-1.3/src/thread/nds/SDL_syscond.c old mode 100644 new mode 100755 index 0892b1e70..b1ce59514 --- a/project/jni/sdl-1.3/src/thread/nds/SDL_syscond.c +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_syscond_c.h b/project/jni/sdl-1.3/src/thread/nds/SDL_syscond_c.h old mode 100644 new mode 100755 index cfa68e05a..f0049a10f --- a/project/jni/sdl-1.3/src/thread/nds/SDL_syscond_c.h +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_syscond_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex.c b/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex.c old mode 100644 new mode 100755 index 6096a8934..4c7757157 --- a/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex.c +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex_c.h b/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex_c.h old mode 100644 new mode 100755 index 24ed63ea6..d193d037c --- a/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex_c.h +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_syssem.c b/project/jni/sdl-1.3/src/thread/nds/SDL_syssem.c old mode 100644 new mode 100755 index 93593d4b8..eedce574d --- a/project/jni/sdl-1.3/src/thread/nds/SDL_syssem.c +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_syssem_c.h b/project/jni/sdl-1.3/src/thread/nds/SDL_syssem_c.h old mode 100644 new mode 100755 index 8c6c75ba6..b5aa420ba --- a/project/jni/sdl-1.3/src/thread/nds/SDL_syssem_c.h +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_syssem_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_systhread.c b/project/jni/sdl-1.3/src/thread/nds/SDL_systhread.c old mode 100644 new mode 100755 index 0355db870..0772b2ac0 --- a/project/jni/sdl-1.3/src/thread/nds/SDL_systhread.c +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/nds/SDL_systhread_c.h b/project/jni/sdl-1.3/src/thread/nds/SDL_systhread_c.h old mode 100644 new mode 100755 index d02b54b14..2df2fea78 --- a/project/jni/sdl-1.3/src/thread/nds/SDL_systhread_c.h +++ b/project/jni/sdl-1.3/src/thread/nds/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_syscond.c b/project/jni/sdl-1.3/src/thread/pthread/SDL_syscond.c old mode 100644 new mode 100755 index 9d9bb0979..9c05bf816 --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_syscond.c +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex.c b/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex.c old mode 100644 new mode 100755 index 6d273d74b..b0c83ce6a --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex.c +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex_c.h b/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex_c.h old mode 100644 new mode 100755 index f14697501..5070e364b --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex_c.h +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_syssem.c b/project/jni/sdl-1.3/src/thread/pthread/SDL_syssem.c old mode 100644 new mode 100755 index 9940c5f27..91959c1b6 --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_syssem.c +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,8 +103,12 @@ int SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) { int retval; +#ifdef HAVE_SEM_TIMEDWAIT struct timeval now; struct timespec ts_timeout; +#else + Uint32 end; +#endif if (!sem) { SDL_SetError("Passed a NULL semaphore"); @@ -119,6 +123,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) return SDL_SemWait(sem); } +#ifdef HAVE_SEM_TIMEDWAIT /* Setup the timeout. sem_timedwait doesn't wait for * a lapse of time, but until we reach a certain time. * This time is now plus the timeout. @@ -145,8 +150,21 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) } while (retval < 0 && errno == EINTR); if (retval < 0) { - SDL_SetError("sem_timedwait() failed"); + if (errno == ETIMEDOUT) { + retval = SDL_MUTEX_TIMEDOUT; + } else { + SDL_SetError(strerror(errno)); + } } +#else + end = SDL_GetTicks() + timeout; + while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) { + if ((SDL_GetTicks() - end) >= 0) { + break; + } + SDL_Delay(0); + } +#endif /* HAVE_SEM_TIMEDWAIT */ return retval; } diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread.c b/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread.c old mode 100644 new mode 100755 index ef4bc2c5a..292f7dcab --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread.c +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread_c.h b/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread_c.h old mode 100644 new mode 100755 index 2cba5fe77..b00be7ca5 --- a/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread_c.h +++ b/project/jni/sdl-1.3/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/windows/SDL_sysmutex.c b/project/jni/sdl-1.3/src/thread/windows/SDL_sysmutex.c old mode 100644 new mode 100755 index ab35a9614..779314277 --- a/project/jni/sdl-1.3/src/thread/windows/SDL_sysmutex.c +++ b/project/jni/sdl-1.3/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/windows/SDL_syssem.c b/project/jni/sdl-1.3/src/thread/windows/SDL_syssem.c old mode 100644 new mode 100755 index b1543dab9..98b5ba7de --- a/project/jni/sdl-1.3/src/thread/windows/SDL_syssem.c +++ b/project/jni/sdl-1.3/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/windows/SDL_systhread.c b/project/jni/sdl-1.3/src/thread/windows/SDL_systhread.c old mode 100644 new mode 100755 index 47bc0d20e..efe2ccb31 --- a/project/jni/sdl-1.3/src/thread/windows/SDL_systhread.c +++ b/project/jni/sdl-1.3/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/thread/windows/SDL_systhread_c.h b/project/jni/sdl-1.3/src/thread/windows/SDL_systhread_c.h old mode 100644 new mode 100755 index fd10a4080..834fd2d3f --- a/project/jni/sdl-1.3/src/thread/windows/SDL_systhread_c.h +++ b/project/jni/sdl-1.3/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/SDL_timer.c b/project/jni/sdl-1.3/src/timer/SDL_timer.c old mode 100644 new mode 100755 index 0d4ce20b5..69500450e --- a/project/jni/sdl-1.3/src/timer/SDL_timer.c +++ b/project/jni/sdl-1.3/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/SDL_timer_c.h b/project/jni/sdl-1.3/src/timer/SDL_timer_c.h old mode 100644 new mode 100755 index da2a1c110..632869ade --- a/project/jni/sdl-1.3/src/timer/SDL_timer_c.h +++ b/project/jni/sdl-1.3/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/beos/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/beos/SDL_systimer.c old mode 100644 new mode 100755 index 1befefe22..2ad4cc3ba --- a/project/jni/sdl-1.3/src/timer/beos/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/beos/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/dummy/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/dummy/SDL_systimer.c old mode 100644 new mode 100755 index 57d169384..a5dac55c5 --- a/project/jni/sdl-1.3/src/timer/dummy/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/nds/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/nds/SDL_systimer.c old mode 100644 new mode 100755 index 7c3565013..7d567fde7 --- a/project/jni/sdl-1.3/src/timer/nds/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/nds/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/unix/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/unix/SDL_systimer.c old mode 100644 new mode 100755 index 747ba3dfc..f8fb067cf --- a/project/jni/sdl-1.3/src/timer/unix/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/wince/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/wince/SDL_systimer.c old mode 100644 new mode 100755 index 18cd58428..b9bac4ed2 --- a/project/jni/sdl-1.3/src/timer/wince/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/wince/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/timer/windows/SDL_systimer.c b/project/jni/sdl-1.3/src/timer/windows/SDL_systimer.c old mode 100644 new mode 100755 index e74f59b5a..d721832f7 --- a/project/jni/sdl-1.3/src/timer/windows/SDL_systimer.c +++ b/project/jni/sdl-1.3/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_RLEaccel.c b/project/jni/sdl-1.3/src/video/SDL_RLEaccel.c old mode 100644 new mode 100755 index 562341d0f..40fe95719 --- a/project/jni/sdl-1.3/src/video/SDL_RLEaccel.c +++ b/project/jni/sdl-1.3/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_RLEaccel_c.h b/project/jni/sdl-1.3/src/video/SDL_RLEaccel_c.h old mode 100644 new mode 100755 index 71e0018e6..5e9bd30ca --- a/project/jni/sdl-1.3/src/video/SDL_RLEaccel_c.h +++ b/project/jni/sdl-1.3/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit.c b/project/jni/sdl-1.3/src/video/SDL_blit.c old mode 100644 new mode 100755 index 775b6c380..f63289ce0 --- a/project/jni/sdl-1.3/src/video/SDL_blit.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit.h b/project/jni/sdl-1.3/src/video/SDL_blit.h old mode 100644 new mode 100755 index 1deb98ed6..6a5983d30 --- a/project/jni/sdl-1.3/src/video/SDL_blit.h +++ b/project/jni/sdl-1.3/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,8 @@ typedef struct SDL_BlitMap /* the version count matches the destination; mismatch indicates an invalid mapping */ - Uint32 palette_version; + Uint32 dst_palette_version; + Uint32 src_palette_version; } SDL_BlitMap; /* Functions found in SDL_blit.c */ diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_0.c b/project/jni/sdl-1.3/src/video/SDL_blit_0.c old mode 100644 new mode 100755 index ad9aa78a2..5c2735745 --- a/project/jni/sdl-1.3/src/video/SDL_blit_0.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_1.c b/project/jni/sdl-1.3/src/video/SDL_blit_1.c old mode 100644 new mode 100755 index d6c1d17f0..9bdda4426 --- a/project/jni/sdl-1.3/src/video/SDL_blit_1.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_A.c b/project/jni/sdl-1.3/src/video/SDL_blit_A.c old mode 100644 new mode 100755 index d0e9a46b1..d8537ee74 --- a/project/jni/sdl-1.3/src/video/SDL_blit_A.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -424,7 +424,6 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) #if HAVE_ALTIVEC_H #include #endif -#include #if (defined(__MACOSX__) && (__GNUC__ < 4)) #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ @@ -498,9 +497,10 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) /* ARGB */ const static struct SDL_PixelFormat default_pixel_format = { 0, NULL, 0, 0, + {0, 0}, + 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 0, 0, 0, 0, 16, 8, 0, 24, - 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 0, NULL }; if (!srcfmt) { diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_N.c b/project/jni/sdl-1.3/src/video/SDL_blit_N.c old mode 100644 new mode 100755 index 762a67939..a87df23ae --- a/project/jni/sdl-1.3/src/video/SDL_blit_N.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,14 @@ #include "SDL_cpuinfo.h" #include "SDL_blit.h" +#include "SDL_assert.h" + /* Functions to blit from N-bit surfaces to other surfaces */ #if SDL_ALTIVEC_BLITTERS -#define assert(X) +#ifdef HAVE_ALTIVEC_H +#include +#endif #ifdef __MACOSX__ #include static size_t @@ -108,9 +112,10 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) /* ARGB */ const static const struct SDL_PixelFormat default_pixel_format = { 0, NULL, 0, 0, + {0, 0}, + 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 0, 0, 0, 0, 16, 8, 0, 24, - 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 0, NULL }; if (!srcfmt) { @@ -239,7 +244,7 @@ Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info) vsrc = voverflow; } - assert(width == 0); + SDL_assert(width == 0); /* do scalar until we can align... */ ONE_PIXEL_BLEND((extrawidth), extrawidth); @@ -308,9 +313,8 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info) char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8)) ); - - assert(srcfmt->BytesPerPixel == 2); - assert(dstfmt->BytesPerPixel == 4); + SDL_assert(srcfmt->BytesPerPixel == 2); + SDL_assert(dstfmt->BytesPerPixel == 4); vf800 = (vector unsigned short) vec_splat_u8(-7); vf800 = vec_sl(vf800, vec_splat_u16(8)); @@ -386,7 +390,7 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info) vsrc = voverflow; } - assert(width == 0); + SDL_assert(width == 0); /* do scalar until we can align... */ @@ -456,9 +460,8 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info) char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8)) ); - - assert(srcfmt->BytesPerPixel == 2); - assert(dstfmt->BytesPerPixel == 4); + SDL_assert(srcfmt->BytesPerPixel == 2); + SDL_assert(dstfmt->BytesPerPixel == 4); vf800 = (vector unsigned short) vec_splat_u8(-7); vf800 = vec_sl(vf800, vec_splat_u16(8)); @@ -534,7 +537,7 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info) vsrc = voverflow; } - assert(width == 0); + SDL_assert(width == 0); /* do scalar until we can align... */ @@ -626,13 +629,13 @@ Blit32to32KeyAltivec(SDL_BlitInfo * info) } int width = info->dst_w; ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width); - assert(width > 0); + SDL_assert(width > 0); if (width > 0) { int extrawidth = (width % 4); vector unsigned char valigner = VEC_ALIGNER(srcp); vector unsigned int vs = vec_ld(0, srcp); width -= extrawidth; - assert(width >= 4); + SDL_assert(width >= 4); while (width) { vector unsigned char vsel; vector unsigned int vd; @@ -687,8 +690,8 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info) } } - assert(srcfmt->BytesPerPixel == 4); - assert(dstfmt->BytesPerPixel == 4); + SDL_assert(srcfmt->BytesPerPixel == 4); + SDL_assert(dstfmt->BytesPerPixel == 4); while (height--) { vector unsigned char valigner; @@ -704,6 +707,8 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info) while ((UNALIGNED_PTR(dst)) && (width)) { bits = *(src++); RGBA_FROM_8888(bits, srcfmt, r, g, b, a); + if(!srcfmt->Amask) + a = info->a; *(dst++) = MAKE8888(dstfmt, r, g, b, a); width--; } @@ -725,12 +730,14 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info) vbits = voverflow; } - assert(width == 0); + SDL_assert(width == 0); /* cover pixels at the end of the row that didn't fit in 16 bytes. */ while (extrawidth) { bits = *(src++); /* max 7 pixels, don't bother with prefetch. */ RGBA_FROM_8888(bits, srcfmt, r, g, b, a); + if(!srcfmt->Amask) + a = info->a; *(dst++) = MAKE8888(dstfmt, r, g, b, a); extrawidth--; } @@ -766,8 +773,8 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info) } } - assert(srcfmt->BytesPerPixel == 4); - assert(dstfmt->BytesPerPixel == 4); + SDL_assert(srcfmt->BytesPerPixel == 4); + SDL_assert(dstfmt->BytesPerPixel == 4); while (height--) { vector unsigned char valigner; @@ -787,6 +794,8 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info) DST_CHAN_DEST); bits = *(src++); RGBA_FROM_8888(bits, srcfmt, r, g, b, a); + if(!srcfmt->Amask) + a = info->a; *(dst++) = MAKE8888(dstfmt, r, g, b, a); width--; } @@ -812,12 +821,14 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info) vbits = voverflow; } - assert(width == 0); + SDL_assert(width == 0); /* cover pixels at the end of the row that didn't fit in 16 bytes. */ while (extrawidth) { bits = *(src++); /* max 7 pixels, don't bother with prefetch. */ RGBA_FROM_8888(bits, srcfmt, r, g, b, a); + if(!srcfmt->Amask) + a = info->a; *(dst++) = MAKE8888(dstfmt, r, g, b, a); extrawidth--; } diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_auto.c b/project/jni/sdl-1.3/src/video/SDL_blit_auto.c old mode 100644 new mode 100755 index 287f0449e..dbe71f94e --- a/project/jni/sdl-1.3/src/video/SDL_blit_auto.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_auto.h b/project/jni/sdl-1.3/src/video/SDL_blit_auto.h old mode 100644 new mode 100755 index 4137c5b9e..0fa4f6f61 --- a/project/jni/sdl-1.3/src/video/SDL_blit_auto.h +++ b/project/jni/sdl-1.3/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_copy.c b/project/jni/sdl-1.3/src/video/SDL_blit_copy.c old mode 100644 new mode 100755 index a9f98eb73..aa6fc8ade --- a/project/jni/sdl-1.3/src/video/SDL_blit_copy.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_copy.h b/project/jni/sdl-1.3/src/video/SDL_blit_copy.h old mode 100644 new mode 100755 index 84fbef57f..f1436bab4 --- a/project/jni/sdl-1.3/src/video/SDL_blit_copy.h +++ b/project/jni/sdl-1.3/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_slow.c b/project/jni/sdl-1.3/src/video/SDL_blit_slow.c old mode 100644 new mode 100755 index 6e0b924b9..ce1327e2d --- a/project/jni/sdl-1.3/src/video/SDL_blit_slow.c +++ b/project/jni/sdl-1.3/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_blit_slow.h b/project/jni/sdl-1.3/src/video/SDL_blit_slow.h old mode 100644 new mode 100755 index 87b179381..e298d6972 --- a/project/jni/sdl-1.3/src/video/SDL_blit_slow.h +++ b/project/jni/sdl-1.3/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_bmp.c b/project/jni/sdl-1.3/src/video/SDL_bmp.c old mode 100644 new mode 100755 index f73c84a16..c31d022f0 --- a/project/jni/sdl-1.3/src/video/SDL_bmp.c +++ b/project/jni/sdl-1.3/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_clipboard.c b/project/jni/sdl-1.3/src/video/SDL_clipboard.c old mode 100644 new mode 100755 index 3cc233a89..14c6c569f --- a/project/jni/sdl-1.3/src/video/SDL_clipboard.c +++ b/project/jni/sdl-1.3/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_fillrect.c b/project/jni/sdl-1.3/src/video/SDL_fillrect.c old mode 100644 new mode 100755 index c1ea905c7..41c8b75b4 --- a/project/jni/sdl-1.3/src/video/SDL_fillrect.c +++ b/project/jni/sdl-1.3/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_pixels.c b/project/jni/sdl-1.3/src/video/SDL_pixels.c old mode 100644 new mode 100755 index b8b6d1e3a..5297da3db --- a/project/jni/sdl-1.3/src/video/SDL_pixels.c +++ b/project/jni/sdl-1.3/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -231,7 +231,7 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, masks[3] = 0x00000003; break; default: - SDL_SetError("SDL_PixelFormatEnumToMasks: Unknown pixel format - unknown pixel layout"); + SDL_SetError("Unknown pixel format"); return SDL_FALSE; } @@ -281,7 +281,7 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, *Rmask = masks[3]; break; default: - SDL_SetError("SDL_PixelFormatEnumToMasks: Unknown pixel format - unknown pixel order"); + SDL_SetError("Unknown pixel format"); return SDL_FALSE; } return SDL_TRUE; @@ -971,8 +971,15 @@ SDL_InvalidateMap(SDL_BlitMap * map) if (!map) { return; } + if (map->dst) { + /* Release our reference to the surface - see the note below */ + if (--map->dst->refcount <= 0) { + SDL_FreeSurface(map->dst); + } + } map->dst = NULL; - map->palette_version = 0; + map->src_palette_version = 0; + map->dst_palette_version = 0; if (map->info.table) { SDL_free(map->info.table); map->info.table = NULL; @@ -1038,10 +1045,27 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst) map->dst = dst; + if (map->dst) { + /* Keep a reference to this surface so it doesn't get deleted + while we're still pointing at it. + + A better method would be for the destination surface to keep + track of surfaces that are mapped to it and automatically + invalidate them when it is freed, but this will do for now. + */ + ++map->dst->refcount; + } + if (dstfmt->palette) { - map->palette_version = dstfmt->palette->version; + map->dst_palette_version = dstfmt->palette->version; } else { - map->palette_version = 0; + map->dst_palette_version = 0; + } + + if (srcfmt->palette) { + map->src_palette_version = srcfmt->palette->version; + } else { + map->src_palette_version = 0; } /* Choose your blitters wisely */ diff --git a/project/jni/sdl-1.3/src/video/SDL_pixels.c.diff b/project/jni/sdl-1.3/src/video/SDL_pixels.c.diff new file mode 100644 index 000000000..37045e055 --- /dev/null +++ b/project/jni/sdl-1.3/src/video/SDL_pixels.c.diff @@ -0,0 +1,12 @@ +--- SDL_pixels.c 2012-05-23 16:29:23.211504618 +0300 ++++ /home/pelya/src/endless_space/SDL-android/project/jni/sdl-1.3/src/video/SDL_pixels.c 2012-02-03 16:56:28.000000000 +0200 +@@ -754,6 +754,9 @@ + default: + break; + } ++#ifdef __ANDROID__ ++ if( surface->format->BytesPerPixel != 2 ) /* Avoid extra memcpy() when calling SDL_UpdateTexture() */ ++#endif + pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + return (pitch); + } diff --git a/project/jni/sdl-1.3/src/video/SDL_pixels_c.h b/project/jni/sdl-1.3/src/video/SDL_pixels_c.h old mode 100644 new mode 100755 index d4e60d7e1..049e34851 --- a/project/jni/sdl-1.3/src/video/SDL_pixels_c.h +++ b/project/jni/sdl-1.3/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_rect.c b/project/jni/sdl-1.3/src/video/SDL_rect.c old mode 100644 new mode 100755 index fba69fc2d..f6abddda5 --- a/project/jni/sdl-1.3/src/video/SDL_rect.c +++ b/project/jni/sdl-1.3/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_rect_c.h b/project/jni/sdl-1.3/src/video/SDL_rect_c.h old mode 100644 new mode 100755 index 7c74f3d4b..490013ca8 --- a/project/jni/sdl-1.3/src/video/SDL_rect_c.h +++ b/project/jni/sdl-1.3/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_shape.c b/project/jni/sdl-1.3/src/video/SDL_shape.c old mode 100644 new mode 100755 index 3e0c030f8..1a807258f --- a/project/jni/sdl-1.3/src/video/SDL_shape.c +++ b/project/jni/sdl-1.3/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_shape_internals.h b/project/jni/sdl-1.3/src/video/SDL_shape_internals.h old mode 100644 new mode 100755 index 9d0dc8732..eb6b1e38e --- a/project/jni/sdl-1.3/src/video/SDL_shape_internals.h +++ b/project/jni/sdl-1.3/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_stretch.c b/project/jni/sdl-1.3/src/video/SDL_stretch.c old mode 100644 new mode 100755 index 92a37c923..6f8084519 --- a/project/jni/sdl-1.3/src/video/SDL_stretch.c +++ b/project/jni/sdl-1.3/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/SDL_surface.c b/project/jni/sdl-1.3/src/video/SDL_surface.c old mode 100644 new mode 100755 index 1ed3aeaa2..eb63904ea --- a/project/jni/sdl-1.3/src/video/SDL_surface.c +++ b/project/jni/sdl-1.3/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,6 @@ #include "SDL_config.h" #include "SDL_video.h" -#include "SDL_compat.h" #include "SDL_sysvideo.h" #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" @@ -46,7 +45,7 @@ SDL_CreateRGBSurface(Uint32 flags, /* Get the pixel format */ format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask); if (format == SDL_PIXELFORMAT_UNKNOWN) { - SDL_SetError("SDL_CreateRGBSurface: Unknown pixel format: depth %d masks 0x%x 0x%x 0x%x 0x%x", depth, Rmask, Gmask, Bmask, Amask); + SDL_SetError("Unknown pixel format"); return NULL; } @@ -195,13 +194,6 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key) SDL_InvalidateMap(surface->map); } - /* Compatibility mode */ - if (surface->map->info.flags & SDL_COPY_COLORKEY) { - surface->flags |= SDL_SRCCOLORKEY; - } else { - surface->flags &= ~SDL_SRCCOLORKEY; - } - return 0; } @@ -405,13 +397,6 @@ SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode) SDL_InvalidateMap(surface->map); } - /* Compatibility mode */ - if (surface->map->info.flags & SDL_COPY_BLEND) { - surface->flags |= SDL_SRCALPHA; - } else { - surface->flags &= ~SDL_SRCALPHA; - } - return status; } @@ -494,7 +479,9 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect, /* Check to make sure the blit mapping is valid */ if ((src->map->dst != dst) || (dst->format->palette && - src->map->palette_version != dst->format->palette->version)) { + src->map->dst_palette_version != dst->format->palette->version) || + (src->format->palette && + src->map->src_palette_version != src->format->palette->version)) { if (SDL_MapSurface(src, dst) < 0) { return (-1); } diff --git a/project/jni/sdl-1.3/src/video/SDL_sysvideo.h b/project/jni/sdl-1.3/src/video/SDL_sysvideo.h old mode 100644 new mode 100755 index 416bfb6d2..679be4bf8 --- a/project/jni/sdl-1.3/src/video/SDL_sysvideo.h +++ b/project/jni/sdl-1.3/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -270,6 +270,8 @@ struct SDL_VideoDevice int accelerated; int major_version; int minor_version; + int flags; + int profile_mask; int retained_backing; int driver_loaded; char driver_path[256]; @@ -286,7 +288,7 @@ struct SDL_VideoDevice void *driverdata; struct SDL_GLDriverData *gl_data; -#if SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES struct SDL_PrivateGLESData *gles_data; #endif diff --git a/project/jni/sdl-1.3/src/video/SDL_video.c b/project/jni/sdl-1.3/src/video/SDL_video.c old mode 100644 new mode 100755 index e353f1ea7..1fca2fd4c --- a/project/jni/sdl-1.3/src/video/SDL_video.c +++ b/project/jni/sdl-1.3/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,6 @@ #include "SDL_pixels_c.h" #include "SDL_rect_c.h" #include "../events/SDL_events_c.h" -#include #if SDL_VIDEO_OPENGL #include "SDL_opengl.h" @@ -87,16 +86,15 @@ static VideoBootStrap *bootstrap[] = { static SDL_VideoDevice *_this = NULL; -#define CHECK_WINDOW_MAGIC1(window, retval, F, L) \ +#define CHECK_WINDOW_MAGIC(window, retval) \ if (!_this) { \ SDL_UninitializedVideo(); \ return retval; \ } \ if (!window || window->magic != &_this->window_magic) { \ - SDL_SetError("CHECK_WINDOW_MAGIC: Invalid window %p at %s:%d", window, F, L); \ + SDL_SetError("Invalid window"); \ return retval; \ } -#define CHECK_WINDOW_MAGIC(window, retval) CHECK_WINDOW_MAGIC1(window, retval, __FILE__, __LINE__) #define CHECK_DISPLAY_INDEX(displayIndex, retval) \ if (!_this) { \ @@ -109,6 +107,11 @@ static SDL_VideoDevice *_this = NULL; return retval; \ } +#define INVALIDATE_GLCONTEXT() \ + _this->current_glwin = NULL; \ + _this->current_glctx = NULL; + + /* Support for framebuffer emulation using an accelerated renderer */ #define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData" @@ -191,6 +194,9 @@ ShouldUseTextureFramebuffer() } return hasAcceleratedOpenGL; } +#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* Let's be optimistic about this! */ + return SDL_TRUE; #else return SDL_FALSE; #endif @@ -210,8 +216,6 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix SDL_RendererInfo info; Uint32 i; - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindowTexture %dx%d", window->w, window->h); - data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); if (!data) { SDL_Renderer *renderer = NULL; @@ -243,6 +247,7 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix } } if (!renderer) { + SDL_SetError("No hardware accelerated renderers available"); return -1; } @@ -499,6 +504,8 @@ SDL_VideoInit(const char *driver_name) _this->gl_config.major_version = 2; _this->gl_config.minor_version = 0; #endif + _this->gl_config.flags = 0; + _this->gl_config.profile_mask = 0; /* Initialize the video subsystem */ if (_this->VideoInit(_this) < 0) { @@ -1144,8 +1151,16 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + /* Some platforms can't create zero-sized windows */ + if (w < 1) { + w = 1; + } + if (h < 1) { + h = 1; + } + /* Some platforms have OpenGL enabled by default */ -#if (SDL_VIDEO_OPENGL && __MACOSX__) || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ flags |= SDL_WINDOW_OPENGL; #endif if (flags & SDL_WINDOW_OPENGL) { @@ -1649,19 +1664,15 @@ SDL_CreateWindowFramebuffer(SDL_Window * window) int bpp; Uint32 Rmask, Gmask, Bmask, Amask; - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindowFramebuffer(): _this->CreateWindowFramebuffer %p _this->UpdateWindowFramebuffer %p", - _this->CreateWindowFramebuffer, _this->UpdateWindowFramebuffer); if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { return NULL; } if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindowFramebuffer(): _this->CreateWindowFramebuffer() failed"); return NULL; } if (!SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindowFramebuffer(): SDL_PixelFormatEnumToMasks() failed"); return NULL; } @@ -1673,20 +1684,17 @@ SDL_GetWindowSurface(SDL_Window * window) { CHECK_WINDOW_MAGIC(window, NULL); - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_GetWindowSurface(): window->surface_valid %d", window->surface_valid); if (!window->surface_valid) { if (window->surface) { window->surface->flags &= ~SDL_DONTFREE; SDL_FreeSurface(window->surface); } - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_GetWindowSurface(): SDL_CreateWindowFramebuffer()"); window->surface = SDL_CreateWindowFramebuffer(window); if (window->surface) { window->surface_valid = SDL_TRUE; window->surface->flags |= SDL_DONTFREE; } } - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_GetWindowSurface(): window->surface %p", window->surface); return window->surface; } @@ -1857,12 +1865,14 @@ SDL_GetWindowGrab(SDL_Window * window) void SDL_OnWindowShown(SDL_Window * window) { + INVALIDATE_GLCONTEXT(); SDL_OnWindowRestored(window); } void SDL_OnWindowHidden(SDL_Window * window) { + INVALIDATE_GLCONTEXT(); SDL_UpdateFullscreenMode(window, SDL_FALSE); } @@ -1943,6 +1953,17 @@ SDL_DestroyWindow(SDL_Window * window) CHECK_WINDOW_MAGIC(window, ); + /* Restore video mode, etc. */ + SDL_HideWindow(window); + + /* Make sure this window no longer has focus */ + if (SDL_GetKeyboardFocus() == window) { + SDL_SetKeyboardFocus(NULL); + } + if (SDL_GetMouseFocus() == window) { + SDL_SetMouseFocus(NULL); + } + /* make no context current if this is the current context window. */ if (window->flags & SDL_WINDOW_OPENGL) { if (_this->current_glwin == window) { @@ -1950,9 +1971,6 @@ SDL_DestroyWindow(SDL_Window * window) } } - /* Restore video mode, etc. */ - SDL_HideWindow(window); - if (window->surface) { window->surface->flags &= ~SDL_DONTFREE; SDL_FreeSurface(window->surface); @@ -2288,6 +2306,12 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) case SDL_GL_CONTEXT_MINOR_VERSION: _this->gl_config.minor_version = value; break; + case SDL_GL_CONTEXT_FLAGS: + _this->gl_config.flags = value; + break; + case SDL_GL_CONTEXT_PROFILE_MASK: + _this->gl_config.profile_mask = value; + break; default: SDL_SetError("Unknown OpenGL attribute"); retval = -1; @@ -2434,6 +2458,16 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) *value = _this->gl_config.minor_version; return 0; } + case SDL_GL_CONTEXT_FLAGS: + { + *value = _this->gl_config.flags; + return 0; + } + case SDL_GL_CONTEXT_PROFILE_MASK: + { + *value = _this->gl_config.profile_mask; + return 0; + } default: SDL_SetError("Unknown OpenGL attribute"); return -1; diff --git a/project/jni/sdl-1.3/src/video/SDL_video.c.diff b/project/jni/sdl-1.3/src/video/SDL_video.c.diff new file mode 100644 index 000000000..c58c76cdd --- /dev/null +++ b/project/jni/sdl-1.3/src/video/SDL_video.c.diff @@ -0,0 +1,13 @@ +--- SDL_video.c 2012-05-23 16:29:23.227504622 +0300 ++++ /home/pelya/src/endless_space/SDL-android/project/jni/sdl-1.3/src/video/SDL_video.c 2012-02-03 16:56:28.000000000 +0200 +@@ -297,6 +292,10 @@ + /* Create framebuffer data */ + data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format); + data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3); ++#ifdef __ANDROID__ ++ if( data->bytes_per_pixel == 2 ) /* Avoid extra memcpy() when calling SDL_UpdateTexture() */ ++ data->pitch = window->w * data->bytes_per_pixel; ++#endif + data->pixels = SDL_malloc(window->h * data->pitch); + if (!data->pixels) { + SDL_OutOfMemory(); diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_BWin.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_BWin.h old mode 100644 new mode 100755 index 9967decd9..b53b76ae1 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_BWin.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.cc old mode 100644 new mode 100755 index 41ebfb453..b43dbdadd --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.h old mode 100644 new mode 100755 index bfb806cd0..0c216cf78 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.cc old mode 100644 new mode 100755 index bc5c6eb67..62d4cd87d --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.h old mode 100644 new mode 100755 index a930324c8..49e320124 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.cc old mode 100644 new mode 100755 index f24a136d4..4d0f39d99 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.h old mode 100644 new mode 100755 index 05efa5b9a..3ffaf6a29 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.cc old mode 100644 new mode 100755 index 13dbd0929..75e3c63fb --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.h old mode 100644 new mode 100755 index bad9eeaad..c8221ef29 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.cc old mode 100644 new mode 100755 index a68522be8..d42d94c1c --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.h old mode 100644 new mode 100755 index f958f6632..4b9522179 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.cc old mode 100644 new mode 100755 index d2f4e790c..4a241c784 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.h old mode 100644 new mode 100755 index 1f718e92c..155a9d75f --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.cc old mode 100644 new mode 100755 index 0ff99aff6..2bfbb6616 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.h old mode 100644 new mode 100755 index 50fe62c21..6377c3e61 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.cc b/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.cc old mode 100644 new mode 100755 index 1c97211e7..9432de2ff --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.cc +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.h b/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.h old mode 100644 new mode 100755 index a274fc753..e979f9b42 --- a/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.h +++ b/project/jni/sdl-1.3/src/video/bwindow/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.h old mode 100644 new mode 100755 index f8e119aee..6b52f86e7 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.m old mode 100644 new mode 100755 index 2b1b231e0..21a888236 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.h old mode 100644 new mode 100755 index 4d7798701..4b6f74ea7 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.m old mode 100644 new mode 100755 index 8098f5464..11c6b4e08 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.h old mode 100644 new mode 100755 index f8f404c66..b69488449 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.m old mode 100644 new mode 100755 index c2da570db..1714ea6db --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.h old mode 100644 new mode 100755 index b60a36ba1..2b4c63646 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.m old mode 100644 new mode 100755 index 76e6d2d63..581e4d4a0 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,25 @@ #include "SDL_cocoavideo.h" +/* we need this for ShowMenuBar() and HideMenuBar(). */ +#include + +static inline void Cocoa_ToggleMenuBar(const BOOL show) +{ + /* !!! FIXME: keep an eye on this. + * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries. + * It happens to work, as of 10.7, but we're going to see if + * we can just simply do without it on newer OSes... + */ +#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__) + if (show) + ShowMenuBar(); + else + HideMenuBar(); +#endif +} + + /* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */ #define FORCE_OLD_API 0 || (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) @@ -381,7 +400,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) } if (CGDisplayIsMain(displaydata->display)) { - ShowMenuBar(); + Cocoa_ToggleMenuBar(YES); } } else { /* Put up the blanking window (a window above all other windows) */ @@ -405,7 +424,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) /* Hide the menu bar so it doesn't intercept events */ if (CGDisplayIsMain(displaydata->display)) { - HideMenuBar(); + Cocoa_ToggleMenuBar(NO); } } @@ -450,7 +469,7 @@ Cocoa_QuitModes(_THIS) } } - ShowMenuBar(); + Cocoa_ToggleMenuBar(YES); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.h old mode 100644 new mode 100755 index 4d6c17b9f..169727bde --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.m old mode 100644 new mode 100755 index 024639c71..67b805a95 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,15 +92,13 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (SDL_GetMouseFocus()) { - if (cursor) { - NSCursor *nscursor = (NSCursor *)cursor->driverdata; + if (cursor) { + NSCursor *nscursor = (NSCursor *)cursor->driverdata; - [nscursor set]; - [NSCursor unhide]; - } else { - [NSCursor hide]; - } + [nscursor set]; + [NSCursor unhide]; + } else { + [NSCursor hide]; } [pool release]; diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.h old mode 100644 new mode 100755 index bed4a437a..0891f5809 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.m old mode 100644 new mode 100755 index 378ab3c9a..44dcc30d6 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -200,14 +200,16 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata; NSOpenGLContext *nscontext = (NSOpenGLContext *)context; + if (window->flags & SDL_WINDOW_SHOWN) { #ifndef FULLSCREEN_TOGGLEABLE - if (window->flags & SDL_WINDOW_FULLSCREEN) { - [nscontext setFullScreen]; - } else + if (window->flags & SDL_WINDOW_FULLSCREEN) { + [nscontext setFullScreen]; + } else #endif - { - [nscontext setView:[windowdata->nswindow contentView]]; - [nscontext update]; + { + [nscontext setView:[windowdata->nswindow contentView]]; + [nscontext update]; + } } [nscontext makeCurrentContext]; } else { diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.h old mode 100644 new mode 100755 index ae9bc35a9..1af969d1d --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.m old mode 100644 new mode 100755 index 542a82899..afada6cc6 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_shape.h" #include "SDL_cocoashape.h" #include "../SDL_sysvideo.h" +#include "SDL_assert.h" SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { @@ -49,7 +50,7 @@ Cocoa_CreateShaper(SDL_Window* window) { data->shape = NULL; int resized_properly = Cocoa_ResizeWindowShape(window); - assert(resized_properly == 0); + SDL_assert(resized_properly == 0); return result; } @@ -100,7 +101,7 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape int Cocoa_ResizeWindowShape(SDL_Window *window) { SDL_ShapeData* data = window->shaper->driverdata; - assert(data != NULL); + SDL_assert(data != NULL); return 0; } diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.h old mode 100644 new mode 100755 index d9389cf41..b602d76ef --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.m old mode 100644 new mode 100755 index 886b2bebc..c79ed4544 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.h b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.h old mode 100644 new mode 100755 index d0e634eb2..4d6e756ce --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.h +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.m b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.m old mode 100644 new mode 100755 index f8956e087..ef19ce002 --- a/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.m +++ b/project/jni/sdl-1.3/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,8 +69,11 @@ static __inline__ void ConvertNSRect(NSRect *r) [window setAcceptsMouseMovedEvents:YES]; [view setNextResponder:self]; + #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - [view setAcceptsTouchEvents:YES]; + if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) { + [view setAcceptsTouchEvents:YES]; + } #endif } @@ -150,8 +153,11 @@ static __inline__ void ConvertNSRect(NSRect *r) - (void)windowDidResize:(NSNotification *)aNotification { SDL_VideoDevice *device = SDL_GetVideoDevice(); - int w, h; + int x, y, w, h; NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]]; + ConvertNSRect(&rect); + x = (int)rect.origin.x; + y = (int)rect.origin.y; w = (int)rect.size.width; h = (int)rect.size.height; if (SDL_IsShapedWindow(_data->window)) @@ -161,6 +167,9 @@ static __inline__ void ConvertNSRect(NSRect *r) [((NSOpenGLContext *) device->current_glctx) update]; } + /* The window can move during a resize event, such as when maximizing + or resizing from a corner */ + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y); SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h); } @@ -304,9 +313,7 @@ static __inline__ void ConvertNSRect(NSRect *r) CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint); } else { SDL_SetMouseFocus(NULL); - - [[NSCursor arrowCursor] set]; - [NSCursor unhide]; + SDL_SetCursor(NULL); } } } @@ -523,9 +530,13 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created /* Fill in the SDL window with the window data */ { NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; - NSView *contentView = [[SDLView alloc] initWithFrame:rect]; - [nswindow setContentView: contentView]; - [contentView release]; + NSView *contentView = [ nswindow contentView ]; + /* Create view if not already exists */ + if (!contentView) { + contentView = [[SDLView alloc] initWithFrame:rect]; + [nswindow setContentView: contentView]; + [contentView release]; + } ConvertNSRect(&rect); window->x = (int)rect.origin.x; diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.c old mode 100644 new mode 100755 index c079f6381..1eeff9910 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.h old mode 100644 new mode 100755 index 527162852..1d4fb03c5 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.c old mode 100644 new mode 100755 index 840586b58..729e2913a --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.h old mode 100644 new mode 100755 index 9a33d0a7f..783103b5f --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.c old mode 100644 new mode 100755 index 1a935144b..1ccb16b73 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.h old mode 100644 new mode 100755 index 42d1e95bf..72f4b035d --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.c old mode 100644 new mode 100755 index e56e413f6..ed580b38b --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.h old mode 100644 new mode 100755 index bb59fa385..2cf1347b2 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.c old mode 100644 new mode 100755 index e83f43ae6..4405d3cb1 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.h old mode 100644 new mode 100755 index 86f96bbbf..2dfa127f3 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.c old mode 100644 new mode 100755 index 7c5737c90..fa37850a5 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.h old mode 100644 new mode 100755 index 53188c37f..bb786862e --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.c old mode 100644 new mode 100755 index a2ca4be41..d1274efa0 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.h old mode 100644 new mode 100755 index d6f34cffe..bc3ce5f58 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.c old mode 100644 new mode 100755 index 5f8f2d163..85b2e477c --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.h old mode 100644 new mode 100755 index d1edb756b..67fe857f2 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.c old mode 100644 new mode 100755 index 83835df2d..fde8093f0 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.h old mode 100644 new mode 100755 index 3a49614d4..4c2c9c603 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.c b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.c old mode 100644 new mode 100755 index 094116a36..541d7b36a --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.c +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.h b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.h old mode 100644 new mode 100755 index 6cb1f3b20..6a091ee87 --- a/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.h +++ b/project/jni/sdl-1.3/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents.c b/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents.c old mode 100644 new mode 100755 index f348f842a..1320be396 --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents.c +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents_c.h b/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents_c.h old mode 100644 new mode 100755 index 22ce458ae..2ec69b80b --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents_c.h +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer.c b/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer.c old mode 100644 new mode 100755 index f9cca9a1d..7b4a48e27 --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer.c +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer_c.h b/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer_c.h old mode 100644 new mode 100755 index 19f475d20..01f802292 --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer_c.h +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.c b/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.c old mode 100644 new mode 100755 index c5c21233e..2c6eb0c56 --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.c +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.h b/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.h old mode 100644 new mode 100755 index cf6892a45..d2006768a --- a/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.h +++ b/project/jni/sdl-1.3/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents.c b/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents.c old mode 100644 new mode 100755 index 558eda048..7a4669a23 --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents.c +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents_c.h b/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents_c.h old mode 100644 new mode 100755 index 3712f2f1d..6f8722a17 --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents_c.h +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndsevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.c b/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.c old mode 100644 new mode 100755 index 98d3d25e8..53ffbe413 --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.c +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,12 +28,12 @@ #include #include #include -#include #include "SDL_video.h" #include "SDL_ndsvideo.h" #include "SDL_ndsevents_c.h" #include "../../render/SDL_sysrender.h" +#include "../../render/nds/SDL_libgl2D.h" #include "SDL_log.h" #define NDSVID_DRIVER_NAME "nds" diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.h b/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.h old mode 100644 new mode 100755 index ddf3f1fe6..bf3f55ecc --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.h +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.c b/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.c old mode 100644 new mode 100755 index f374a1c08..6915cdb0c --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.c +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.h b/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.h old mode 100644 new mode 100755 index 361027459..73cf4d23c --- a/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.h +++ b/project/jni/sdl-1.3/src/video/nds/SDL_ndswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.c b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.c old mode 100644 new mode 100755 index 880a221f9..3c3651282 --- a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.c +++ b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.h b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.h old mode 100644 new mode 100755 index eeacab34f..a07caf0b2 --- a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.h +++ b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.c b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.c old mode 100644 new mode 100755 index c6b22b18e..a27a0bfae --- a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.c +++ b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.h b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.h old mode 100644 new mode 100755 index 7c317b042..cdbe5f9bd --- a/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.h +++ b/project/jni/sdl-1.3/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/sdlgenblit.pl b/project/jni/sdl-1.3/src/video/sdlgenblit.pl index 4b53beec0..d4339dded 100755 --- a/project/jni/sdl-1.3/src/video/sdlgenblit.pl +++ b/project/jni/sdl-1.3/src/video/sdlgenblit.pl @@ -82,7 +82,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.h old mode 100644 new mode 100755 index 6668d1aa1..a9dc3bd85 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.m old mode 100644 new mode 100755 index 5b7965562..7dbee14ec --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,6 +140,7 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, SDL_Window *window; for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } } @@ -156,6 +157,7 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, SDL_Window *window; for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } } diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.h old mode 100644 new mode 100755 index 23e3d1385..044314425 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.m old mode 100644 new mode 100755 index fb91ba233..4dea87f8b --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitkeyboard.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitkeyboard.h old mode 100644 new mode 100755 index 700c173c7..910e37a2d --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitkeyboard.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.h old mode 100644 new mode 100755 index 16d538a49..c14faac66 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.m old mode 100644 new mode 100755 index 85ce14d0a..e992df437 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,10 +103,14 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) { SDL_uikitopenglview *view; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = display->driverdata; + SDL_DisplayModeData *displaymodedata = display->current_mode.driverdata; UIWindow *uiwindow = data->uiwindow; /* construct our view, passing in SDL's OpenGL configuration data */ view = [[SDL_uikitopenglview alloc] initWithFrame: [uiwindow bounds] + scale: displaymodedata->scale retainBacking: _this->gl_config.retained_backing rBits: _this->gl_config.red_size gBits: _this->gl_config.green_size @@ -115,6 +119,9 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) depthBits: _this->gl_config.depth_size stencilBits: _this->gl_config.stencil_size majorVersion: _this->gl_config.major_version]; + if (!view) { + return NULL; + } data->view = view; view->viewcontroller = data->viewcontroller; @@ -132,9 +139,10 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) } /* Make this window the current mouse focus for touch input */ - /* !!! FIXME: only do this if this is the primary screen. */ - SDL_SetMouseFocus(window); - SDL_SetKeyboardFocus(window); + if (displaydata->uiscreen == [UIScreen mainScreen]) { + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + } return view; } diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.h old mode 100644 new mode 100755 index 71edf55ae..8c1ba3c84 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ - (void)setCurrentContext; - (id)initWithFrame:(CGRect)frame + scale:(CGFloat)scale retainBacking:(BOOL)retained rBits:(int)rBits gBits:(int)gBits diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.m old mode 100644 new mode 100755 index fb06d4ed0..d38b26c9b --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ } - (id)initWithFrame:(CGRect)frame + scale:(CGFloat)scale retainBacking:(BOOL)retained rBits:(int)rBits gBits:(int)gBits @@ -75,13 +76,13 @@ } if (!context || ![EAGLContext setCurrentContext:context]) { [self release]; + SDL_SetError("OpenGL ES %d not supported", majorVersion); return nil; } - // !!! FIXME: use the screen this is on! - /* Use the main screen scale (for retina display support) */ - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) - self.contentScaleFactor = [UIScreen mainScreen].scale; + /* Set the appropriate scale (for retina display support) */ + if ([self respondsToSelector:@selector(contentScaleFactor)]) + self.contentScaleFactor = scale; /* create the buffers */ glGenFramebuffersOES(1, &viewFramebuffer); diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.h old mode 100644 new mode 100755 index 5a1eb42e9..4f2cea35c --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,22 @@ extern BOOL SDL_UIKit_supports_multiple_displays; +typedef struct SDL_DisplayData SDL_DisplayData; + +struct SDL_DisplayData +{ + UIScreen *uiscreen; + CGFloat scale; +}; + +typedef struct SDL_DisplayModeData SDL_DisplayModeData; + +struct SDL_DisplayModeData +{ + UIScreenMode *uiscreenmode; + CGFloat scale; +}; + #endif /* _SDL_uikitvideo_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.m old mode 100644 new mode 100755 index 354e35fb4..a08fee1c6 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -120,79 +120,184 @@ The main screen should list a AxB mode for portrait orientation, and then */ -static void -UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +static int +UIKit_AllocateDisplayModeData(SDL_DisplayMode * mode, + UIScreenMode * uiscreenmode, CGFloat scale) { - UIScreen *uiscreen = (UIScreen *) display->driverdata; - SDL_DisplayMode mode; - SDL_zero(mode); - - // availableModes showed up in 3.2 (the iPad and later). We should only - // land here for at least that version of the OS. - if (!SDL_UIKit_supports_multiple_displays) { - const CGRect rect = [uiscreen bounds]; - mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.refresh_rate = 0; - mode.driverdata = NULL; - - mode.w = (int) rect.size.width; - mode.h = (int) rect.size.height; - SDL_AddDisplayMode(display, &mode); - - mode.w = (int) rect.size.height; // swap the orientation, add again. - mode.h = (int) rect.size.width; - SDL_AddDisplayMode(display, &mode); - return; - } - - for (UIScreenMode *uimode in [uiscreen availableModes]) { - CGSize size = [uimode size]; - mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.refresh_rate = 0; - mode.driverdata = uimode; - mode.w = (int) size.width; - mode.h = (int) size.height; - if (SDL_AddDisplayMode(display, &mode)) - [uimode retain]; // retain is needed because of mode.driverdata - - if (uiscreen == [UIScreen mainScreen]) { - // Add the mode with swapped width/height - mode.w = (int) size.height; - mode.h = (int) size.width; - if (SDL_AddDisplayMode(display, &mode)) - [uimode retain]; + SDL_DisplayModeData *data = NULL; + + if (uiscreenmode != nil) { + /* Allocate the display mode data */ + data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); + if (!data) { + SDL_OutOfMemory(); + return -1; } + + data->uiscreenmode = uiscreenmode; + [data->uiscreenmode retain]; + + data->scale = scale; + } + + mode->driverdata = data; + + return 0; +} + +static void +UIKit_FreeDisplayModeData(SDL_DisplayMode * mode) +{ + if (!SDL_UIKit_supports_multiple_displays) { + // Not on at least iPhoneOS 3.2 (versions prior to iPad). + SDL_assert(mode->driverdata == NULL); + } else if (mode->driverdata != NULL) { + SDL_DisplayModeData *data = (SDL_DisplayModeData *)mode->driverdata; + [data->uiscreenmode release]; + SDL_free(data); + mode->driverdata = NULL; } } +static int +UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, + UIScreenMode * uiscreenmode, CGFloat scale) +{ + SDL_DisplayMode mode; + SDL_zero(mode); + + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = 0; + if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) { + return -1; + } + + mode.w = w; + mode.h = h; + if (SDL_AddDisplayMode(display, &mode)) { + return 0; + } + + // Failure case; free resources + SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode.driverdata; + + if (data != NULL) { + [data->uiscreenmode release]; + SDL_free(data); + } + + return -1; +} + +static int +UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, CGFloat scale, + UIScreenMode * uiscreenmode, BOOL rotated) +{ + if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode, scale) < 0) { + return -1; + } + + if (rotated) { + // Add the rotated version + if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode, scale) < 0) { + return -1; + } + } + + return 0; +} static void -UIKit_AddDisplay(UIScreen *uiscreen, int w, int h) +UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + + if (SDL_UIKit_supports_multiple_displays) { + // availableModes showed up in 3.2 (the iPad and later). We should only + // land here for at least that version of the OS. + for (UIScreenMode *uimode in [data->uiscreen availableModes]) { + BOOL mainscreen = (data->uiscreen == [UIScreen mainScreen]); + CGSize size = [uimode size]; + int w = (int)size.width; + int h = (int)size.height; + + // Add the native screen resolution. + UIKit_AddDisplayMode(display, w, h, data->scale, uimode, mainscreen); + + if (data->scale != 1.0f) { + // Add the native screen resolution divided by its scale. + // This is so devices capable of e.g. 640x960 also advertise + // 320x480. + UIKit_AddDisplayMode(display, + (int)(w / data->scale), (int)(h / data->scale), + 1.0f, uimode, mainscreen); + } + } + } else { + const CGRect rect = [data->uiscreen bounds]; + UIKit_AddDisplayMode(display, + (int)rect.size.width, (int)rect.size.height, + 1.0f, nil, YES); + } +} + + +static int +UIKit_AddDisplay(UIScreen *uiscreen, CGSize size) +{ + // When dealing with UIKit all coordinates are specified in terms of + // what Apple refers to as points. On earlier devices without the + // so called "Retina" display, there is a one to one mapping between + // points and pixels. In other cases [UIScreen scale] indicates the + // relationship between points and pixels. Since SDL has no notion + // of points, we must compensate in all cases where dealing with such + // units. + CGFloat scale; + if ([UIScreen instancesRespondToSelector:@selector(scale)]) { + scale = [uiscreen scale]; // iOS >= 4.0 + } else { + scale = 1.0f; // iOS < 4.0 + } + SDL_VideoDisplay display; SDL_DisplayMode mode; SDL_zero(mode); mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.w = w; - mode.h = h; + mode.w = (int)(size.width * scale); + mode.h = (int)(size.height * scale); mode.refresh_rate = 0; - + + UIScreenMode * uiscreenmode = nil; // UIScreenMode showed up in 3.2 (the iPad and later). We're // misusing this supports_multiple_displays flag here for that. if (SDL_UIKit_supports_multiple_displays) { - UIScreenMode *uimode = [uiscreen currentMode]; - [uimode retain]; // once for the desktop_mode - [uimode retain]; // once for the current_mode - mode.driverdata = uimode; + uiscreenmode = [uiscreen currentMode]; + } + + if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) { + return -1; } SDL_zero(display); display.desktop_mode = mode; display.current_mode = mode; + /* Allocate the display data */ + SDL_DisplayData *data = (SDL_DisplayData *) SDL_malloc(sizeof(*data)); + if (!data) { + SDL_OutOfMemory(); + UIKit_FreeDisplayModeData(&display.desktop_mode); + return -1; + } + [uiscreen retain]; - display.driverdata = uiscreen; + data->uiscreen = uiscreen; + data->scale = scale; + + display.driverdata = data; SDL_AddVideoDisplay(&display); + + return 0; } @@ -207,7 +312,10 @@ UIKit_VideoInit(_THIS) // Add the main screen. UIScreen *uiscreen = [UIScreen mainScreen]; const CGSize size = [uiscreen bounds].size; - UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height); + + if (UIKit_AddDisplay(uiscreen, size) < 0) { + return -1; + } // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels. // The iPad added both a larger main screen and the ability to use @@ -217,7 +325,9 @@ UIKit_VideoInit(_THIS) // Only add the other screens if (uiscreen != [UIScreen mainScreen]) { const CGSize size = [uiscreen bounds].size; - UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height); + if (UIKit_AddDisplay(uiscreen, size) < 0) { + return -1; + } } } } @@ -229,15 +339,15 @@ UIKit_VideoInit(_THIS) static int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { - UIScreen *uiscreen = (UIScreen *) display->driverdata; + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; if (!SDL_UIKit_supports_multiple_displays) { // Not on at least iPhoneOS 3.2 (versions prior to iPad). SDL_assert(mode->driverdata == NULL); } else { - UIScreenMode *uimode = (UIScreenMode *) mode->driverdata; - [uiscreen setCurrentMode:uimode]; + SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; + [data->uiscreen setCurrentMode:modedata->uiscreenmode]; - CGSize size = [uimode size]; + CGSize size = [modedata->uiscreenmode size]; if (size.width >= size.height) { [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; } else { @@ -248,19 +358,6 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return 0; } -static void -UIKit_ReleaseUIScreenMode(SDL_DisplayMode * mode) -{ - if (!SDL_UIKit_supports_multiple_displays) { - // Not on at least iPhoneOS 3.2 (versions prior to iPad). - SDL_assert(mode->driverdata == NULL); - } else { - UIScreenMode *uimode = (UIScreenMode *) mode->driverdata; - [uimode release]; - mode->driverdata = NULL; - } -} - void UIKit_VideoQuit(_THIS) { @@ -268,14 +365,14 @@ UIKit_VideoQuit(_THIS) int i, j; for (i = 0; i < _this->num_displays; i++) { SDL_VideoDisplay *display = &_this->displays[i]; - UIScreen *uiscreen = (UIScreen *) display->driverdata; - [uiscreen release]; + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + [data->uiscreen release]; + SDL_free(data); display->driverdata = NULL; - UIKit_ReleaseUIScreenMode(&display->desktop_mode); - UIKit_ReleaseUIScreenMode(&display->current_mode); + UIKit_FreeDisplayModeData(&display->desktop_mode); for (j = 0; j < display->num_display_modes; j++) { SDL_DisplayMode *mode = &display->display_modes[j]; - UIKit_ReleaseUIScreenMode(mode); + UIKit_FreeDisplayModeData(mode); } } } diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.h old mode 100644 new mode 100755 index 862855e0d..b9aad299a --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.m old mode 100644 new mode 100755 index 452c49a0a..d15aaaa33 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.h old mode 100644 new mode 100755 index 904fc17eb..d5551ed81 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.m old mode 100644 new mode 100755 index 4ac5cb075..7b452ed3b --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,11 +113,10 @@ const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation]; SDL_WindowData *data = self->window->driverdata; UIWindow *uiwindow = data->uiwindow; - UIScreen *uiscreen; - if (SDL_UIKit_supports_multiple_displays) - uiscreen = [uiwindow screen]; - else - uiscreen = [UIScreen mainScreen]; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(self->window); + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata; + UIScreen *uiscreen = displaydata->uiscreen; const int noborder = (self->window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)); CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame]; const CGSize size = frame.size; @@ -141,6 +140,9 @@ return; } + w = (int)(w * displaymodedata->scale); + h = (int)(h * displaymodedata->scale); + [uiwindow setFrame:frame]; [data->view setFrame:frame]; [data->view updateFrame]; diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.h b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.h old mode 100644 new mode 100755 index 3090110d5..99f6ed20e --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.h +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #define _SDL_uikitwindow_h #include "../SDL_sysvideo.h" +#import "SDL_uikitvideo.h" #import "SDL_uikitopenglview.h" #import "SDL_uikitviewcontroller.h" diff --git a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.m b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.m old mode 100644 new mode 100755 index ad54da2ef..60037b518 --- a/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.m +++ b/project/jni/sdl-1.3/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,7 +46,8 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); - UIScreen *uiscreen = (UIScreen *) display->driverdata; + SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *data; /* Allocate the window data */ @@ -64,36 +65,42 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo window->x = 0; window->y = 0; + /* Get frame dimensions in pixels */ + int width = (int)(uiwindow.frame.size.width * displaymodedata->scale); + int height = (int)(uiwindow.frame.size.height * displaymodedata->scale); + /* We can pick either width or height here and we'll rotate the screen to match, so we pick the closest to what we wanted. */ if (window->w >= window->h) { if (uiwindow.frame.size.width > uiwindow.frame.size.height) { - window->w = (int)uiwindow.frame.size.width; - window->h = (int)uiwindow.frame.size.height; + window->w = width; + window->h = height; } else { - window->w = (int)uiwindow.frame.size.height; - window->h = (int)uiwindow.frame.size.width; + window->w = height; + window->h = width; } } else { if (uiwindow.frame.size.width > uiwindow.frame.size.height) { - window->w = (int)uiwindow.frame.size.height; - window->h = (int)uiwindow.frame.size.width; + window->w = height; + window->h = width; } else { - window->w = (int)uiwindow.frame.size.width; - window->h = (int)uiwindow.frame.size.height; + window->w = width; + window->h = height; } } } window->driverdata = data; - window->flags |= SDL_WINDOW_SHOWN; /* only one window on iOS, always shown */ + /* only one window on iOS, always shown */ + window->flags &= ~SDL_WINDOW_HIDDEN; + window->flags |= SDL_WINDOW_SHOWN; // SDL_WINDOW_BORDERLESS controls whether status bar is hidden. // This is only set if the window is on the main screen. Other screens // just force the window to have the borderless flag. - if ([UIScreen mainScreen] != uiscreen) { + if ([UIScreen mainScreen] != displaydata->uiscreen) { window->flags &= ~SDL_WINDOW_RESIZABLE; // window is NEVER resizeable window->flags &= ~SDL_WINDOW_INPUT_FOCUS; // never has input focus window->flags |= SDL_WINDOW_BORDERLESS; // never has a status bar. @@ -129,8 +136,8 @@ int UIKit_CreateWindow(_THIS, SDL_Window *window) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); - UIScreen *uiscreen = (UIScreen *) display->driverdata; - const BOOL external = ([UIScreen mainScreen] != uiscreen); + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + const BOOL external = ([UIScreen mainScreen] != data->uiscreen); // SDL currently puts this window at the start of display's linked list. We rely on this. SDL_assert(_this->windows == window); @@ -152,7 +159,7 @@ UIKit_CreateWindow(_THIS, SDL_Window *window) // user, so it's in standby), try to force the display to a resolution // that most closely matches the desired window size. if (SDL_UIKit_supports_multiple_displays) { - const CGSize origsize = [[uiscreen currentMode] size]; + const CGSize origsize = [[data->uiscreen currentMode] size]; if ((origsize.width == 0.0f) && (origsize.height == 0.0f)) { if (display->num_display_modes == 0) { _this->GetDisplayModes(_this, display); @@ -167,15 +174,13 @@ UIKit_CreateWindow(_THIS, SDL_Window *window) } if (bestmode) { - UIScreenMode *uimode = (UIScreenMode *) bestmode->driverdata; - [uiscreen setCurrentMode:uimode]; + SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)bestmode->driverdata; + [data->uiscreen setCurrentMode:modedata->uiscreenmode]; // desktop_mode doesn't change here (the higher level will // use it to set all the screens back to their defaults // upon window destruction, SDL_Quit(), etc. - [((UIScreenMode *) display->current_mode.driverdata) release]; display->current_mode = *bestmode; - [((UIScreenMode *) display->current_mode.driverdata) retain]; } } } @@ -184,16 +189,16 @@ UIKit_CreateWindow(_THIS, SDL_Window *window) // !!! FIXME: can we have a smaller view? UIWindow *uiwindow = [UIWindow alloc]; if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) - uiwindow = [uiwindow initWithFrame:[uiscreen bounds]]; + uiwindow = [uiwindow initWithFrame:[data->uiscreen bounds]]; else - uiwindow = [uiwindow initWithFrame:[uiscreen applicationFrame]]; + uiwindow = [uiwindow initWithFrame:[data->uiscreen applicationFrame]]; // put the window on an external display if appropriate. This implicitly // does [uiwindow setframe:[uiscreen bounds]], so don't do it on the // main display, where we land by default, as that would eat the // status bar real estate. if (external) { - [uiwindow setScreen:uiscreen]; + [uiwindow setScreen:data->uiscreen]; } if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) { @@ -208,35 +213,40 @@ UIKit_CreateWindow(_THIS, SDL_Window *window) void UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { - UIScreen *uiscreen = (UIScreen *) display->driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata; UIWindow *uiwindow = ((SDL_WindowData *) window->driverdata)->uiwindow; if (fullscreen) { [UIApplication sharedApplication].statusBarHidden = YES; - uiwindow.frame = [uiscreen bounds]; + uiwindow.frame = [displaydata->uiscreen bounds]; } else { [UIApplication sharedApplication].statusBarHidden = NO; - uiwindow.frame = [uiscreen applicationFrame]; + uiwindow.frame = [displaydata->uiscreen applicationFrame]; } + /* Get frame dimensions in pixels */ + int width = (int)(uiwindow.frame.size.width * displaymodedata->scale); + int height = (int)(uiwindow.frame.size.height * displaymodedata->scale); + /* We can pick either width or height here and we'll rotate the screen to match, so we pick the closest to what we wanted. */ if (window->w >= window->h) { if (uiwindow.frame.size.width > uiwindow.frame.size.height) { - window->w = (int)uiwindow.frame.size.width; - window->h = (int)uiwindow.frame.size.height; + window->w = width; + window->h = height; } else { - window->w = (int)uiwindow.frame.size.height; - window->h = (int)uiwindow.frame.size.width; + window->w = height; + window->h = width; } } else { if (uiwindow.frame.size.width > uiwindow.frame.size.height) { - window->w = (int)uiwindow.frame.size.height; - window->h = (int)uiwindow.frame.size.width; + window->w = height; + window->h = width; } else { - window->w = (int)uiwindow.frame.size.width; - window->h = (int)uiwindow.frame.size.height; + window->w = width; + window->h = height; } } } diff --git a/project/jni/sdl-1.3/src/video/uikit/keyinfotable.h b/project/jni/sdl-1.3/src/video/uikit/keyinfotable.h old mode 100644 new mode 100755 index 3c011521b..a3721f591 --- a/project/jni/sdl-1.3/src/video/uikit/keyinfotable.h +++ b/project/jni/sdl-1.3/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_vkeys.h b/project/jni/sdl-1.3/src/video/windows/SDL_vkeys.h old mode 100644 new mode 100755 index 2e9ea74fb..efd48a1d8 --- a/project/jni/sdl-1.3/src/video/windows/SDL_vkeys.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.c old mode 100644 new mode 100755 index 1310a18e1..f3b6c6ec7 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.h old mode 100644 new mode 100755 index 240bcb3cc..a2ec0c32a --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.c old mode 100644 new mode 100755 index 62bb92e43..d844fba20 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.h old mode 100644 new mode 100755 index 0e69e2ea0..38a847c3f --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.c old mode 100644 new mode 100755 index 13948006d..cf28add64 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,6 +113,11 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (!data) { + /* The window wasn't fully initialized */ + return; + } + if (data->mdc) { DeleteDC(data->mdc); data->mdc = NULL; diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.h old mode 100644 new mode 100755 index 895233f62..33411c7f1 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.c old mode 100644 new mode 100755 index a824505f4..3530faf35 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.h old mode 100644 new mode 100755 index 4c99cbdd7..1eff39665 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.c old mode 100644 new mode 100755 index 71092ac93..0f1083f6a --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.h old mode 100644 new mode 100755 index a3a5aef6a..4d8dcc955 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.c old mode 100644 new mode 100755 index 0a0011fa9..73103c4c7 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.h old mode 100644 new mode 100755 index ed30e536e..e5c5b07fb --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.c old mode 100644 new mode 100755 index a69f30864..5674d903b --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,6 +39,26 @@ #define WGL_CONTEXT_FLAGS_ARB 0x2093 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#endif + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif +#endif + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #endif typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, @@ -398,7 +418,7 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; PIXELFORMATDESCRIPTOR pfd; - int pixel_format; + int pixel_format = 0; int iAttribs[64]; int *iAttr; float fAttribs[1] = { 0 }; @@ -468,16 +488,19 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) *iAttr++ = _this->gl_config.multisamplesamples; } - if (_this->gl_config.accelerated >= 0) { - *iAttr++ = WGL_ACCELERATION_ARB; - *iAttr++ = (_this->gl_config.accelerated ? WGL_FULL_ACCELERATION_ARB : - WGL_NO_ACCELERATION_ARB); - } + *iAttr++ = WGL_ACCELERATION_ARB; + *iAttr++ = WGL_FULL_ACCELERATION_ARB; *iAttr = 0; /* Choose and set the closest available pixel format */ - pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs); + if (_this->gl_config.accelerated != 0) { + pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs); + } + if (!pixel_format && _this->gl_config.accelerated != 1) { + iAttr[-1] = WGL_NO_ACCELERATION_ARB; + pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs); + } if (!pixel_format) { pixel_format = WIN_GL_ChoosePixelFormat(hdc, &pfd); } @@ -521,11 +544,28 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) SDL_SetError("GL 3.x is not supported"); context = temp_context; } else { - int attribs[] = { + /* max 8 attributes plus terminator */ + int attribs[9] = { WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, 0 }; + int iattr = 4; + + /* SDL profile bits match WGL profile bits */ + if( _this->gl_config.profile_mask != 0 ) { + attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[iattr++] = _this->gl_config.profile_mask; + } + + /* SDL flags match WGL flags */ + if( _this->gl_config.flags != 0 ) { + attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB; + attribs[iattr++] = _this->gl_config.flags; + } + + attribs[iattr++] = 0; + /* Create the GL 3.x context */ context = wglCreateContextAttribsARB(hdc, 0, attribs); /* Delete the GL 2.x context */ diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.h old mode 100644 new mode 100755 index 5ef245937..4a63915cd --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.c old mode 100644 new mode 100755 index e915ae067..10e0a75a7 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.h old mode 100644 new mode 100755 index 0de69bf9d..612c68c20 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.c old mode 100644 new mode 100755 index c90e91955..73227efc5 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.h old mode 100644 new mode 100755 index e046c386f..23dbc8553 --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.c b/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.c old mode 100644 new mode 100755 index ed3a53e91..aa9ec220d --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.c +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.h b/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.h old mode 100644 new mode 100755 index fa3eedfdd..a6514470c --- a/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.h +++ b/project/jni/sdl-1.3/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.c old mode 100644 new mode 100755 index 71f7c9390..60d6bd859 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.h old mode 100644 new mode 100755 index 9004667ec..e658d67e4 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.c old mode 100644 new mode 100755 index d25b1d2c0..631e15e54 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.h old mode 100644 new mode 100755 index 8fb6202fd..04d810462 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11events.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11events.c old mode 100644 new mode 100755 index 84daaa8bf..4f52c6093 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11events.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -83,7 +83,7 @@ static SDL_bool X11_IsWheelEvent(Display * display,XEvent * event,int * ticks) if (event->xbutton.button == Button4) { *ticks = 1; } - else { + else if (event->xbutton.button == Button5) { *ticks = -1; } diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11events.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11events.h old mode 100644 new mode 100755 index 2c4d1e165..0b9af47bd --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11events.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.c old mode 100644 new mode 100755 index b54a48cfc..9eb015e34 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -193,7 +193,14 @@ void X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; + Display *display; + + if (!data) { + /* The window wasn't fully initialized */ + return; + } + + display = data->videodata->display; if (data->ximage) { XDestroyImage(data->ximage); diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.h old mode 100644 new mode 100755 index c88f75b08..39d9d71ec --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.c old mode 100644 new mode 100755 index 5940d359d..3ed61e963 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.h old mode 100644 new mode 100755 index a475d4c9d..28a0c539c --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.c old mode 100644 new mode 100755 index b26c4c062..2560004b1 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.h old mode 100644 new mode 100755 index d14da2317..6943634fb --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.c old mode 100644 new mode 100755 index 396bb9ff4..253d505e8 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.h old mode 100644 new mode 100755 index c5c473190..9a44b2329 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.c old mode 100644 new mode 100755 index 0cb186b57..90b1e73b9 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -67,11 +67,6 @@ #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 -#ifndef GLX_EXT_swap_control -#define GLX_SWAP_INTERVAL_EXT 0x20F1 -#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 -#endif - /* Typedef for the GL 3.0 context creation function */ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, GLXFBConfig config, @@ -80,10 +75,35 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, Bool direct, const int *attrib_list); + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #endif -#define OPENGL_REQUIRS_DLOPEN -#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN) +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif +#endif + +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_EXT_create_context_es2_profile +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000002 +#endif + +#ifndef GLX_EXT_swap_control +#define GLX_SWAP_INTERVAL_EXT 0x20F1 +#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 +#endif + +#define OPENGL_REQUIRES_DLOPEN +#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN) #include #define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL)) #define GL_LoadFunction dlsym @@ -109,8 +129,11 @@ X11_GL_LoadLibrary(_THIS, const char *path) if (path == NULL) { path = DEFAULT_OPENGL; } - _this->gl_config.dll_handle = SDL_LoadObject(path); + _this->gl_config.dll_handle = GL_LoadObject(path); if (!_this->gl_config.dll_handle) { +#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN) + SDL_SetError("Failed loading %s: %s", path, dlerror()); +#endif return -1; } SDL_strlcpy(_this->gl_config.driver_path, path, @@ -187,8 +210,10 @@ X11_GL_UnloadLibrary(_THIS) #endif /* Free OpenGL memory */ - SDL_free(_this->gl_data); - _this->gl_data = NULL; + if (_this->gl_data) { + SDL_free(_this->gl_data); + _this->gl_data = NULL; + } } static SDL_bool @@ -300,16 +325,24 @@ X11_GL_InitExtensions(_THIS) X11_PumpEvents(_this); } +/* glXChooseVisual and glXChooseFBConfig have some small differences in + * the attribute encoding, it can be chosen with the for_FBConfig parameter. + */ int -X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size) +X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig) { int i = 0; /* assert buffer is large enough to hold all SDL attributes. */ - /* assert(size >= 32);*/ + SDL_assert(size >= 32); /* Setup our GLX attributes according to the gl_config. */ - attribs[i++] = GLX_RGBA; + if( for_FBConfig ) { + attribs[i++] = GLX_RENDER_TYPE; + attribs[i++] = GLX_RGBA_BIT; + } else { + attribs[i++] = GLX_RGBA; + } attribs[i++] = GLX_RED_SIZE; attribs[i++] = _this->gl_config.red_size; attribs[i++] = GLX_GREEN_SIZE; @@ -322,13 +355,10 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si attribs[i++] = _this->gl_config.alpha_size; } - if (_this->gl_config.buffer_size) { - attribs[i++] = GLX_BUFFER_SIZE; - attribs[i++] = _this->gl_config.buffer_size; - } - if (_this->gl_config.double_buffer) { attribs[i++] = GLX_DOUBLEBUFFER; + if( for_FBConfig ) + attribs[i++] = True; } attribs[i++] = GLX_DEPTH_SIZE; @@ -361,6 +391,8 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si if (_this->gl_config.stereo) { attribs[i++] = GLX_STEREO; + if( for_FBConfig ) + attribs[i++] = True; } if (_this->gl_config.multisamplebuffers) { @@ -391,10 +423,13 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) XVisualInfo *vinfo; /* 64 seems nice. */ - const int max_attrs = 64; - int attribs[max_attrs]; - const int i = X11_GL_GetAttributes(_this,display,screen,attribs,max_attrs); - SDL_assert(i <= max_attrs); + int attribs[64]; + int i = X11_GL_GetAttributes(_this,display,screen,attribs,64,SDL_FALSE); + + if (!_this->gl_data) { + /* The OpenGL library wasn't loaded, SDL_GetError() should have info */ + return NULL; + } vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); if (!vinfo) { @@ -434,13 +469,29 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) SDL_SetError("Could not create GL context"); return NULL; } else { - int attribs[] = { + /* max 8 attributes plus terminator */ + int attribs[9] = { GLX_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, GLX_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, 0 }; + int iattr = 4; + + /* SDL profile bits match GLX profile bits */ + if( _this->gl_config.profile_mask != 0 ) { + attribs[iattr++] = GLX_CONTEXT_PROFILE_MASK_ARB; + attribs[iattr++] = _this->gl_config.profile_mask; + } + + /* SDL flags match GLX flags */ + if( _this->gl_config.flags != 0 ) { + attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB; + attribs[iattr++] = _this->gl_config.flags; + } + + attribs[iattr++] = 0; /* Get a pointer to the context creation function for GL 3.0 */ PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = @@ -467,7 +518,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) int *)) _this->gl_data-> glXGetProcAddress((GLubyte *) "glXChooseFBConfig"); - X11_GL_GetAttributes(_this,display,screen,glxAttribs,64); + X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE); if (!glXChooseFBConfig || !(framebuffer_config = diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.h old mode 100644 new mode 100755 index cb5cb3d9c..cbdbd3e0a --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.c old mode 100644 new mode 100755 index 0e545d257..6b5a8bedb --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,10 @@ #include "SDL_x11video.h" #include "SDL_x11opengles.h" -#define DEFAULT_OPENGL "/usr/lib/libGLES_CM.so" +#define DEFAULT_EGL "libEGL.so" +#define DEFAULT_OGL_ES2 "libGLESv2.so" +#define DEFAULT_OGL_ES_PVR "libGLES_CM.so" +#define DEFAULT_OGL_ES "libGLESv1_CM.so" #define LOAD_FUNC(NAME) \ *((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \ @@ -44,13 +47,15 @@ X11_GLES_GetProcAddress(_THIS, const char *proc) void *handle; void *retval; - handle = _this->gl_config.dll_handle; + handle = _this->gles_data->egl_dll_handle; if (_this->gles_data->eglGetProcAddress) { retval = _this->gles_data->eglGetProcAddress(proc); if (retval) { return retval; } } + + handle = _this->gl_config.dll_handle; #if defined(__OpenBSD__) && !defined(__ELF__) #undef dlsym(x,y); #endif @@ -70,6 +75,7 @@ X11_GLES_UnloadLibrary(_THIS) _this->gles_data->eglTerminate(_this->gles_data->egl_display); dlclose(_this->gl_config.dll_handle); + dlclose(_this->gles_data->egl_dll_handle); _this->gles_data->eglGetProcAddress = NULL; _this->gles_data->eglChooseConfig = NULL; @@ -111,7 +117,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) dlclose(handle); path = getenv("SDL_VIDEO_GL_DRIVER"); if (path == NULL) { - path = DEFAULT_OPENGL; + path = DEFAULT_EGL; } handle = dlopen(path, dlopen_flags); } @@ -137,6 +143,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) LOAD_FUNC(eglDestroySurface); LOAD_FUNC(eglMakeCurrent); LOAD_FUNC(eglSwapBuffers); + LOAD_FUNC(eglSwapInterval); _this->gles_data->egl_display = _this->gles_data->eglGetDisplay((NativeDisplayType) data->display); @@ -153,6 +160,29 @@ X11_GLES_LoadLibrary(_THIS, const char *path) return -1; } + _this->gles_data->egl_dll_handle = handle; + + path = getenv("SDL_VIDEO_GL_DRIVER"); + handle = dlopen(path, dlopen_flags); + if ((path == NULL) | (handle == NULL)) { + if (_this->gl_config.major_version > 1) { + path = DEFAULT_OGL_ES2; + handle = dlopen(path, dlopen_flags); + } else { + path = DEFAULT_OGL_ES; + handle = dlopen(path, dlopen_flags); + if (handle == NULL) { + path = DEFAULT_OGL_ES_PVR; + handle = dlopen(path, dlopen_flags); + } + } + } + + if (handle == NULL) { + SDL_SetError("Could not initialize OpenGL ES library"); + return -1; + } + _this->gl_config.dll_handle = handle; _this->gl_config.driver_loaded = 1; @@ -218,6 +248,13 @@ X11_GLES_GetVisual(_THIS, Display * display, int screen) attribs[i++] = _this->gl_config.multisamplesamples; } + attribs[i++] = EGL_RENDERABLE_TYPE; + if (_this->gl_config.major_version == 2) { + attribs[i++] = EGL_OPENGL_ES2_BIT; + } else { + attribs[i++] = EGL_OPENGL_ES_BIT; + } + attribs[i++] = EGL_NONE; if (_this->gles_data->eglChooseConfig(_this->gles_data->egl_display, @@ -260,17 +297,26 @@ X11_GLES_GetVisual(_THIS, Display * display, int screen) SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window) { - int retval; + EGLint context_attrib_list[] = { + EGL_CONTEXT_CLIENT_VERSION, + 1, + EGL_NONE + }; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; + SDL_GLContext context = 1; XSync(display, False); + if (_this->gl_config.major_version) { + context_attrib_list[1] = _this->gl_config.major_version; + } _this->gles_data->egl_context = _this->gles_data->eglCreateContext(_this->gles_data->egl_display, _this->gles_data->egl_config, - EGL_NO_CONTEXT, NULL); + EGL_NO_CONTEXT, context_attrib_list); XSync(display, False); if (_this->gles_data->egl_context == EGL_NO_CONTEXT) { @@ -279,13 +325,14 @@ X11_GLES_CreateContext(_THIS, SDL_Window * window) } _this->gles_data->egl_active = 1; + _this->gles_data->egl_swapinterval = 0; - if (_this->gles_data->egl_active) - retval = 1; - else - retval = 0; + if (X11_GLES_MakeCurrent(_this, window, context) < 0) { + X11_GLES_DeleteContext(_this, context); + return NULL; + } - return (retval); + return context; } int @@ -309,17 +356,34 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) return (retval); } -static int swapinterval = -1; int X11_GLES_SetSwapInterval(_THIS, int interval) { - return 0; + if (_this->gles_data->egl_active != 1) { + SDL_SetError("OpenGL ES context not active"); + return -1; + } + + EGLBoolean status; + status = _this->gles_data->eglSwapInterval(_this->gles_data->egl_display, interval); + if (status == EGL_TRUE) { + _this->gles_data->egl_swapinterval = interval; + return 0; + } + + SDL_SetError("Unable to set the EGL swap interval"); + return -1; } int X11_GLES_GetSwapInterval(_THIS) { - return 0; + if (_this->gles_data->egl_active != 1) { + SDL_SetError("OpenGL ES context not active"); + return -1; + } + + return _this->gles_data->egl_swapinterval; } void diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.h old mode 100644 new mode 100755 index 7c879c43e..a9c2a2dc8 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,17 +32,19 @@ typedef struct SDL_PrivateGLESData { int egl_active; /* to stop switching drivers while we have a valid context */ XVisualInfo *egl_visualinfo; + void *egl_dll_handle; EGLDisplay egl_display; EGLContext egl_context; /* Current GLES context */ EGLSurface egl_surface; EGLConfig egl_config; + int egl_swapinterval; EGLDisplay(*eglGetDisplay) (NativeDisplayType display); EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(*eglTerminate) (EGLDisplay dpy); - void *(*eglGetProcAddress) (const GLubyte * procName); + void *(*eglGetProcAddress) (const char * procName); EGLBoolean(*eglChooseConfig) (EGLDisplay dpy, const EGLint * attrib_list, @@ -67,6 +69,8 @@ typedef struct SDL_PrivateGLESData EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw); + EGLBoolean(*eglSwapInterval) (EGLDisplay dpy, EGLint interval); + const char *(*eglQueryString) (EGLDisplay dpy, EGLint name); EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config, diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.c old mode 100644 new mode 100755 index b98ad554b..ac889bfe3 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.h old mode 100644 new mode 100755 index 714149ba8..df932cbd6 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11sym.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11sym.h old mode 100644 new mode 100755 index 5b47b1c61..452e18de4 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11sym.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,9 +22,7 @@ /* *INDENT-OFF* */ SDL_X11_MODULE(BASEXLIB) -SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) -SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return) @@ -87,13 +85,12 @@ SDL_X11_SYM(int,XResetScreenSaver,(Display* a),(a),return) SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return) SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return) SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return) -SDL_X11_SYM(int,XSetClassHint,(Display* a,Window b,XClassHint* c),(a,b,c),return) SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return) SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return) SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d),return) SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return) SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),) -SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return) +SDL_X11_SYM(void,XSetWMProperties,(Display* a,Window b,XTextProperty* c,XTextProperty* d,char** e,int f,XSizeHints* g,XWMHints* h,XClassHint* i),(a,b,c,d,e,f,g,h,i),) SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),) SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return) SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return) diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.c old mode 100644 new mode 100755 index c9f65c783..bf31655ea --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.h old mode 100644 new mode 100755 index 476e1f02e..b4d39431e --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11video.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11video.c old mode 100644 new mode 100755 index ac97e63e6..254714fd6 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11video.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ #include "SDL_x11shape.h" #include "SDL_x11touch.h" -#if SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 #include "SDL_x11opengles.h" #endif @@ -110,7 +110,7 @@ X11_DeleteDevice(SDL_VideoDevice * device) } SDL_free(data->windowlist); SDL_free(device->driverdata); -#if SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 SDL_free(device->gles_data); #endif SDL_free(device); @@ -143,7 +143,7 @@ X11_CreateDevice(int devindex) } device->driverdata = data; -#if SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 device->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData)); if (!device->gles_data) { SDL_OutOfMemory(); @@ -226,7 +226,7 @@ X11_CreateDevice(int devindex) device->GL_SwapWindow = X11_GL_SwapWindow; device->GL_DeleteContext = X11_GL_DeleteContext; #endif -#if SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 device->GL_LoadLibrary = X11_GLES_LoadLibrary; device->GL_GetProcAddress = X11_GLES_GetProcAddress; device->GL_UnloadLibrary = X11_GLES_UnloadLibrary; @@ -328,6 +328,9 @@ X11_VideoInit(_THIS) /* Get the window class name, usually the name of the application */ data->classname = get_classname(); + /* Get the process PID to be associated to the window */ + data->pid = getpid(); + /* Open a connection to the X input manager */ #ifdef X_HAVE_UTF8_STRING if (SDL_X11_HAVE_UTF8) { diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11video.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11video.h old mode 100644 new mode 100755 index 042dccbe6..9a7ca5474 --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11video.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,6 +69,7 @@ typedef struct SDL_VideoData { Display *display; char *classname; + pid_t pid; XIM im; Uint32 screensaver_activity; int numwindows; diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11window.c b/project/jni/sdl-1.3/src/video/x11/SDL_x11window.c old mode 100644 new mode 100755 index 94664fa47..362c571ff --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11window.c +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ #include "SDL_x11mouse.h" #include "SDL_x11shape.h" -#ifdef SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 #include "SDL_x11opengles.h" #endif @@ -258,11 +258,12 @@ X11_CreateWindow(_THIS, SDL_Window * window) int depth; XSetWindowAttributes xattr; Window w; - XSizeHints *sizehints; - XWMHints *wmhints; - XClassHint *classhints; + XSizeHints sizehints; + XWMHints wmhints; + XClassHint classhints; Atom _NET_WM_WINDOW_TYPE; Atom _NET_WM_WINDOW_TYPE_NORMAL; + Atom _NET_WM_PID; int wmstate_count; Atom wmstate_atoms[3]; Uint32 fevent = 0; @@ -288,7 +289,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) XFree(vinfo); } else #endif -#ifdef SDL_VIDEO_DRIVER_PANDORA +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 if (window->flags & SDL_WINDOW_OPENGL) { XVisualInfo *vinfo; @@ -400,34 +401,22 @@ X11_CreateWindow(_THIS, SDL_Window * window) SDL_SetError("Couldn't create window"); return -1; } -#if SDL_VIDEO_DRIVER_PANDORA - /* Create the GLES window surface */ - _this->gles_data->egl_surface = - _this->gles_data->eglCreateWindowSurface(_this->gles_data-> +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + if (window->flags & SDL_WINDOW_OPENGL) { + /* Create the GLES window surface */ + _this->gles_data->egl_surface = + _this->gles_data->eglCreateWindowSurface(_this->gles_data-> egl_display, _this->gles_data->egl_config, (NativeWindowType) w, NULL); - if (_this->gles_data->egl_surface == EGL_NO_SURFACE) { - SDL_SetError("Could not create GLES window surface"); - return -1; + if (_this->gles_data->egl_surface == EGL_NO_SURFACE) { + SDL_SetError("Could not create GLES window surface"); + return -1; + } } #endif - sizehints = XAllocSizeHints(); - if (sizehints) { - if (!(window->flags & SDL_WINDOW_RESIZABLE)) { - sizehints->min_width = sizehints->max_width = window->w; - sizehints->min_height = sizehints->max_height = window->h; - sizehints->flags = PMaxSize | PMinSize; - } - sizehints->x = window->x; - sizehints->y = window->y; - sizehints->flags |= USPosition; - XSetWMNormalHints(display, w, sizehints); - XFree(sizehints); - } - if (window->flags & SDL_WINDOW_BORDERLESS) { SDL_bool set; Atom WM_HINTS; @@ -511,22 +500,33 @@ X11_CreateWindow(_THIS, SDL_Window * window) } } - /* Set the input hints so we get keyboard input */ - wmhints = XAllocWMHints(); - if (wmhints) { - wmhints->input = True; - wmhints->flags = InputHint; - XSetWMHints(display, w, wmhints); - XFree(wmhints); + /* Setup the normal size hints */ + sizehints.flags = 0; + if (!(window->flags & SDL_WINDOW_RESIZABLE)) { + sizehints.min_width = sizehints.max_width = window->w; + sizehints.min_height = sizehints.max_height = window->h; + sizehints.flags |= (PMaxSize | PMinSize); } + sizehints.x = window->x; + sizehints.y = window->y; + sizehints.flags |= USPosition; - /* Set the class hints so we can get an icon (AfterStep) */ - classhints = XAllocClassHint(); - if (classhints != NULL) { - classhints->res_name = data->classname; - classhints->res_class = data->classname; - XSetClassHint(display, w, classhints); - XFree(classhints); + /* Setup the input hints so we get keyboard input */ + wmhints.input = True; + wmhints.flags = InputHint; + + /* Setup the class hints so we can get an icon (AfterStep) */ + classhints.res_name = data->classname; + classhints.res_class = data->classname; + + /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */ + XSetWMProperties(display, w, NULL, NULL, NULL, 0, &sizehints, &wmhints, &classhints); + + /* Set the PID related to the window for the given hostname, if possible */ + if (data->pid > 0) { + _NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False); + XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&data->pid, 1); } /* Set the window manager state */ diff --git a/project/jni/sdl-1.3/src/video/x11/SDL_x11window.h b/project/jni/sdl-1.3/src/video/x11/SDL_x11window.h old mode 100644 new mode 100755 index 97b4d99d7..f3cb48efc --- a/project/jni/sdl-1.3/src/video/x11/SDL_x11window.h +++ b/project/jni/sdl-1.3/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages