merged
authorEric Wing <ewing . public |-at-| gmail . com>
Sat, 12 Feb 2011 19:16:09 -0800
changeset 5282 15a71bec4a55
parent 5281 adfcdd311ae0 (current diff)
parent 5275 bad04e4710f6 (diff)
child 5283 a3bfe8657cde
merged
Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
src/video/SDL_gamma.c
src/video/SDL_leaks.h
src/video/windows/SDL_windowsgamma.c
src/video/windows/SDL_windowsgamma.h
src/video/x11/SDL_x11gamma.c
src/video/x11/SDL_x11gamma.h
test/testgamma.c
--- a/Makefile.ds	Sun Feb 06 23:48:31 2011 -0800
+++ b/Makefile.ds	Sat Feb 12 19:16:09 2011 -0800
@@ -22,46 +22,57 @@
 #endif
 
 #CFLAGS=$(DEFS) -Iinclude
-CFLAGS	=	-mthumb -mthumb-interwork \
-		-march=armv5te -mtune=arm946e-s \
-		-O2 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-		-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" -DVERSION=\"1.3\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 \
-		-Iinclude -Isrc -Isrc/audio -Isrc/cdrom -Isrc/endian -Isrc/events -Isrc/joystick -Isrc/thread/nds -Isrc/thread -Isrc/timer -Isrc/video
+CFLAGS	=	-mthumb -mthumb-interwork \
+		-march=armv5te -mtune=arm946e-s \
+		-O2 -Wall -Wwrite-strings -Wpointer-arith  \
+		-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" -DVERSION=\"1.3\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 \
+		-Iinclude -Isrc -Isrc/audio -Isrc/cdrom -Isrc/endian -Isrc/events -Isrc/joystick -Isrc/thread/nds -Isrc/thread -Isrc/timer -Isrc/video
 
 #src/audio/disk/SDL_diskaudio.c \
 #src/audio/dummy/SDL_dummyaudio.c \
 
 SRCS = \
 src/SDL.c \
+src/SDL_assert.c \
 src/SDL_compat.c \
 src/SDL_error.c \
 src/SDL_fatal.c \
-src/SDL_assert.c \
-src/audio/nds/SDL_ndsaudio.c \
+src/SDL_hints.c \
+src/SDL_log.c \
+src/atomic/SDL_atomic.c \
 src/audio/SDL_audio.c \
 src/audio/SDL_audiocvt.c \
 src/audio/SDL_audiodev.c \
 src/audio/SDL_audiotypecvt.c \
 src/audio/SDL_mixer.c \
-src/audio/SDL_mixer_m68k.c \
 src/audio/SDL_mixer_MMX.c \
 src/audio/SDL_mixer_MMX_VC.c \
+src/audio/SDL_mixer_m68k.c \
 src/audio/SDL_wave.c \
-src/cdrom/dummy/SDL_syscdrom.c \
-src/cdrom/SDL_cdrom.c \
+src/audio/nds/SDL_ndsaudio.c \
 src/cpuinfo/SDL_cpuinfo.c \
 src/events/SDL_events.c \
 src/events/SDL_keyboard.c \
 src/events/SDL_mouse.c \
 src/events/SDL_quit.c \
+src/events/SDL_touch.c \
 src/events/SDL_windowevents.c \
+src/events/nds/SDL_ndsgesture.c \
 src/file/SDL_rwops.c \
+src/haptic/SDL_haptic.c \
+src/haptic/nds/SDL_syshaptic.c \
+src/joystick/SDL_joystick.c \
+src/joystick/nds/SDL_sysjoystick.c \
 src/power/SDL_power.c \
 src/power/nds/SDL_syspower.c \
-src/haptic/SDL_haptic.c \
-src/haptic/nds/SDL_syshaptic.c \
-src/joystick/nds/SDL_sysjoystick.c \
-src/joystick/SDL_joystick.c \
+src/render/SDL_render.c \
+src/render/SDL_yuv_sw.c \
+src/render/software/SDL_render_sw.c \
+src/render/software/SDL_blendpoint.c \
+src/render/software/SDL_drawline.c \
+src/render/software/SDL_blendline.c \
+src/render/software/SDL_blendfillrect.c \
+src/render/software/SDL_drawpoint.c \
 src/stdlib/SDL_getenv.c \
 src/stdlib/SDL_iconv.c \
 src/stdlib/SDL_malloc.c \
@@ -73,37 +84,29 @@
 src/thread/nds/SDL_sysmutex.c \
 src/thread/nds/SDL_syssem.c \
 src/thread/nds/SDL_systhread.c \
+src/timer/SDL_timer.c \
 src/timer/nds/SDL_systimer.c \
-src/timer/SDL_timer.c \
-src/video/nds/SDL_ndsevents.c \
-src/video/nds/SDL_ndsrender.c \
-src/video/nds/SDL_ndsvideo.c \
-src/video/dummy/SDL_nullevents.c \
-src/video/dummy/SDL_nullrender.c \
-src/video/dummy/SDL_nullvideo.c \
+src/video/SDL_RLEaccel.c \
+src/video/SDL_blit.c \
 src/video/SDL_blit_0.c \
 src/video/SDL_blit_1.c \
 src/video/SDL_blit_A.c \
+src/video/SDL_blit_N.c \
 src/video/SDL_blit_auto.c \
-src/video/SDL_blit.c \
 src/video/SDL_blit_copy.c \
-src/video/SDL_blit_N.c \
 src/video/SDL_blit_slow.c \
 src/video/SDL_bmp.c \
-src/video/SDL_drawline.c \
-src/video/SDL_drawpoint.c \
 src/video/SDL_fillrect.c \
-src/video/SDL_gamma.c \
 src/video/SDL_pixels.c \
 src/video/SDL_rect.c \
-src/video/SDL_renderer_gl.c \
-src/video/SDL_renderer_sw.c \
-src/video/SDL_RLEaccel.c \
 src/video/SDL_stretch.c \
 src/video/SDL_surface.c \
 src/video/SDL_video.c \
-src/video/SDL_yuv_mmx.c \
-src/video/SDL_yuv_sw.c \
+src/video/dummy/SDL_nullevents.c \
+src/video/dummy/SDL_nullvideo.c \
+src/video/nds/SDL_ndsevents.c \
+src/video/nds/SDL_ndsrender.c \
+src/video/nds/SDL_ndsvideo.c \
 
 OBJS = $(SRCS:.c=.o)
 
@@ -113,7 +116,7 @@
 test/nds-test-progs/sprite2/sprite2.nds \
 
 
-all: $(TARGET)
+all: $(TARGET) install nds_test
 
 $(TARGET): copy_config \
 	$(OBJS)
@@ -126,7 +129,9 @@
 	@cp include/*.h $(DEVKITPRO)/libnds/include/SDL/
 
 nds_test:
-	$(MAKE) -C test/nds-test-progs
+	$(MAKE) -C test/nds-test-progs/general
+#	$(MAKE) -C test/nds-test-progs/sprite
+#	$(MAKE) -C test/nds-test-progs/sprite2
 
 copy_config:
 	@cp include/SDL_config.h.default include/SDL_config.h
--- a/Makefile.in	Sun Feb 06 23:48:31 2011 -0800
+++ b/Makefile.in	Sat Feb 12 19:16:09 2011 -0800
@@ -59,6 +59,7 @@
 	SDL_keyboard.h \
 	SDL_keysym.h \
 	SDL_loadso.h \
+	SDL_log.h \
 	SDL_main.h \
 	SDL_mouse.h \
 	SDL_mutex.h \
--- a/VisualC/SDL/SDL_VS2005.vcproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/VisualC/SDL/SDL_VS2005.vcproj	Sat Feb 12 19:16:09 2011 -0800
@@ -900,10 +900,6 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\src\video\SDL_leaks.h"
-			>
-		</File>
-		<File
 			RelativePath="..\..\src\stdlib\SDL_malloc.c"
 			>
 		</File>
--- a/VisualC/SDL/SDL_VS2008.vcproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/VisualC/SDL/SDL_VS2008.vcproj	Sat Feb 12 19:16:09 2011 -0800
@@ -458,6 +458,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\SDL_log.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\include\SDL_main.h"
 				>
 			</File>
@@ -863,10 +867,6 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\src\video\SDL_gamma.c"
-			>
-		</File>
-		<File
 			RelativePath="..\..\src\events\SDL_gesture.c"
 			>
 		</File>
@@ -915,7 +915,7 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\src\video\SDL_leaks.h"
+			RelativePath="..\..\src\SDL_log.c"
 			>
 		</File>
 		<File
@@ -1047,6 +1047,14 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\src\render\opengl\SDL_shaders_gl.c"
+			>
+		</File>
+		<File
+			RelativePath="..\..\src\render\opengl\SDL_shaders_gl.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\src\video\SDL_shape.c"
 			>
 		</File>
@@ -1219,14 +1227,6 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\src\video\windows\SDL_windowsgamma.c"
-			>
-		</File>
-		<File
-			RelativePath="..\..\src\video\windows\SDL_windowsgamma.h"
-			>
-		</File>
-		<File
 			RelativePath="..\..\src\video\windows\SDL_windowskeyboard.c"
 			>
 		</File>
--- a/VisualC/SDL/SDL_VS2010.vcxproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/VisualC/SDL/SDL_VS2010.vcxproj	Sat Feb 12 19:16:09 2011 -0800
@@ -249,6 +249,7 @@
     <ClInclude Include="..\..\include\SDL_keyboard.h" />
     <ClInclude Include="..\..\include\SDL_keysym.h" />
     <ClInclude Include="..\..\include\SDL_loadso.h" />
+    <ClInclude Include="..\..\include\SDL_log.h" />
     <ClInclude Include="..\..\include\SDL_main.h" />
     <ClInclude Include="..\..\include\SDL_mouse.h" />
     <ClInclude Include="..\..\include\SDL_mutex.h" />
@@ -284,6 +285,7 @@
     <ClInclude Include="..\..\src\libm\math.h" />
     <ClInclude Include="..\..\src\libm\math_private.h" />
     <ClInclude Include="..\..\src\render\mmx.h" />
+    <ClInclude Include="..\..\src\render\opengl\SDL_shaders_gl.h" />
     <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
     <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
     <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
@@ -313,7 +315,6 @@
     <ClInclude Include="..\..\src\video\SDL_glfuncs.h" />
     <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
     <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
-    <ClInclude Include="..\..\src\video\SDL_leaks.h" />
     <ClInclude Include="..\..\src\audio\SDL_mixer_m68k.h" />
     <ClInclude Include="..\..\src\audio\SDL_mixer_MMX.h" />
     <ClInclude Include="..\..\src\audio\SDL_mixer_MMX_VC.h" />
@@ -339,7 +340,6 @@
     <ClInclude Include="..\..\src\video\windows\SDL_windowsclipboard.h" />
     <ClInclude Include="..\..\src\video\windows\SDL_windowsevents.h" />
     <ClInclude Include="..\..\src\video\windows\SDL_windowsframebuffer.h" />
-    <ClInclude Include="..\..\src\video\windows\SDL_windowsgamma.h" />
     <ClInclude Include="..\..\src\video\windows\SDL_windowskeyboard.h" />
     <ClInclude Include="..\..\src\video\windows\SDL_windowsmodes.h" />
     <ClInclude Include="..\..\src\video\windows\SDL_windowsmouse.h" />
@@ -372,6 +372,7 @@
     <ClCompile Include="..\..\src\libm\s_sin.c" />
     <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
     <ClCompile Include="..\..\src\render\opengl\SDL_render_gl.c" />
+    <ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
     <ClCompile Include="..\..\src\render\SDL_render.c" />
     <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
     <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
@@ -390,6 +391,7 @@
     <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
     <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
     <ClCompile Include="..\..\src\SDL_hints.c" />
+    <ClCompile Include="..\..\src\SDL_log.c" />
     <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
     <ClCompile Include="..\..\src\video\SDL_blit.c" />
     <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
@@ -413,7 +415,6 @@
     <ClCompile Include="..\..\src\events\SDL_events.c" />
     <ClCompile Include="..\..\src\SDL_fatal.c" />
     <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
-    <ClCompile Include="..\..\src\video\SDL_gamma.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
     <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
@@ -453,7 +454,6 @@
     <ClCompile Include="..\..\src\video\windows\SDL_windowsclipboard.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" />
-    <ClCompile Include="..\..\src\video\windows\SDL_windowsgamma.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowskeyboard.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" />
@@ -466,4 +466,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
--- a/VisualCE/SDL/SDL.vcproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/VisualCE/SDL/SDL.vcproj	Sat Feb 12 19:16:09 2011 -0800
@@ -862,10 +862,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\video\SDL_gamma.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\events\SDL_gesture.c"
 				>
 			</File>
@@ -878,6 +874,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\SDL_hints.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\stdlib\SDL_iconv.c"
 				>
 			</File>
@@ -890,6 +890,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\SDL_log.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\stdlib\SDL_malloc.c"
 				>
 			</File>
@@ -938,7 +942,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\render\software\SDL_renderer_sw.c"
+				RelativePath="..\..\src\render\software\SDL_render_sw.c"
 				>
 			</File>
 			<File
@@ -1046,10 +1050,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\video\windows\SDL_windowsgamma.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\video\windows\SDL_windowskeyboard.c"
 				>
 			</File>
@@ -1231,18 +1231,46 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\SDL_hints.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\SDL_input.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\SDL_joystick.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\joystick\SDL_joystick_c.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\SDL_keyboard.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\events\SDL_keyboard_c.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\SDL_keysym.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\video\SDL_leaks.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\SDL_loadso.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\SDL_log.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\events\SDL_mouse_c.h"
 				>
 			</File>
@@ -1271,6 +1299,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\render\software\SDL_render_sw_c.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\render\software\SDL_renderer_sw_c.h"
 				>
 			</File>
@@ -1359,10 +1391,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\video\windows\SDL_windowsgamma.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\video\windows\SDL_windowskeyboard.h"
 				>
 			</File>
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat Feb 12 19:16:09 2011 -0800
@@ -76,7 +76,7 @@
 		0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85512FE70C600CECEE3 /* SDL_render_gles2.c */; };
 		0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85612FE70C600CECEE3 /* SDL_shaders_gles2.c */; };
 		0402A85A12FE70C600CECEE3 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 0402A85712FE70C600CECEE3 /* SDL_shaders_gles2.h */; };
-		04043B8D12FEA9350076DB1F /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043B8C12FEA9350076DB1F /* SDL_opengles2.h */; };
+		04043B8D12FEA9350076DB1F /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043B8C12FEA9350076DB1F /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		041B2CD912FA0E9E0087D585 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CD812FA0E9E0087D585 /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		041B2CF112FA0F680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; };
 		041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; };
@@ -86,7 +86,7 @@
 		04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
 		04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; };
 		04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
-		0442EC4B12FE1BFF004C9285 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4A12FE1BFF004C9285 /* SDL_hints.h */; };
+		0442EC4B12FE1BFF004C9285 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4A12FE1BFF004C9285 /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; };
 		0442EC5112FE1C1E004C9285 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; };
 		0442EC5312FE1C28004C9285 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5212FE1C28004C9285 /* SDL_render_gles.c */; };
@@ -111,6 +111,9 @@
 		04BA9D6611EF474A00B60E01 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6211EF474A00B60E01 /* SDL_touch.c */; };
 		04BA9D7D11EF497E00B60E01 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D7B11EF497E00B60E01 /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		04BA9D7E11EF497E00B60E01 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D7C11EF497E00B60E01 /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		04BAC0991300C0F70055DE28 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC0981300C0F70055DE28 /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */; };
+		04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC09B1300C1290055DE28 /* SDL_log.c */; };
 		04EC8B521025D12900431D42 /* SDL_config_iphoneos.h in Headers */ = {isa = PBXBuildFile; fileRef = 04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		04F2AF541104ABC300D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF531104ABC300D6DDF7 /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		04F2AF561104ABD200D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */; };
@@ -235,8 +238,6 @@
 		FDA684560DF2374E00F98A1A /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683090DF2374E00F98A1A /* SDL_blit_N.c */; };
 		FDA684570DF2374E00F98A1A /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */; };
 		FDA684580DF2374E00F98A1A /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */; };
-		FDA6845A0DF2374E00F98A1A /* SDL_gamma.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830D0DF2374E00F98A1A /* SDL_gamma.c */; };
-		FDA6845B0DF2374E00F98A1A /* SDL_leaks.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6830E0DF2374E00F98A1A /* SDL_leaks.h */; };
 		FDA6845C0DF2374E00F98A1A /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */; };
 		FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */; };
 		FDA6845E0DF2374E00F98A1A /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683110DF2374E00F98A1A /* SDL_rect.c */; };
@@ -381,6 +382,9 @@
 		04BA9D6211EF474A00B60E01 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_touch.c; sourceTree = "<group>"; };
 		04BA9D7B11EF497E00B60E01 /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = ../../include/SDL_gesture.h; sourceTree = SOURCE_ROOT; };
 		04BA9D7C11EF497E00B60E01 /* SDL_touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_touch.h; path = ../../include/SDL_touch.h; sourceTree = SOURCE_ROOT; };
+		04BAC0981300C0F70055DE28 /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_log.h; path = ../../include/SDL_log.h; sourceTree = SOURCE_ROOT; };
+		04BAC09A1300C1290055DE28 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; };
+		04BAC09B1300C1290055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; };
 		04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_iphoneos.h; path = ../../include/SDL_config_iphoneos.h; sourceTree = SOURCE_ROOT; };
 		04F2AF531104ABC300D6DDF7 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = ../../include/SDL_assert.h; sourceTree = SOURCE_ROOT; };
 		04F2AF551104ABD200D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; };
@@ -532,8 +536,6 @@
 		FDA683090DF2374E00F98A1A /* SDL_blit_N.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_N.c; sourceTree = "<group>"; };
 		FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_slow.c; sourceTree = "<group>"; };
 		FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_bmp.c; sourceTree = "<group>"; };
-		FDA6830D0DF2374E00F98A1A /* SDL_gamma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamma.c; sourceTree = "<group>"; };
-		FDA6830E0DF2374E00F98A1A /* SDL_leaks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_leaks.h; sourceTree = "<group>"; };
 		FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_pixels.c; sourceTree = "<group>"; };
 		FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels_c.h; sourceTree = "<group>"; };
 		FDA683110DF2374E00F98A1A /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rect.c; sourceTree = "<group>"; };
@@ -949,6 +951,7 @@
 				FD99B8DF0DD52EB400FB1D6B /* SDL_keyboard.h */,
 				FD99B8E00DD52EB400FB1D6B /* SDL_keysym.h */,
 				FD99B8E10DD52EB400FB1D6B /* SDL_loadso.h */,
+				04BAC0981300C0F70055DE28 /* SDL_log.h */,
 				FD99B8E20DD52EB400FB1D6B /* SDL_main.h */,
 				FD99B8E30DD52EB400FB1D6B /* SDL_mouse.h */,
 				FD99B8E40DD52EB400FB1D6B /* SDL_mutex.h */,
@@ -997,12 +1000,14 @@
 				FD99BA1E0DD52EDC00FB1D6B /* timer */,
 				FDA682420DF2374D00F98A1A /* video */,
 				04F2AF551104ABD200D6DDF7 /* SDL_assert.c */,
+				04BAC09A1300C1290055DE28 /* SDL_assert_c.h */,
 				FD99B9D30DD52EDC00FB1D6B /* SDL_compat.c */,
 				FD99B9D40DD52EDC00FB1D6B /* SDL_error_c.h */,
 				FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */,
 				FD99B9D60DD52EDC00FB1D6B /* SDL_fatal.c */,
 				FD99B9D70DD52EDC00FB1D6B /* SDL_fatal.h */,
 				0442EC5412FE1C3F004C9285 /* SDL_hints.c */,
+				04BAC09B1300C1290055DE28 /* SDL_log.c */,
 				FD99B9D80DD52EDC00FB1D6B /* SDL.c */,
 			);
 			name = "Library Source";
@@ -1154,8 +1159,6 @@
 				FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */,
 				044E5FB711E606EB0076F181 /* SDL_clipboard.c */,
 				0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */,
-				FDA6830D0DF2374E00F98A1A /* SDL_gamma.c */,
-				FDA6830E0DF2374E00F98A1A /* SDL_leaks.h */,
 				FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */,
 				FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */,
 				FDA683110DF2374E00F98A1A /* SDL_rect.c */,
@@ -1226,7 +1229,6 @@
 				FDA6844E0DF2374E00F98A1A /* SDL_blit.h in Headers */,
 				FDA684530DF2374E00F98A1A /* SDL_blit_auto.h in Headers */,
 				FDA684550DF2374E00F98A1A /* SDL_blit_copy.h in Headers */,
-				FDA6845B0DF2374E00F98A1A /* SDL_leaks.h in Headers */,
 				FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */,
 				FDA684630DF2374E00F98A1A /* SDL_RLEaccel_c.h in Headers */,
 				FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */,
@@ -1279,6 +1281,8 @@
 				0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */,
 				0402A85A12FE70C600CECEE3 /* SDL_shaders_gles2.h in Headers */,
 				04043B8D12FEA9350076DB1F /* SDL_opengles2.h in Headers */,
+				04BAC0991300C0F70055DE28 /* SDL_log.h in Headers */,
+				04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1495,7 +1499,6 @@
 				FDA684560DF2374E00F98A1A /* SDL_blit_N.c in Sources */,
 				FDA684570DF2374E00F98A1A /* SDL_blit_slow.c in Sources */,
 				FDA684580DF2374E00F98A1A /* SDL_bmp.c in Sources */,
-				FDA6845A0DF2374E00F98A1A /* SDL_gamma.c in Sources */,
 				FDA6845C0DF2374E00F98A1A /* SDL_pixels.c in Sources */,
 				FDA6845E0DF2374E00F98A1A /* SDL_rect.c in Sources */,
 				FDA684620DF2374E00F98A1A /* SDL_RLEaccel.c in Sources */,
@@ -1545,6 +1548,7 @@
 				0442EC5512FE1C3F004C9285 /* SDL_hints.c in Sources */,
 				0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */,
 				0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */,
+				04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Sun Feb 06 23:48:31 2011 -0800
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Sat Feb 12 19:16:09 2011 -0800
@@ -129,6 +129,10 @@
 		041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
 		041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; };
 		041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
+		0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; };
+		0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
+		043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; };
+		043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
 		04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
 		04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
 		04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
@@ -155,6 +159,10 @@
 		044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; };
 		0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		0469A10D12EE4BF100B846D6 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */; };
+		04BAC0B31300C1CB0055DE28 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC0B21300C1CB0055DE28 /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		04BAC0B41300C1CB0055DE28 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC0B21300C1CB0055DE28 /* SDL_log.h */; };
+		04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; };
+		04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; };
 		04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; };
 		04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; };
 		04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
@@ -279,8 +287,6 @@
 		04BD018112E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; };
 		04BD018212E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; };
 		04BD018712E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; };
-		04BD018812E6671800899322 /* SDL_gamma.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6112E6671800899322 /* SDL_gamma.c */; };
-		04BD018B12E6671800899322 /* SDL_leaks.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6412E6671800899322 /* SDL_leaks.h */; };
 		04BD018C12E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; };
 		04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; };
 		04BD018E12E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; };
@@ -300,8 +306,6 @@
 		04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; };
 		04BD01E112E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; };
 		04BD01E212E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; };
-		04BD01E312E6671800899322 /* SDL_x11gamma.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC012E6671800899322 /* SDL_x11gamma.c */; };
-		04BD01E412E6671800899322 /* SDL_x11gamma.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC112E6671800899322 /* SDL_x11gamma.h */; };
 		04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; };
 		04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; };
 		04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; };
@@ -467,8 +471,6 @@
 		04BD039B12E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; };
 		04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; };
 		04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; };
-		04BD03A212E6671800899322 /* SDL_gamma.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6112E6671800899322 /* SDL_gamma.c */; };
-		04BD03A512E6671800899322 /* SDL_leaks.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6412E6671800899322 /* SDL_leaks.h */; };
 		04BD03A612E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; };
 		04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; };
 		04BD03A812E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; };
@@ -488,8 +490,6 @@
 		04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; };
 		04BD03F912E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; };
 		04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; };
-		04BD03FB12E6671800899322 /* SDL_x11gamma.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC012E6671800899322 /* SDL_x11gamma.c */; };
-		04BD03FC12E6671800899322 /* SDL_x11gamma.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC112E6671800899322 /* SDL_x11gamma.h */; };
 		04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; };
 		04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; };
 		04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; };
@@ -696,6 +696,8 @@
 		041B2C9412FA0D2A0087D585 /* SDL_render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_render.h; path = ../../include/SDL_render.h; sourceTree = SOURCE_ROOT; };
 		041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = "<group>"; };
 		041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
+		0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = "<group>"; };
+		0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = "<group>"; };
 		04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
 		04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
 		04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
@@ -709,6 +711,8 @@
 		0442EC5E12FE1C75004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = ../../src/SDL_hints.c; sourceTree = SOURCE_ROOT; };
 		044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
 		0469A10912EE4BF100B846D6 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; };
+		04BAC0B21300C1CB0055DE28 /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_log.h; path = ../../include/SDL_log.h; sourceTree = SOURCE_ROOT; };
+		04BAC0C71300C2160055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; };
 		04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = "<group>"; };
 		04BDFD7512E6671700899322 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = "<group>"; };
 		04BDFD8812E6671700899322 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_diskaudio.c; sourceTree = "<group>"; };
@@ -835,8 +839,6 @@
 		04BDFF5A12E6671800899322 /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_bmp.c; sourceTree = "<group>"; };
 		04BDFF5B12E6671800899322 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = "<group>"; };
 		04BDFF6012E6671800899322 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_fillrect.c; sourceTree = "<group>"; };
-		04BDFF6112E6671800899322 /* SDL_gamma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamma.c; sourceTree = "<group>"; };
-		04BDFF6412E6671800899322 /* SDL_leaks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_leaks.h; sourceTree = "<group>"; };
 		04BDFF6512E6671800899322 /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_pixels.c; sourceTree = "<group>"; };
 		04BDFF6612E6671800899322 /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels_c.h; sourceTree = "<group>"; };
 		04BDFF6712E6671800899322 /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rect.c; sourceTree = "<group>"; };
@@ -856,8 +858,6 @@
 		04BDFFBD12E6671800899322 /* SDL_x11dyn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11dyn.h; sourceTree = "<group>"; };
 		04BDFFBE12E6671800899322 /* SDL_x11events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11events.c; sourceTree = "<group>"; };
 		04BDFFBF12E6671800899322 /* SDL_x11events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11events.h; sourceTree = "<group>"; };
-		04BDFFC012E6671800899322 /* SDL_x11gamma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11gamma.c; sourceTree = "<group>"; };
-		04BDFFC112E6671800899322 /* SDL_x11gamma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11gamma.h; sourceTree = "<group>"; };
 		04BDFFC212E6671800899322 /* SDL_x11keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11keyboard.c; sourceTree = "<group>"; };
 		04BDFFC312E6671800899322 /* SDL_x11keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11keyboard.h; sourceTree = "<group>"; };
 		04BDFFC412E6671800899322 /* SDL_x11modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11modes.c; sourceTree = "<group>"; };
@@ -1137,6 +1137,7 @@
 				0C5AF5F101191D2B7F000001 /* SDL_keyboard.h */,
 				0C5AF5F201191D2B7F000001 /* SDL_keysym.h */,
 				B29A290D04E5B28700A80002 /* SDL_loadso.h */,
+				04BAC0B21300C1CB0055DE28 /* SDL_log.h */,
 				0C5AF5F301191D2B7F000001 /* SDL_main.h */,
 				0C5AF5F401191D2B7F000001 /* SDL_mouse.h */,
 				0C5AF5F501191D2B7F000001 /* SDL_mutex.h */,
@@ -1199,6 +1200,8 @@
 			children = (
 				04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */,
 				0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */,
+				0435673C1303160F00BA5428 /* SDL_shaders_gl.c */,
+				0435673D1303160F00BA5428 /* SDL_shaders_gl.h */,
 			);
 			path = opengl;
 			sourceTree = "<group>";
@@ -1510,8 +1513,6 @@
 				04BDFF5A12E6671800899322 /* SDL_bmp.c */,
 				04BDFF5B12E6671800899322 /* SDL_clipboard.c */,
 				04BDFF6012E6671800899322 /* SDL_fillrect.c */,
-				04BDFF6112E6671800899322 /* SDL_gamma.c */,
-				04BDFF6412E6671800899322 /* SDL_leaks.h */,
 				04BDFF6512E6671800899322 /* SDL_pixels.c */,
 				04BDFF6612E6671800899322 /* SDL_pixels_c.h */,
 				04BDFF6712E6671800899322 /* SDL_rect.c */,
@@ -1579,8 +1580,6 @@
 				04BDFFBF12E6671800899322 /* SDL_x11events.h */,
 				0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */,
 				0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */,
-				04BDFFC012E6671800899322 /* SDL_x11gamma.c */,
-				04BDFFC112E6671800899322 /* SDL_x11gamma.h */,
 				04BDFFC212E6671800899322 /* SDL_x11keyboard.c */,
 				04BDFFC312E6671800899322 /* SDL_x11keyboard.h */,
 				04BDFFC412E6671800899322 /* SDL_x11modes.c */,
@@ -1722,6 +1721,7 @@
 				04BDFE5A12E6671700899322 /* SDL_fatal.c */,
 				04BDFE5B12E6671700899322 /* SDL_fatal.h */,
 				0442EC5E12FE1C75004C9285 /* SDL_hints.c */,
+				04BAC0C71300C2160055DE28 /* SDL_log.c */,
 				04BDFE5C12E6671700899322 /* SDL.c */,
 			);
 			name = "Library Source";
@@ -1881,7 +1881,6 @@
 				04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */,
 				04BD017D12E6671800899322 /* SDL_blit_copy.h in Headers */,
 				04BD018012E6671800899322 /* SDL_blit_slow.h in Headers */,
-				04BD018B12E6671800899322 /* SDL_leaks.h in Headers */,
 				04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */,
 				04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
 				04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */,
@@ -1890,7 +1889,6 @@
 				04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */,
 				04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */,
 				04BD01E212E6671800899322 /* SDL_x11events.h in Headers */,
-				04BD01E412E6671800899322 /* SDL_x11gamma.h in Headers */,
 				04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */,
 				04BD01E812E6671800899322 /* SDL_x11modes.h in Headers */,
 				04BD01EA12E6671800899322 /* SDL_x11mouse.h in Headers */,
@@ -1932,6 +1930,8 @@
 				0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */,
 				0442EC5B12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */,
 				04043BBB12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */,
+				04BAC0B31300C1CB0055DE28 /* SDL_log.h in Headers */,
+				0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2010,7 +2010,6 @@
 				04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */,
 				04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */,
 				04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */,
-				04BD03A512E6671800899322 /* SDL_leaks.h in Headers */,
 				04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */,
 				04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
 				04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */,
@@ -2019,7 +2018,6 @@
 				04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */,
 				04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */,
 				04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */,
-				04BD03FC12E6671800899322 /* SDL_x11gamma.h in Headers */,
 				04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */,
 				04BD040012E6671800899322 /* SDL_x11modes.h in Headers */,
 				04BD040212E6671800899322 /* SDL_x11mouse.h in Headers */,
@@ -2061,6 +2059,8 @@
 				0442EC1E12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */,
 				0442EC5D12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */,
 				04043BBC12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */,
+				04BAC0B41300C1CB0055DE28 /* SDL_log.h in Headers */,
+				043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2392,7 +2392,6 @@
 				04BD018112E6671800899322 /* SDL_bmp.c in Sources */,
 				04BD018212E6671800899322 /* SDL_clipboard.c in Sources */,
 				04BD018712E6671800899322 /* SDL_fillrect.c in Sources */,
-				04BD018812E6671800899322 /* SDL_gamma.c in Sources */,
 				04BD018C12E6671800899322 /* SDL_pixels.c in Sources */,
 				04BD018E12E6671800899322 /* SDL_rect.c in Sources */,
 				04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */,
@@ -2404,7 +2403,6 @@
 				04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */,
 				04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */,
 				04BD01E112E6671800899322 /* SDL_x11events.c in Sources */,
-				04BD01E312E6671800899322 /* SDL_x11gamma.c in Sources */,
 				04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */,
 				04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */,
 				04BD01E912E6671800899322 /* SDL_x11mouse.c in Sources */,
@@ -2431,6 +2429,8 @@
 				0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */,
 				0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
 				0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */,
+				04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */,
+				0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2511,7 +2511,6 @@
 				04BD039B12E6671800899322 /* SDL_bmp.c in Sources */,
 				04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */,
 				04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */,
-				04BD03A212E6671800899322 /* SDL_gamma.c in Sources */,
 				04BD03A612E6671800899322 /* SDL_pixels.c in Sources */,
 				04BD03A812E6671800899322 /* SDL_rect.c in Sources */,
 				04BD03B012E6671800899322 /* SDL_RLEaccel.c in Sources */,
@@ -2523,7 +2522,6 @@
 				04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */,
 				04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */,
 				04BD03F912E6671800899322 /* SDL_x11events.c in Sources */,
-				04BD03FB12E6671800899322 /* SDL_x11gamma.c in Sources */,
 				04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */,
 				04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */,
 				04BD040112E6671800899322 /* SDL_x11mouse.c in Sources */,
@@ -2550,6 +2548,8 @@
 				0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */,
 				0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
 				0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */,
+				04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */,
+				043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
--- a/android-project/src/org/libsdl/app/SDLActivity.java	Sun Feb 06 23:48:31 2011 -0800
+++ b/android-project/src/org/libsdl/app/SDLActivity.java	Sat Feb 12 19:16:09 2011 -0800
@@ -101,8 +101,8 @@
 
     // Java functions called from C
 
-    public static void createGLContext() {
-        mSurface.initEGL();
+    public static boolean createGLContext(int majorVersion, int minorVersion) {
+        return mSurface.initEGL(majorVersion, minorVersion);
     }
 
     public static void flipBuffers() {
@@ -351,11 +351,10 @@
 
 
     // EGL functions
-    public boolean initEGL() {
-        Log.v("SDL", "Starting up");
+    public boolean initEGL(int majorVersion, int minorVersion) {
+        Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
 
         try {
-
             EGL10 egl = (EGL10)EGLContext.getEGL();
 
             EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
@@ -363,20 +362,43 @@
             int[] version = new int[2];
             egl.eglInitialize(dpy, version);
 
+            int EGL_OPENGL_ES_BIT = 1;
+            int EGL_OPENGL_ES2_BIT = 4;
+            int renderableType = 0;
+            if (majorVersion == 2) {
+                renderableType = EGL_OPENGL_ES2_BIT;
+            } else if (majorVersion == 1) {
+                renderableType = EGL_OPENGL_ES_BIT;
+            }
             int[] configSpec = {
-                    //EGL10.EGL_DEPTH_SIZE,   16,
-                    EGL10.EGL_NONE
+                //EGL10.EGL_DEPTH_SIZE,   16,
+                EGL10.EGL_RENDERABLE_TYPE, renderableType,
+                EGL10.EGL_NONE
             };
             EGLConfig[] configs = new EGLConfig[1];
             int[] num_config = new int[1];
-            egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config);
+            if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0) {
+                Log.e("SDL", "No EGL config available");
+                return false;
+            }
             EGLConfig config = configs[0];
 
             EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);
+            if (ctx == EGL10.EGL_NO_CONTEXT) {
+                Log.e("SDL", "Couldn't create context");
+                return false;
+            }
 
             EGLSurface surface = egl.eglCreateWindowSurface(dpy, config, this, null);
+            if (surface == EGL10.EGL_NO_SURFACE) {
+                Log.e("SDL", "Couldn't create surface");
+                return false;
+            }
 
-            egl.eglMakeCurrent(dpy, surface, surface, ctx);
+            if (!egl.eglMakeCurrent(dpy, surface, surface, ctx)) {
+                Log.e("SDL", "Couldn't make context current");
+                return false;
+            }
 
             mEGLContext = ctx;
             mEGLDisplay = dpy;
--- a/configure.in	Sun Feb 06 23:48:31 2011 -0800
+++ b/configure.in	Sat Feb 12 19:16:09 2011 -0800
@@ -362,6 +362,12 @@
 if test x$enable_video != xyes; then
     AC_DEFINE(SDL_VIDEO_DISABLED)
 fi
+AC_ARG_ENABLE(render,
+AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
+              , enable_render=yes)
+if test x$enable_render != xyes; then
+    AC_DEFINE(SDL_RENDER_DISABLED)
+fi
 AC_ARG_ENABLE(events,
 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
               , enable_events=yes)
@@ -422,6 +428,12 @@
 if test x$enable_cpuinfo != xyes; then
     AC_DEFINE(SDL_CPUINFO_DISABLED)
 fi
+AC_ARG_ENABLE(atomic,
+AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
+              , enable_atomic=yes)
+if test x$enable_atomic != xyes; then
+    AC_DEFINE(SDL_ATOMIC_DISABLED)
+fi
 AC_ARG_ENABLE(assembly,
 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
               , enable_assembly=yes)
@@ -489,33 +501,6 @@
         fi
     fi
 
-    AC_ARG_ENABLE(3dnow,
-AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
-                  , enable_3dnow=yes)
-    if test x$enable_3dnow = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_3dnow=no
-        AC_MSG_CHECKING(for GCC -m3dnow option)
-        amd3dnow_CFLAGS="-m3dnow"
-        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
-
-        AC_TRY_COMPILE([
-        #include <mm3dnow.h>
-        #ifndef __3dNOW__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        ],[
-        have_gcc_3dnow=yes
-        ])
-        AC_MSG_RESULT($have_gcc_3dnow)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_3dnow = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
-        fi
-    fi
-
     AC_ARG_ENABLE(sse,
 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
                   , enable_sse=yes)
@@ -587,82 +572,6 @@
             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
         fi
     fi
-
-    AC_ARG_ENABLE(altivec,
-AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
-                  , enable_altivec=yes)
-    if test x$enable_altivec = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_altivec=no
-        have_altivec_h_hdr=no
-        altivec_CFLAGS="-maltivec"
-        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
-
-        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
-        AC_TRY_COMPILE([
-        #include <altivec.h>
-        vector unsigned int vzero() {
-            return vec_splat_u32(0);
-        }
-        ],[
-        ],[
-        have_gcc_altivec=yes
-        have_altivec_h_hdr=yes
-        ])
-        AC_MSG_RESULT($have_gcc_altivec)
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
-            AC_TRY_COMPILE([
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
-            altivec_CFLAGS="-faltivec"
-            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
-            AC_TRY_COMPILE([
-            #include <altivec.h>
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            have_altivec_h_hdr=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
-            AC_TRY_COMPILE([
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_altivec = xyes; then
-            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
-            if test x$have_altivec_h_hdr = xyes; then
-              AC_DEFINE(HAVE_ALTIVEC_H)
-            fi
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
-        fi
-    fi
 fi
 
 dnl See if the OSS audio interface is supported
--- a/include/SDL.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -81,6 +81,7 @@
 #include "SDL_events.h"
 #include "SDL_hints.h"
 #include "SDL_loadso.h"
+#include "SDL_log.h"
 #include "SDL_mutex.h"
 #include "SDL_power.h"
 #include "SDL_render.h"
--- a/include/SDL_assert.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_assert.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_atomic.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_atomic.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -141,6 +141,9 @@
 /* Platform specific optimized versions of the atomic functions,
  * you can disable these by defining SDL_DISABLE_ATOMIC_INLINE
  */
+#if SDL_ATOMIC_DISABLED
+#define SDL_DISABLE_ATOMIC_INLINE
+#endif
 #ifndef SDL_DISABLE_ATOMIC_INLINE
 
 #ifdef HAVE_MSC_ATOMICS
--- a/include/SDL_audio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_audio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_blendmode.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_blendmode.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_clipboard.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_clipboard.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_compat.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_compat.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -215,8 +215,12 @@
  */
 /*@{*/
 
-#define SDL_keysym		SDL_KeySym
-#define SDL_scancode	SDL_ScanCode
+#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
@@ -324,6 +328,12 @@
                                                   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);
--- a/include/SDL_config.h.default	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config.h.default	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
--- a/include/SDL_config.h.in	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config.h.in	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
@@ -82,7 +82,6 @@
 #undef HAVE_MATH_H
 #undef HAVE_ICONV_H
 #undef HAVE_SIGNAL_H
-#undef HAVE_ALTIVEC_H
 
 /* C library functions */
 #undef HAVE_MALLOC
@@ -171,6 +170,7 @@
 #undef SDL_DEFAULT_ASSERT_LEVEL
 
 /* Allow disabling of core subsystems */
+#undef SDL_ATOMIC_DISABLED
 #undef SDL_AUDIO_DISABLED
 #undef SDL_CPUINFO_DISABLED
 #undef SDL_EVENTS_DISABLED
@@ -178,6 +178,7 @@
 #undef SDL_JOYSTICK_DISABLED
 #undef SDL_HAPTIC_DISABLED
 #undef SDL_LOADSO_DISABLED
+#undef SDL_RENDER_DISABLED
 #undef SDL_THREADS_DISABLED
 #undef SDL_TIMERS_DISABLED
 #undef SDL_VIDEO_DISABLED
@@ -301,6 +302,5 @@
 
 /* Enable assembly routines */
 #undef SDL_ASSEMBLY_ROUTINES
-#undef SDL_ALTIVEC_BLITTERS
 
 #endif /* _SDL_config_h */
--- a/include/SDL_config_android.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_android.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_config_iphoneos.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_iphoneos.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_config_macosx.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_macosx.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -168,8 +168,5 @@
 
 /* Enable assembly routines */
 #define SDL_ASSEMBLY_ROUTINES	1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS	1
-#endif
 
 #endif /* _SDL_config_macosx_h */
--- a/include/SDL_config_minimal.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_minimal.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_config_nintendods.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_nintendods.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -46,6 +46,8 @@
 #endif
 #endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 
+#define SIZEOF_VOIDP 4
+
 #define SDL_HAS_64BIT_TYPE	1
 
 /* Useful headers */
@@ -113,9 +115,12 @@
 
 /* Enable various video drivers */
 #define SDL_VIDEO_DRIVER_NDS	1
-/*#define SDL_VIDEO_DRIVER_DUMMY	1 TODO: uncomment this later*/
+#define SDL_VIDEO_RENDER_NDS	1
 
 /* Enable system power support */
 #define SDL_POWER_NINTENDODS 1
 
+/* Enable haptic support */
+#define SDL_HAPTIC_NDS 1
+
 #endif /* _SDL_config_nintendods_h */
--- a/include/SDL_config_pandora.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_pandora.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_config_windows.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_windows.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_config_wiz.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_config_wiz.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_copying.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_copying.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_cpuinfo.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_cpuinfo.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -70,21 +70,6 @@
 extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
 
 /**
- *  This function returns true if the CPU has MMX Ext.\ features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
-
-/**
- *  This function returns true if the CPU has 3DNow!\ features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
-
-/**
- *  This function returns true if the CPU has 3DNow!\ Ext.\ features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
-
-/**
  *  This function returns true if the CPU has SSE features.
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
@@ -95,9 +80,20 @@
 extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
 
 /**
- *  This function returns true if the CPU has AltiVec features.
+ *  This function returns true if the CPU has SSE3 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
+
+/**
+ *  This function returns true if the CPU has SSE4.1 features.
  */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
+
+/**
+ *  This function returns true if the CPU has SSE4.2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
+
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
--- a/include/SDL_endian.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_endian.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_error.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_error.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -48,7 +48,7 @@
  *  \name Internal error functions
  *  
  *  \internal 
- *  Private error message function - used internally.
+ *  Private error reporting function - used internally.
  */
 /*@{*/
 #define SDL_OutOfMemory()	SDL_Error(SDL_ENOMEM)
--- a/include/SDL_events.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_events.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -151,7 +151,7 @@
     Uint8 repeat;       /**< Non-zero if this is a key repeat */
     Uint8 padding2;
     Uint8 padding3;
-    SDL_KeySym keysym;  /**< The key that was pressed or released */
+    SDL_Keysym keysym;  /**< The key that was pressed or released */
 } SDL_KeyboardEvent;
 
 #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
--- a/include/SDL_gesture.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_gesture.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_hints.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_hints.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DihintsMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -77,12 +77,27 @@
  *  This variable is case insensitive and can be set to the following values:
  *    "direct3d"
  *    "opengl"
+ *    "opengles2"
  *    "opengles"
  *    "software"
+ *
+ *  The default varies by platform, but it's the first one in the list that
+ *  is available on the current platform.
  */
 #define SDL_HINT_RENDER_DRIVER              "SDL_RENDER_DRIVER"
 
 /**
+ *  \brief  A variable controlling whether the OpenGL render driver uses shaders if they are available.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Disable shaders
+ *    "1"       - Enable shaders
+ *
+ *  By default shaders are used if OpenGL supports them.
+ */
+#define SDL_HINT_RENDER_OPENGL_SHADERS      "SDL_RENDER_OPENGL_SHADERS"
+
+/**
  *  \brief  A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
  *
  *  This variable can be set to the following values:
@@ -139,7 +154,7 @@
  *
  *  This function is called during SDL_Quit() to free stored hints.
  */
-extern DECLSPEC void SDLCALL SDL_ClearHints();
+extern DECLSPEC void SDLCALL SDL_ClearHints(void);
 
 
 /* Ends C function definitions when using C++ */
--- a/include/SDL_input.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_input.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_joystick.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_joystick.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_keyboard.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_keyboard.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -45,13 +45,13 @@
 /**
  *  \brief The SDL keysym structure, used in key events.
  */
-typedef struct SDL_KeySym
+typedef struct SDL_Keysym
 {
-    SDL_ScanCode scancode;      /**< SDL physical key code - see ::SDL_ScanCode for details */
-    SDLKey sym;                 /**< SDL virtual key code - see ::SDLKey for details */
+    SDL_Scancode scancode;      /**< SDL physical key code - see ::SDL_Scancode for details */
+    SDL_Keycode sym;            /**< SDL virtual key code - see ::SDL_Keycode for details */
     Uint16 mod;                 /**< current key modifiers */
     Uint32 unicode;             /**< \deprecated use SDL_TextInputEvent instead */
-} SDL_KeySym;
+} SDL_Keysym;
 
 /* Function prototypes */
 
@@ -65,7 +65,7 @@
  *  
  *  \param numkeys if non-NULL, receives the length of the returned array.
  *  
- *  \return An array of key states. Indexes into this array are obtained by using ::SDL_ScanCode values.
+ *  \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
  *  
  *  \b Example:
  *  \code
@@ -80,34 +80,34 @@
 /**
  *  \brief Get the current key modifier state for the keyboard.
  */
-extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
+extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
 
 /**
  *  \brief Set the current key modifier state for the keyboard.
  *  
  *  \note This does not change the keyboard state, only the key modifier flags.
  */
-extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
+extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
 
 /**
  *  \brief Get the key code corresponding to the given scancode according
  *         to the current keyboard layout.
  *  
- *  See ::SDLKey for details.
+ *  See ::SDL_Keycode for details.
  *  
  *  \sa SDL_GetKeyName()
  */
-extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_ScanCode scancode);
+extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
 
 /**
  *  \brief Get the scancode corresponding to the given key code according to the
  *         current keyboard layout.
  *  
- *  See ::SDL_ScanCode for details.
+ *  See ::SDL_Scancode for details.
  *  
  *  \sa SDL_GetScancodeName()
  */
-extern DECLSPEC SDL_ScanCode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
+extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
 
 /**
  *  \brief Get a human-readable name for a scancode.
@@ -117,9 +117,9 @@
  *          copy it.  If the scancode doesn't have a name, this function returns
  *          an empty string ("").
  *
- *  \sa SDL_ScanCode
+ *  \sa SDL_Scancode
  */
-extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_ScanCode
+extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode
                                                         scancode);
 
 /**
@@ -130,9 +130,9 @@
  *          copy it.  If the key doesn't have a name, this function returns an 
  *          empty string ("").
  *  
- *  \sa SDLKey
+ *  \sa SDL_Key
  */
-extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
+extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
 
 /**
  *  \brief Start accepting Unicode text input events.
--- a/include/SDL_keysym.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_keysym.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -40,7 +40,7 @@
  *  the unmodified character that would be generated by pressing the key, or
  *  an SDLK_* constant for those keys that do not generate characters.
  */
-typedef Sint32 SDLKey;
+typedef Sint32 SDL_Keycode;
 
 #define SDLK_SCANCODE_MASK (1<<30)
 #define SDL_SCANCODE_TO_KEYCODE(X)	(X | SDLK_SCANCODE_MASK)
@@ -330,7 +330,7 @@
     KMOD_CAPS = 0x2000,
     KMOD_MODE = 0x4000,
     KMOD_RESERVED = 0x8000
-} SDLMod;
+} SDL_Keymod;
 
 #define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
 #define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
--- a/include/SDL_loadso.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_loadso.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/SDL_log.h	Sat Feb 12 19:16:09 2011 -0800
@@ -0,0 +1,207 @@
+/*
+    SDL - 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 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_log.h
+ *  
+ *  Simple log messages with categories and priorities.
+ *
+ *  By default logs are quiet, but if you're debugging SDL you might want:
+ *
+ *      SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
+ *
+ *  Here's where the messages go on different platforms:
+ *      Windows: debug output stream
+ *      Android: log output
+ *      Others: standard error output (stderr)
+ */
+
+#ifndef _SDL_log_h
+#define _SDL_log_h
+
+#include "SDL_stdinc.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 maximum size of a log message
+ *
+ *  Messages longer than the maximum size will be truncated
+ */
+#define SDL_MAX_LOG_MESSAGE 4096
+
+/**
+ *  \brief The predefined log categories
+ *
+ *  By default the application category is enabled at the INFO level,
+ *  and all other categories are enabled at the CRITICAL level.
+ */
+enum
+{
+    SDL_LOG_CATEGORY_APPLICATION,
+    SDL_LOG_CATEGORY_ERROR,
+    SDL_LOG_CATEGORY_SYSTEM,
+    SDL_LOG_CATEGORY_AUDIO,
+    SDL_LOG_CATEGORY_VIDEO,
+    SDL_LOG_CATEGORY_RENDER,
+    SDL_LOG_CATEGORY_INPUT,
+
+    /* Reserved for future SDL library use */
+    SDL_LOG_CATEGORY_RESERVED1,
+    SDL_LOG_CATEGORY_RESERVED2,
+    SDL_LOG_CATEGORY_RESERVED3,
+    SDL_LOG_CATEGORY_RESERVED4,
+    SDL_LOG_CATEGORY_RESERVED5,
+    SDL_LOG_CATEGORY_RESERVED6,
+    SDL_LOG_CATEGORY_RESERVED7,
+    SDL_LOG_CATEGORY_RESERVED8,
+    SDL_LOG_CATEGORY_RESERVED9,
+    SDL_LOG_CATEGORY_RESERVED10,
+
+    /* Beyond this point is reserved for application use, e.g.
+       enum {
+           MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
+           MYAPP_CATEGORY_AWESOME2,
+           MYAPP_CATEGORY_AWESOME3,
+           ...
+       };
+     */
+    SDL_LOG_CATEGORY_CUSTOM,
+};
+
+/**
+ *  \brief The predefined log priorities
+ */
+typedef enum
+{
+    SDL_LOG_PRIORITY_VERBOSE = 1,
+    SDL_LOG_PRIORITY_DEBUG,
+    SDL_LOG_PRIORITY_INFO,
+    SDL_LOG_PRIORITY_WARN,
+    SDL_LOG_PRIORITY_ERROR,
+    SDL_LOG_PRIORITY_CRITICAL,
+    SDL_NUM_LOG_PRIORITIES
+} SDL_LogPriority;
+
+
+/**
+ *  \brief Set the priority of all log categories
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
+
+/**
+ *  \brief Set the priority of a particular log category
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
+                                                SDL_LogPriority priority);
+
+/**
+ *  \brief Set the priority of a particular log category
+ */
+extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
+
+/**
+ *  \brief Reset all priorities to default.
+ *
+ *  \note This is called in SDL_Quit().
+ */
+extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
+
+/**
+ *  \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
+
+/**
+ *  \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
+ */
+extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
+
+/**
+ *  \brief Log a message with SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
+
+/**
+ *  \brief Log a message with SDL_LOG_PRIORITY_WARN
+ */
+extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
+
+/**
+ *  \brief Log a message with SDL_LOG_PRIORITY_ERROR
+ */
+extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
+
+/**
+ *  \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
+ */
+extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
+
+/**
+ *  \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
+                                            SDL_LogPriority priority,
+                                            const char *fmt, ...);
+
+/**
+ *  \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
+                                             SDL_LogPriority priority,
+                                             const char *fmt, va_list ap);
+
+/**
+ *  \brief The prototype for the log output function
+ */
+typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+
+/**
+ *  \brief Get the current log output function.
+ */
+extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
+
+/**
+ *  \brief This function allows you to replace the default log output
+ *         function with one of your own.
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_log_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/include/SDL_main.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_main.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_mouse.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_mouse.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_mutex.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_mutex.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_opengl.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_opengl.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_opengles.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_opengles.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_opengles2.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_opengles2.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_pixels.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_pixels.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -124,9 +124,7 @@
 #define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
 #define SDL_BYTESPERPIXEL(X) \
     (SDL_ISPIXELFORMAT_FOURCC(X) ? \
-        ((((X) == SDL_PIXELFORMAT_YV12) || \
-          ((X) == SDL_PIXELFORMAT_IYUV) || \
-          ((X) == SDL_PIXELFORMAT_YUY2) || \
+        ((((X) == SDL_PIXELFORMAT_YUY2) || \
           ((X) == SDL_PIXELFORMAT_UYVY) || \
           ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
 
--- a/include/SDL_platform.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_platform.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_power.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_power.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_quit.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_quit.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_rect.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_rect.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_render.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_render.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -192,6 +192,7 @@
  *          of range.
  *  
  *  \sa SDL_QueryTexture()
+ *  \sa SDL_UpdateTexture()
  *  \sa SDL_DestroyTexture()
  */
 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,                                                        Uint32 format,
@@ -363,6 +364,18 @@
 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
 
 /**
+ *  \brief Set the clipping rectangle for rendering on the current target
+ *
+ *  \param rect The rectangle to clip rendering to, or NULL to disable clipping.
+ *
+ *  The contents of the window are not defined after calling
+ *  SDL_RenderPresent(), so you should clear the clip rectangle and draw
+ *  over the entire window each frame.
+ */
+extern DECLSPEC void SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
+                                                   const SDL_Rect * rect);
+
+/**
  *  \brief Set the color used for drawing operations (Fill and Line).
  *  
  *  \param r The red value used to draw on the rendering target.
--- a/include/SDL_rwops.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_rwops.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_scancode.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_scancode.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -35,7 +35,7 @@
  *  \brief The SDL keyboard scancode representation.
  *  
  *  Values of this type are used to represent keyboard keys, among other places
- *  in the \link SDL_KeySym::scancode key.keysym.scancode \endlink field of the
+ *  in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
  *  SDL_Event structure.
  *  
  *  The values in this enumeration are based on the USB usage page standard:
@@ -392,7 +392,7 @@
 
     SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes 
                                  for array bounds */
-} SDL_ScanCode;
+} SDL_Scancode;
 
 #endif /* _SDL_scancode_h */
 
--- a/include/SDL_stdinc.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_stdinc.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_surface.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_surface.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -434,22 +434,6 @@
         source colour key.
     \endverbatim
  *  
- *  If either of the surfaces were in video memory, and the blit returns -2,
- *  the video memory was lost, so it should be reloaded with artwork and 
- *  re-blitted:
- *  @code
- *  while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
- *      while ( SDL_LockSurface(image) < 0 )
- *          Sleep(10);
- *      -- Write image pixels to image->pixels --
- *      SDL_UnlockSurface(image);
- *  }
- *  @endcode
- *  
- *  This happens under DirectX 5.0 when the system switches away from your
- *  fullscreen application.  The lock will also fail until you have access
- *  to the video memory again.
- *  
  *  You should call SDL_BlitSurface() unless you know exactly how SDL
  *  blitting works internally and how to use the other blit functions.
  */
--- a/include/SDL_syswm.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_syswm.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_thread.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_thread.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_timer.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_timer.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_touch.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_touch.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_types.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_types.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_version.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_version.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/SDL_video.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/SDL_video.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -113,12 +113,20 @@
 /**
  *  \brief Used to indicate that you don't care what the window position is.
  */
-#define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
+#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000
+#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
+#define SDL_WINDOWPOS_UNDEFINED         SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISUNDEFINED(X)    \
+            (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
 
 /**
  *  \brief Used to indicate that the window position should be centered.
  */
-#define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
+#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000
+#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
+#define SDL_WINDOWPOS_CENTERED         SDL_WINDOWPOS_CENTERED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISCENTERED(X)    \
+            (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
 
 /**
  *  \brief Event subtype for window events
@@ -236,7 +244,6 @@
  *  \brief Returns the number of available video displays.
  *  
  *  \sa SDL_GetDisplayBounds()
- *  \sa SDL_SelectVideoDisplay()
  */
 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
 
@@ -248,34 +255,14 @@
  *  
  *  \sa SDL_GetNumVideoDisplays()
  */
-extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int index, SDL_Rect * rect);
+extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
 
 /**
- *  \brief Set the index of the currently selected display.
- *  
- *  \return 0 on success, or -1 if the index is out of range.
- *  
- *  \sa SDL_GetNumVideoDisplays()
- *  \sa SDL_GetCurrentVideoDisplay()
- */
-extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
-
-/**
- *  \brief Get the index of the currently selected display.
- *  
- *  \return The index of the currently selected display.
- *  
- *  \sa SDL_GetNumVideoDisplays()
- *  \sa SDL_SelectVideoDisplay()
- */
-extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
-
-/**
- *  \brief Returns the number of available display modes for the current display.
+ *  \brief Returns the number of available display modes.
  *  
  *  \sa SDL_GetDisplayMode()
  */
-extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
+extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
 
 /**
  *  \brief Fill in information about a specific display mode.
@@ -288,19 +275,18 @@
  *  
  *  \sa SDL_GetNumDisplayModes()
  */
-extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
+extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
                                                SDL_DisplayMode * mode);
 
 /**
- *  \brief Fill in information about the desktop display mode for the current 
- *         display.
+ *  \brief Fill in information about the desktop display mode.
  */
-extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
+extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
 
 /**
  *  \brief Fill in information about the current display mode.
  */
-extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
+extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
 
 
 /**
@@ -323,16 +309,21 @@
  *  \sa SDL_GetNumDisplayModes()
  *  \sa SDL_GetDisplayMode()
  */
-extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
-                                                                   SDL_DisplayMode
-                                                                   * mode,
-                                                                   SDL_DisplayMode
-                                                                   * closest);
+extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
 
 /**
- *  \brief Set the display mode used when a fullscreen window is visible
- *         on the currently selected display.  By default the window's
- *         dimensions and the desktop format and refresh rate are used.
+ *  \brief Get the display index associated with a window.
+ *  
+ *  \return the display index of the display containing the center of the
+ *          window, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplay(SDL_Window * window);
+
+/**
+ *  \brief Set the display mode used when a fullscreen window is visible.
+ *
+ *  By default the window's dimensions and the desktop format and refresh rate
+ *  are used.
  *  
  *  \param mode The mode to use, or NULL for the default mode.
  *  
@@ -347,7 +338,7 @@
 
 /**
  *  \brief Fill in information about the display mode used when a fullscreen
- *         window is visible on the currently selected display.
+ *         window is visible.
  *
  *  \sa SDL_SetWindowDisplayMode()
  *  \sa SDL_SetWindowFullscreen()
@@ -361,55 +352,6 @@
 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
 
 /**
- *  \brief Set the gamma correction for each of the color channels on the 
- *         currently selected display.
- *  
- *  \return 0 on success, or -1 if setting the gamma isn't supported.
- *  
- *  \sa SDL_SetGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
-
-/**
- *  \brief Set the gamma ramp for the currently selected display.
- *  
- *  \param red The translation table for the red channel, or NULL.
- *  \param green The translation table for the green channel, or NULL.
- *  \param blue The translation table for the blue channel, or NULL.
- *  
- *  \return 0 on success, or -1 if gamma ramps are unsupported.
- *  
- *  Set the gamma translation table for the red, green, and blue channels
- *  of the video hardware.  Each table is an array of 256 16-bit quantities,
- *  representing a mapping between the input and output for that channel.
- *  The input is the index into the array, and the output is the 16-bit
- *  gamma value at that index, scaled to the output color precision.
- *  
- *  \sa SDL_GetGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
-                                             const Uint16 * green,
-                                             const Uint16 * blue);
-
-/**
- *  \brief Get the gamma ramp for the currently selected display.
- *  
- *  \param red   A pointer to a 256 element array of 16-bit quantities to hold 
- *               the translation table for the red channel, or NULL.
- *  \param green A pointer to a 256 element array of 16-bit quantities to hold 
- *               the translation table for the green channel, or NULL.
- *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold 
- *               the translation table for the blue channel, or NULL.
- *   
- *  \return 0 on success, or -1 if gamma ramps are unsupported.
- *  
- *  \sa SDL_SetGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
-                                             Uint16 * blue);
-
-
-/**
  *  \brief Create a window with the specified position, dimensions, and flags.
  *  
  *  \param title The title of the window, in UTF-8 encoding.
@@ -605,7 +547,7 @@
  *  \sa SDL_GetWindowDisplayMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
-                                                    int fullscreen);
+                                                    SDL_bool fullscreen);
 
 /**
  *  \brief Get an SDL surface associated with the window.
@@ -661,16 +603,6 @@
 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
 
 /**
- *  \brief Get driver specific information about a window.
- *  
- *  \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
- */
-struct SDL_SysWMinfo;
-extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
-                                                     struct SDL_SysWMinfo
-                                                     *info);
-
-/**
  *  \brief Destroy a window.
  */
 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
--- a/include/begin_code.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/begin_code.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/include/close_code.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/include/close_code.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -29,10 +29,6 @@
 #include "haptic/SDL_haptic_c.h"
 #include "joystick/SDL_joystick_c.h"
 
-#if !SDL_VIDEO_DISABLED
-#include "video/SDL_leaks.h"
-#endif
-
 /* Initialization/Cleanup routines */
 #if !SDL_TIMERS_DISABLED
 extern void SDL_StartTicks(void);
@@ -49,9 +45,6 @@
 static Uint32 SDL_initialized = 0;
 static Uint32 ticks_started = 0;
 
-#ifdef CHECK_LEAKS
-int surfaces_allocated = 0;
-#endif
 
 int
 SDL_InitSubSystem(Uint32 flags)
@@ -215,45 +208,17 @@
 SDL_Quit(void)
 {
     /* Quit all subsystems */
-#ifdef DEBUG_BUILD
-    printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n");
-    fflush(stdout);
-#endif
-
 #if defined(__WIN32__)
     SDL_HelperWindowDestroy();
 #endif
     SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
 
-#ifdef CHECK_LEAKS
-#ifdef DEBUG_BUILD
-    printf("[SDL_Quit] : CHECK_LEAKS\n");
-    fflush(stdout);
-#endif
-
-    /* !!! FIXME: make this an assertion. */
-    /* Print the number of surfaces not freed */
-    if (surfaces_allocated != 0) {
-        fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
-                surfaces_allocated);
-    }
-#endif
-#ifdef DEBUG_BUILD
-    printf("[SDL_Quit] : SDL_UninstallParachute()\n");
-    fflush(stdout);
-#endif
-
     /* Uninstall any parachute signal handlers */
     SDL_UninstallParachute();
 
     SDL_ClearHints();
     SDL_AssertionsQuit();
-
-#ifdef DEBUG_BUILD
-    printf("[SDL_Quit] : Returning!\n");
-    fflush(stdout);
-#endif
-
+    SDL_LogResetPriorities();
 }
 
 /* Get the library version number */
@@ -301,6 +266,8 @@
     return "Mac OS X";
 #elif __NETBSD__
     return "NetBSD";
+#elif __NDS__
+    return "Nintendo DS";
 #elif __OPENBSD__
     return "OpenBSD";
 #elif __OS2__
--- a/src/SDL_assert.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_assert.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL_assert_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_assert_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL_compat.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_compat.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -71,15 +71,17 @@
     return NULL;
 }
 
-static void
-SelectVideoDisplay()
+static int
+GetVideoDisplay()
 {
     const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
     if ( !variable ) {
         variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
     }
     if ( variable ) {
-        SDL_SelectVideoDisplay(SDL_atoi(variable));
+        return SDL_atoi(variable);
+    } else {
+        return 0;
     }
 }
 
@@ -89,10 +91,8 @@
     static SDL_VideoInfo info;
     SDL_DisplayMode mode;
 
-    SelectVideoDisplay();
-
     /* Memory leak, compatibility code, who cares? */
-    if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
+    if (!info.vfmt && SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode) == 0) {
         int bpp;
         Uint32 Rmask, Gmask, Bmask, Amask;
 
@@ -114,17 +114,15 @@
         return 0;
     }
 
-    SelectVideoDisplay();
-
     if (!(flags & SDL_FULLSCREEN)) {
         SDL_DisplayMode mode;
-        SDL_GetDesktopDisplayMode(&mode);
+        SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode);
         return SDL_BITSPERPIXEL(mode.format);
     }
 
-    for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
+    for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) {
         SDL_DisplayMode mode;
-        SDL_GetDisplayMode(i, &mode);
+        SDL_GetDisplayMode(GetVideoDisplay(), i, &mode);
         if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) {
             if (!mode.format) {
                 return bpp;
@@ -147,8 +145,6 @@
         return NULL;
     }
 
-    SelectVideoDisplay();
-
     if (!(flags & SDL_FULLSCREEN)) {
         return (SDL_Rect **) (-1);
     }
@@ -160,11 +156,11 @@
     /* Memory leak, but this is a compatibility function, who cares? */
     nmodes = 0;
     modes = NULL;
-    for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
+    for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) {
         SDL_DisplayMode mode;
         int bpp;
 
-        SDL_GetDisplayMode(i, &mode);
+        SDL_GetDisplayMode(GetVideoDisplay(), i, &mode);
         if (!mode.w || !mode.h) {
             return (SDL_Rect **) (-1);
         }
@@ -342,7 +338,7 @@
     }
     if (center) {
         SDL_DisplayMode mode;
-        SDL_GetDesktopDisplayMode(&mode);
+        SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode);
         *x = (mode.w - w) / 2;
         *y = (mode.h - h) / 2;
     }
@@ -453,9 +449,7 @@
         }
     }
 
-    SelectVideoDisplay();
-
-    SDL_GetDesktopDisplayMode(&desktop_mode);
+    SDL_GetDesktopDisplayMode(GetVideoDisplay(), &desktop_mode);
 
     if (width == 0) {
         width = desktop_mode.w;
@@ -525,7 +519,7 @@
     if (window_flags & SDL_WINDOW_FULLSCREEN) {
         surface_flags |= SDL_FULLSCREEN;
     }
-    if (window_flags & SDL_WINDOW_OPENGL) {
+    if ((window_flags & SDL_WINDOW_OPENGL) && (flags & SDL_OPENGL)) {
         surface_flags |= SDL_OPENGL;
     }
     if (window_flags & SDL_WINDOW_RESIZABLE) {
@@ -1526,6 +1520,26 @@
     SDL_GL_SwapWindow(SDL_VideoWindow);
 }
 
+int
+SDL_SetGamma(float red, float green, float blue)
+{
+    SDL_Unsupported();
+    return -1;
+}
+
+int
+SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
+{
+    SDL_Unsupported();
+    return -1;
+}
+
+int
+SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
+{
+    SDL_Unsupported();
+    return -1;
+}
 
 int
 SDL_EnableKeyRepeat(int delay, int interval)
--- a/src/SDL_error.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_error.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -23,14 +23,10 @@
 
 /* Simple error handling in SDL */
 
-#ifdef __ANDROID__
-#include <android/log.h>
-#endif
-
+#include "SDL_log.h"
 #include "SDL_error.h"
 #include "SDL_error_c.h"
 
-/*#define DEBUG_ERROR*/
 
 /* Routine to get the thread-specific error variable */
 #if SDL_THREADS_DISABLED
@@ -113,12 +109,7 @@
     va_end(ap);
 
     /* If we are in debug mode, print out an error message */
-#ifdef DEBUG_ERROR
-    fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
-#ifdef __ANDROID__
-    __android_log_print(ANDROID_LOG_INFO, "SDL", "ERROR: %s", SDL_GetError());
-#endif
-#endif /* DEBUG_ERROR */
+    SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
 }
 
 /* This function has a bit more overhead than most error functions
--- a/src/SDL_error_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_error_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL_fatal.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_fatal.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL_fatal.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_fatal.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/SDL_hints.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/SDL_hints.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -105,7 +105,7 @@
     return env;
 }
 
-void SDL_ClearHints()
+void SDL_ClearHints(void)
 {
     SDL_Hint *hint;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/SDL_log.c	Sat Feb 12 19:16:09 2011 -0800
@@ -0,0 +1,320 @@
+/*
+    SDL - 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 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
+*/
+#include "SDL_config.h"
+
+/* Simple log messages in SDL */
+
+#include "SDL_log.h"
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#if defined(__WIN32__)
+#include "core/windows/SDL_windows.h"
+#elif defined(__ANDROID__)
+#include <android/log.h>
+#endif
+
+#define DEFAULT_PRIORITY                SDL_LOG_PRIORITY_CRITICAL
+#define DEFAULT_APPLICATION_PRIORITY    SDL_LOG_PRIORITY_INFO
+
+typedef struct SDL_LogLevel
+{
+    int category;
+    SDL_LogPriority priority;
+    struct SDL_LogLevel *next;
+} SDL_LogLevel;
+
+/* The default log output function */
+static void SDL_LogOutput(void *userdata,
+                          int category, SDL_LogPriority priority,
+                          const char *message);
+
+static SDL_LogLevel *SDL_loglevels;
+static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
+static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
+static void *SDL_log_userdata = NULL;
+
+static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
+    NULL,
+    "VERBOSE",
+    "DEBUG",
+    "INFO",
+    "WARN",
+    "ERROR",
+    "CRITICAL"
+};
+
+#ifdef __ANDROID__
+static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = {
+    "APP",
+    "ERROR",
+    "SYSTEM",
+    "AUDIO",
+    "VIDEO",
+    "RENDER",
+    "INPUT"
+};
+
+static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
+    ANDROID_LOG_VERBOSE,
+    ANDROID_LOG_DEBUG,
+    ANDROID_LOG_INFO,
+    ANDROID_LOG_WARN,
+    ANDROID_LOG_ERROR,
+    ANDROID_LOG_FATAL
+};
+#endif /* __ANDROID__ */
+
+
+void
+SDL_LogSetAllPriority(SDL_LogPriority priority)
+{
+    SDL_LogLevel *entry;
+
+    for (entry = SDL_loglevels; entry; entry = entry->next) {
+        entry->priority = priority;
+    }
+    SDL_application_priority = SDL_default_priority = priority;
+}
+
+void
+SDL_LogSetPriority(int category, SDL_LogPriority priority)
+{
+    SDL_LogLevel *entry;
+
+    for (entry = SDL_loglevels; entry; entry = entry->next) {
+        if (entry->category == category) {
+            entry->priority = priority;
+            return;
+        }
+    }
+
+    /* Create a new entry */
+    entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry));
+    if (entry) {
+        entry->category = category;
+        entry->priority = priority;
+        entry->next = SDL_loglevels;
+        SDL_loglevels = entry;
+    }
+}
+
+SDL_LogPriority
+SDL_LogGetPriority(int category)
+{
+    SDL_LogLevel *entry;
+
+    for (entry = SDL_loglevels; entry; entry = entry->next) {
+        if (entry->category == category) {
+            return entry->priority;
+        }
+    }
+
+    if (category == SDL_LOG_CATEGORY_APPLICATION) {
+        return SDL_application_priority;
+    } else {
+        return SDL_default_priority;
+    }
+}
+
+void
+SDL_LogResetPriorities(void)
+{
+    SDL_LogLevel *entry;
+
+    while (SDL_loglevels) {
+        entry = SDL_loglevels;
+        SDL_loglevels = entry->next;
+        SDL_free(entry);
+    }
+
+    SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+    SDL_default_priority = DEFAULT_PRIORITY;
+}
+
+void
+SDL_Log(const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogVerbose(int category, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogInfo(int category, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogWarn(int category, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogError(int category, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogCritical(int category, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap);
+    va_end(ap);
+}
+
+void
+SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    SDL_LogMessageV(category, priority, fmt, ap);
+    va_end(ap);
+}
+
+#ifdef __ANDROID__
+static const char *
+GetCategoryPrefix(int category)
+{
+    if (category < SDL_LOG_CATEGORY_RESERVED1) {
+        return SDL_category_prefixes[category];
+    }
+    if (category < SDL_LOG_CATEGORY_CUSTOM) {
+        return "RESERVED";
+    }
+    return "CUSTOM";
+}
+#endif /* __ANDROID__ */
+
+void
+SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap)
+{
+    char *message;
+
+    /* Nothing to do if we don't have an output function */
+    if (!SDL_log_function) {
+        return;
+    }
+
+    /* Make sure we don't exceed array bounds */
+    if (priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) {
+        return;
+    }
+
+    /* See if we want to do anything with this message */
+    if (priority < SDL_LogGetPriority(category)) {
+        return;
+    }
+
+    message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+    if (!message) {
+        return;
+    }
+    SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap);
+    SDL_log_function(SDL_log_userdata, category, priority, message);
+    SDL_stack_free(message);
+}
+
+static void
+SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
+              const char *message)
+{
+#if defined(__WIN32__)
+    /* Way too many allocations here, urgh */
+    {
+        char *output;
+        size_t length;
+        LPTSTR tstr;
+
+        length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
+        output = SDL_stack_alloc(char, length);
+        SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
+        tstr = WIN_UTF8ToString(output);
+        OutputDebugString(tstr);
+        SDL_free(tstr);
+        SDL_stack_free(output);
+    }
+#elif defined(__ANDROID__)
+    {
+        char tag[32];
+
+        SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
+        __android_log_write(SDL_android_priority[priority], tag, message);
+    }
+#endif
+#if HAVE_STDIO_H
+    fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
+#endif
+}
+
+void
+SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
+{
+    if (callback) {
+        *callback = SDL_log_function;
+    }
+    if (userdata) {
+        *userdata = SDL_log_userdata;
+    }
+}
+
+void
+SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata)
+{
+    SDL_log_function = callback;
+    SDL_log_userdata = userdata;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/atomic/SDL_atomic.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/atomic/SDL_atomic.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
   SDL - Simple DirectMedia Layer
-  Copyright (C) 1997-2010 Sam Lantinga
+  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
--- a/src/atomic/SDL_spinlock.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/atomic/SDL_spinlock.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
   SDL - Simple DirectMedia Layer
-  Copyright (C) 1997-2010 Sam Lantinga
+  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
@@ -22,6 +22,7 @@
 #include "SDL_stdinc.h"
 
 #include "SDL_atomic.h"
+#include "SDL_mutex.h"
 #include "SDL_timer.h"
 
 /* Don't do the check for Visual Studio 2005, it's safe here */
@@ -33,7 +34,25 @@
 SDL_bool
 SDL_AtomicTryLock(SDL_SpinLock *lock)
 {
-#if defined(_MSC_VER)
+#if SDL_ATOMIC_DISABLED
+    /* Terrible terrible damage */
+    static SDL_mutex *_spinlock_mutex;
+
+    if (!_spinlock_mutex) {
+        /* Race condition on first lock... */
+        _spinlock_mutex = SDL_CreateMutex();
+    }
+    SDL_mutexP(_spinlock_mutex);
+    if (*lock == 0) {
+        *lock = 1;
+        SDL_mutexV(_spinlock_mutex);
+        return SDL_TRUE;
+    } else {
+        SDL_mutexV(_spinlock_mutex);
+        return SDL_FALSE;
+    }
+
+#elif defined(_MSC_VER)
     SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
     return (InterlockedExchange((long*)lock, 1) == 0);
 
--- a/src/audio/SDL_audio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audio_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audio_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audiocvt.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audiocvt.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audiodev.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audiodev.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audiodev_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audiodev_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audiomem.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audiomem.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_audiotypecvt.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_audiotypecvt.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,7 +1,7 @@
 /* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer_MMX.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer_MMX.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer_MMX_VC.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer_MMX_VC.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer_MMX_VC.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer_MMX_VC.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer_m68k.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer_m68k.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_mixer_m68k.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_mixer_m68k.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_sysaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_sysaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    Copyright (C) 1997-2011 Sam Lantinga
 
     This library is SDL_free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
--- a/src/audio/SDL_wave.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_wave.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/SDL_wave.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/SDL_wave.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    Copyright (C) 1997-2011 Sam Lantinga
 
     This library is SDL_free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
--- a/src/audio/alsa/SDL_alsa_audio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/alsa/SDL_alsa_audio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/alsa/SDL_alsa_audio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/alsa/SDL_alsa_audio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/android/SDL_androidaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/android/SDL_androidaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/android/SDL_androidaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/android/SDL_androidaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/arts/SDL_artsaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/arts/SDL_artsaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/arts/SDL_artsaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/arts/SDL_artsaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/baudio/SDL_beaudio.cc	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/baudio/SDL_beaudio.cc	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
--- a/src/audio/baudio/SDL_beaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/baudio/SDL_beaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/bsd/SDL_bsdaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/bsd/SDL_bsdaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/bsd/SDL_bsdaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/bsd/SDL_bsdaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/disk/SDL_diskaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/disk/SDL_diskaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/disk/SDL_diskaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/disk/SDL_diskaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dma/SDL_dmaaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dma/SDL_dmaaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dma/SDL_dmaaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dma/SDL_dmaaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dmedia/SDL_irixaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dmedia/SDL_irixaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dmedia/SDL_irixaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dmedia/SDL_irixaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dsp/SDL_dspaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dsp/SDL_dspaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dsp/SDL_dspaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dsp/SDL_dspaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dummy/SDL_dummyaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dummy/SDL_dummyaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/dummy/SDL_dummyaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/dummy/SDL_dummyaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/esd/SDL_esdaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/esd/SDL_esdaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/esd/SDL_esdaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/esd/SDL_esdaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/fusionsound/SDL_fsaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/fusionsound/SDL_fsaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/fusionsound/SDL_fsaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/fusionsound/SDL_fsaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/iphoneos/SDL_coreaudio_iphone.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/iphoneos/SDL_coreaudio_iphone.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/iphoneos/SDL_coreaudio_iphone.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/iphoneos/SDL_coreaudio_iphone.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/macosx/SDL_coreaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/macosx/SDL_coreaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/macosx/SDL_coreaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/macosx/SDL_coreaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/mme/SDL_mmeaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/mme/SDL_mmeaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/mme/SDL_mmeaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/mme/SDL_mmeaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/nas/SDL_nasaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/nas/SDL_nasaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/nas/SDL_nasaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/nas/SDL_nasaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/nds/SDL_ndsaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/nds/SDL_ndsaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -57,11 +57,13 @@
         }
     }
 
+#if 0
     /* set the generic sound parameters */
     setGenericSound(22050,      /* sample rate */
                     127,        /* volume */
                     64,         /* panning/balance */
                     0);         /* sound format */
+#endif
 
     return 1;
 }
@@ -69,13 +71,9 @@
 static void
 NDSAUD_PlayDevice(_THIS)
 {
-    TransferSoundData *sound = SDL_malloc(sizeof(TransferSoundData));
-    if (!sound) {
-        SDL_OutOfMemory();
-    }
+#if 0
+    playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
 
-    playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
-#if 0
 //    sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
 //    sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
 //    sound->rate = 22050; /* sample rate = 22050Hz */
--- a/src/audio/nds/SDL_ndsaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/nds/SDL_ndsaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -32,7 +32,6 @@
 
 struct SDL_PrivateAudioData
 {
-    TransferSoundData *sound;
     /* The file descriptor for the audio device */
     Uint8 *mixbuf;
     Uint32 mixlen;
--- a/src/audio/paudio/SDL_paudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/paudio/SDL_paudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/paudio/SDL_paudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/paudio/SDL_paudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/pulseaudio/SDL_pulseaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/pulseaudio/SDL_pulseaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/pulseaudio/SDL_pulseaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/qsa/SDL_qsa_audio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/qsa/SDL_qsa_audio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/qsa/SDL_qsa_audio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/qsa/SDL_qsa_audio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/sdlgenaudiocvt.pl	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/sdlgenaudiocvt.pl	Sat Feb 12 19:16:09 2011 -0800
@@ -38,7 +38,7 @@
 /* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/sun/SDL_sunaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/sun/SDL_sunaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -5,7 +5,7 @@
 
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/sun/SDL_sunaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/sun/SDL_sunaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/ums/SDL_umsaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/ums/SDL_umsaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -5,7 +5,7 @@
 
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/ums/SDL_umsaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/ums/SDL_umsaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/windib/SDL_dibaudio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/windib/SDL_dibaudio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/windib/SDL_dibaudio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/windib/SDL_dibaudio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/windx5/SDL_dx5audio.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/windx5/SDL_dx5audio.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/audio/windx5/SDL_dx5audio.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/audio/windx5/SDL_dx5audio.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/core/android/SDL_android.cpp	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/core/android/SDL_android.cpp	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -20,6 +20,7 @@
     slouken@libsdl.org
 */
 #include "SDL_config.h"
+#include "SDL_stdinc.h"
 
 #include "SDL_android.h"
 
@@ -80,7 +81,7 @@
     mActivityClass = cls;
 
     midCreateGLContext = mEnv->GetStaticMethodID(mActivityClass,
-                                "createGLContext","()V");
+                                "createGLContext","(II)Z");
     midFlipBuffers = mEnv->GetStaticMethodID(mActivityClass,
                                 "flipBuffers","()V");
     midAudioInit = mEnv->GetStaticMethodID(mActivityClass, 
@@ -159,9 +160,13 @@
 /*******************************************************************************
              Functions called by SDL into Java
 *******************************************************************************/
-extern "C" void Android_JNI_CreateContext()
+extern "C" SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion)
 {
-    mEnv->CallStaticVoidMethod(mActivityClass, midCreateGLContext); 
+    if (mEnv->CallStaticBooleanMethod(mActivityClass, midCreateGLContext, majorVersion, minorVersion)) {
+        return SDL_TRUE;
+    } else {
+        return SDL_FALSE;
+    }
 }
 
 extern "C" void Android_JNI_SwapWindow()
--- a/src/core/android/SDL_android.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/core/android/SDL_android.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -29,7 +29,7 @@
 #endif
 
 /* Interface from the SDL library into the Android Java activity */
-extern void Android_JNI_CreateContext();
+extern SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion);
 extern void Android_JNI_SwapWindow();
 extern void Android_JNI_SetActivityTitle(const char *title);
 extern void Android_JNI_GetAccelerometerValues(float values[3]);
--- a/src/core/windows/SDL_windows.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/core/windows/SDL_windows.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/core/windows/SDL_windows.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/core/windows/SDL_windows.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/cpuinfo/SDL_cpuinfo.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/cpuinfo/SDL_cpuinfo.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -32,36 +32,18 @@
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
-#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
-#include <sys/sysctl.h>         /* For AltiVec check */
-#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
-#include <signal.h>
-#include <setjmp.h>
-#endif
 #ifdef __WIN32__
 #include "../core/windows/SDL_windows.h"
 #endif
 
 #define CPU_HAS_RDTSC   0x00000001
 #define CPU_HAS_MMX     0x00000002
-#define CPU_HAS_MMXEXT  0x00000004
-#define CPU_HAS_3DNOW   0x00000010
-#define CPU_HAS_3DNOWEXT 0x00000020
-#define CPU_HAS_SSE     0x00000040
-#define CPU_HAS_SSE2    0x00000080
-#define CPU_HAS_ALTIVEC 0x00000100
+#define CPU_HAS_SSE     0x00000010
+#define CPU_HAS_SSE2    0x00000020
+#define CPU_HAS_SSE3    0x00000040
+#define CPU_HAS_SSE41   0x00000080
+#define CPU_HAS_SSE42   0x00000100
 
-#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__
-/* This is the brute force way of detecting instruction sets...
-   the idea is borrowed from the libmpeg2 library - thanks!
- */
-static jmp_buf jmpbuf;
-static void
-illegal_instruction(int sig)
-{
-    longjmp(jmpbuf, 1);
-}
-#endif /* HAVE_SETJMP */
 
 static __inline__ int
 CPU_haveCPUID(void)
@@ -202,20 +184,6 @@
 }
 
 static __inline__ int
-CPU_getCPUIDFeaturesExt(void)
-{
-    int features = 0;
-    int a, b, c, d;
-
-    cpuid(0x80000000, a, b, c, d);
-    if (a >= 0x80000001) {
-        cpuid(0x80000001, a, b, c, d);
-        features = d;
-    }
-    return features;
-}
-
-static __inline__ int
 CPU_haveRDTSC(void)
 {
     if (CPU_haveCPUID()) {
@@ -234,33 +202,6 @@
 }
 
 static __inline__ int
-CPU_haveMMXExt(void)
-{
-    if (CPU_haveCPUID()) {
-        return (CPU_getCPUIDFeaturesExt() & 0x00400000);
-    }
-    return 0;
-}
-
-static __inline__ int
-CPU_have3DNow(void)
-{
-    if (CPU_haveCPUID()) {
-        return (CPU_getCPUIDFeaturesExt() & 0x80000000);
-    }
-    return 0;
-}
-
-static __inline__ int
-CPU_have3DNowExt(void)
-{
-    if (CPU_haveCPUID()) {
-        return (CPU_getCPUIDFeaturesExt() & 0x40000000);
-    }
-    return 0;
-}
-
-static __inline__ int
 CPU_haveSSE(void)
 {
     if (CPU_haveCPUID()) {
@@ -279,26 +220,48 @@
 }
 
 static __inline__ int
-CPU_haveAltiVec(void)
+CPU_haveSSE3(void)
+{
+    if (CPU_haveCPUID()) {
+        int a, b, c, d;
+
+        cpuid(0, a, b, c, d);
+        if (a >= 1) {
+            cpuid(1, a, b, c, d);
+            return (c & 0x00000001);
+        }
+    }
+    return 0;
+}
+
+static __inline__ int
+CPU_haveSSE41(void)
 {
-    volatile int altivec = 0;
-#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
-    int selectors[2] = { CTL_HW, HW_VECTORUNIT };
-    int hasVectorUnit = 0;
-    size_t length = sizeof(hasVectorUnit);
-    int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
-    if (0 == error)
-        altivec = (hasVectorUnit != 0);
-#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
-    void (*handler) (int sig);
-    handler = signal(SIGILL, illegal_instruction);
-    if (setjmp(jmpbuf) == 0) {
-        asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
-        altivec = 1;
+    if (CPU_haveCPUID()) {
+        int a, b, c, d;
+
+        cpuid(1, a, b, c, d);
+        if (a >= 1) {
+            cpuid(1, a, b, c, d);
+            return (c & 0x00080000);
+        }
     }
-    signal(SIGILL, handler);
-#endif
-    return altivec;
+    return 0;
+}
+
+static __inline__ int
+CPU_haveSSE42(void)
+{
+    if (CPU_haveCPUID()) {
+        int a, b, c, d;
+
+        cpuid(1, a, b, c, d);
+        if (a >= 1) {
+            cpuid(1, a, b, c, d);
+            return (c & 0x00100000);
+        }
+    }
+    return 0;
 }
 
 static int SDL_CPUCount = 0;
@@ -471,23 +434,20 @@
         if (CPU_haveMMX()) {
             SDL_CPUFeatures |= CPU_HAS_MMX;
         }
-        if (CPU_haveMMXExt()) {
-            SDL_CPUFeatures |= CPU_HAS_MMXEXT;
-        }
-        if (CPU_have3DNow()) {
-            SDL_CPUFeatures |= CPU_HAS_3DNOW;
-        }
-        if (CPU_have3DNowExt()) {
-            SDL_CPUFeatures |= CPU_HAS_3DNOWEXT;
-        }
         if (CPU_haveSSE()) {
             SDL_CPUFeatures |= CPU_HAS_SSE;
         }
         if (CPU_haveSSE2()) {
             SDL_CPUFeatures |= CPU_HAS_SSE2;
         }
-        if (CPU_haveAltiVec()) {
-            SDL_CPUFeatures |= CPU_HAS_ALTIVEC;
+        if (CPU_haveSSE3()) {
+            SDL_CPUFeatures |= CPU_HAS_SSE3;
+        }
+        if (CPU_haveSSE41()) {
+            SDL_CPUFeatures |= CPU_HAS_SSE41;
+        }
+        if (CPU_haveSSE42()) {
+            SDL_CPUFeatures |= CPU_HAS_SSE42;
         }
     }
     return SDL_CPUFeatures;
@@ -512,33 +472,6 @@
 }
 
 SDL_bool
-SDL_HasMMXExt(void)
-{
-    if (SDL_GetCPUFeatures() & CPU_HAS_MMXEXT) {
-        return SDL_TRUE;
-    }
-    return SDL_FALSE;
-}
-
-SDL_bool
-SDL_Has3DNow(void)
-{
-    if (SDL_GetCPUFeatures() & CPU_HAS_3DNOW) {
-        return SDL_TRUE;
-    }
-    return SDL_FALSE;
-}
-
-SDL_bool
-SDL_Has3DNowExt(void)
-{
-    if (SDL_GetCPUFeatures() & CPU_HAS_3DNOWEXT) {
-        return SDL_TRUE;
-    }
-    return SDL_FALSE;
-}
-
-SDL_bool
 SDL_HasSSE(void)
 {
     if (SDL_GetCPUFeatures() & CPU_HAS_SSE) {
@@ -557,9 +490,27 @@
 }
 
 SDL_bool
-SDL_HasAltiVec(void)
+SDL_HasSSE3(void)
+{
+    if (SDL_GetCPUFeatures() & CPU_HAS_SSE3) {
+        return SDL_TRUE;
+    }
+    return SDL_FALSE;
+}
+
+SDL_bool
+SDL_HasSSE41(void)
 {
-    if (SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC) {
+    if (SDL_GetCPUFeatures() & CPU_HAS_SSE41) {
+        return SDL_TRUE;
+    }
+    return SDL_FALSE;
+}
+
+SDL_bool
+SDL_HasSSE42(void)
+{
+    if (SDL_GetCPUFeatures() & CPU_HAS_SSE42) {
         return SDL_TRUE;
     }
     return SDL_FALSE;
@@ -578,12 +529,11 @@
     printf("CacheLine size: %d\n", SDL_GetCPUCacheLineSize());
     printf("RDTSC: %d\n", SDL_HasRDTSC());
     printf("MMX: %d\n", SDL_HasMMX());
-    printf("MMXExt: %d\n", SDL_HasMMXExt());
-    printf("3DNow: %d\n", SDL_Has3DNow());
-    printf("3DNowExt: %d\n", SDL_Has3DNowExt());
     printf("SSE: %d\n", SDL_HasSSE());
     printf("SSE2: %d\n", SDL_HasSSE2());
-    printf("AltiVec: %d\n", SDL_HasAltiVec());
+    printf("SSE3: %d\n", SDL_HasSSE3());
+    printf("SSE4.1: %d\n", SDL_HasSSE41());
+    printf("SSE4.2: %d\n", SDL_HasSSE42());
     return 0;
 }
 
--- a/src/events/SDL_clipboardevents.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_clipboardevents.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_clipboardevents_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_clipboardevents_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_events.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_events.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_events_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_events_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_gesture.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_gesture.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_gesture_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_gesture_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_keyboard.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_keyboard.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -39,12 +39,12 @@
     SDL_Window *focus;
     Uint16 modstate;
     Uint8 keystate[SDL_NUM_SCANCODES];
-    SDLKey keymap[SDL_NUM_SCANCODES];
+    SDL_Keycode keymap[SDL_NUM_SCANCODES];
 };
 
 static SDL_Keyboard SDL_keyboard;
 
-static const SDLKey SDL_default_keymap[SDL_NUM_SCANCODES] = {
+static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
     0, 0, 0, 0,
     'a',
     'b',
@@ -562,7 +562,7 @@
 SDL_ResetKeyboard(void)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
-    SDL_ScanCode scancode;
+    SDL_Scancode scancode;
 
     for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
         if (keyboard->keystate[scancode] == SDL_PRESSED) {
@@ -572,13 +572,13 @@
 }
 
 void
-SDL_GetDefaultKeymap(SDLKey * keymap)
+SDL_GetDefaultKeymap(SDL_Keycode * keymap)
 {
     SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
 }
 
 void
-SDL_SetKeymap(int start, SDLKey * keys, int length)
+SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
 
@@ -590,7 +590,7 @@
 }
 
 void
-SDL_SetScancodeName(SDL_ScanCode scancode, const char *name)
+SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
 {
     SDL_scancode_names[scancode] = name;
 }
@@ -638,7 +638,7 @@
 }
 
 int
-SDL_SendKeyboardKey(Uint8 state, SDL_ScanCode scancode)
+SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
     int posted;
@@ -832,7 +832,7 @@
     return keyboard->keystate;
 }
 
-SDLMod
+SDL_Keymod
 SDL_GetModState(void)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -841,26 +841,26 @@
 }
 
 void
-SDL_SetModState(SDLMod modstate)
+SDL_SetModState(SDL_Keymod modstate)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
 
     keyboard->modstate = modstate;
 }
 
-SDLKey
-SDL_GetKeyFromScancode(SDL_ScanCode scancode)
+SDL_Keycode
+SDL_GetKeyFromScancode(SDL_Scancode scancode)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
 
     return keyboard->keymap[scancode];
 }
 
-SDL_ScanCode
-SDL_GetScancodeFromKey(SDLKey key)
+SDL_Scancode
+SDL_GetScancodeFromKey(SDL_Keycode key)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
-    SDL_ScanCode scancode;
+    SDL_Scancode scancode;
 
     for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
          ++scancode) {
@@ -872,7 +872,7 @@
 }
 
 const char *
-SDL_GetScancodeName(SDL_ScanCode scancode)
+SDL_GetScancodeName(SDL_Scancode scancode)
 {
     const char *name = SDL_scancode_names[scancode];
 
@@ -883,14 +883,14 @@
 }
 
 const char *
-SDL_GetKeyName(SDLKey key)
+SDL_GetKeyName(SDL_Keycode key)
 {
     static char name[8];
     char *end;
 
     if (key & SDLK_SCANCODE_MASK) {
         return
-            SDL_GetScancodeName((SDL_ScanCode) (key & ~SDLK_SCANCODE_MASK));
+            SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
     }
 
     switch (key) {
--- a/src/events/SDL_keyboard_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_keyboard_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -34,22 +34,22 @@
 extern void SDL_ResetKeyboard(void);
 
 /* Get the default keymap */
-extern void SDL_GetDefaultKeymap(SDLKey * keymap);
+extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap);
 
 /* Set the mapping of scancode to key codes */
-extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
+extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length);
 
 /* Set a platform-dependent key name, overriding the default platform-agnostic
    name. Encoded as UTF-8. The string is not copied, thus the pointer given to
    this function must stay valid forever (or at least until the call to
    VideoQuit()). */
-extern void SDL_SetScancodeName(SDL_ScanCode scancode, const char *name);
+extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
 
 /* Set the keyboard focus window */
 extern void SDL_SetKeyboardFocus(SDL_Window * window);
 
 /* Send a keyboard key event */
-extern int SDL_SendKeyboardKey(Uint8 state, SDL_ScanCode scancode);
+extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
 
 /* Send keyboard text input */
 extern int SDL_SendKeyboardText(const char *text);
--- a/src/events/SDL_mouse.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_mouse.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_mouse_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_mouse_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_quit.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_quit.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_sysevents.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_sysevents.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    Copyright (C) 1997-2011 Sam Lantinga
 
     This library is SDL_free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
--- a/src/events/SDL_touch.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_touch.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_touch_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_touch_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/SDL_windowevents.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_windowevents.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -82,15 +82,10 @@
         SDL_OnWindowHidden(window);
         break;
     case SDL_WINDOWEVENT_MOVED:
-        if (window->flags & SDL_WINDOW_FULLSCREEN) {
+        if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
+            SDL_WINDOWPOS_ISUNDEFINED(data2)) {
             return 0;
         }
-        if (data1 == SDL_WINDOWPOS_UNDEFINED) {
-            data1 = window->x;
-        }
-        if (data2 == SDL_WINDOWPOS_UNDEFINED) {
-            data2 = window->y;
-        }
         if (data1 == window->x && data2 == window->y) {
             return 0;
         }
@@ -98,9 +93,6 @@
         window->y = data2;
         break;
     case SDL_WINDOWEVENT_RESIZED:
-        if (window->flags & SDL_WINDOW_FULLSCREEN) {
-            return 0;
-        }
         if (data1 == window->w && data2 == window->h) {
             return 0;
         }
--- a/src/events/SDL_windowevents_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/SDL_windowevents_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/blank_cursor.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/blank_cursor.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/events/default_cursor.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/default_cursor.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/events/nds/SDL_ndsgesture.c	Sat Feb 12 19:16:09 2011 -0800
@@ -0,0 +1,41 @@
+/*
+    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    Founation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#include "SDL_config.h"
+
+/* No supported under the NDS because of math operations. */
+
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "SDL_gesture_c.h"
+
+int SDL_GestureAddTouch(SDL_Touch* touch)
+{  
+	return 0;
+}
+
+void SDL_GestureProcessEvent(SDL_Event* event)
+{
+	return;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+  
--- a/src/events/scancodes_darwin.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/scancodes_darwin.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -27,7 +27,7 @@
    - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
 */
 /* *INDENT-OFF* */
-static const SDL_ScanCode darwin_scancode_table[] = {
+static const SDL_Scancode darwin_scancode_table[] = {
     /*   0 */   SDL_SCANCODE_A,
     /*   1 */   SDL_SCANCODE_S,
     /*   2 */   SDL_SCANCODE_D,
--- a/src/events/scancodes_linux.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/scancodes_linux.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,12 +21,12 @@
 */
 #include "../../include/SDL_scancode.h"
 
-/* Linux virtual key code to SDLKey mapping table
+/* Linux virtual key code to SDL_Keycode mapping table
    Sources:
    - Linux kernel source input.h
 */
 /* *INDENT-OFF* */
-static SDL_ScanCode const linux_scancode_table[] = {
+static SDL_Scancode const linux_scancode_table[] = {
     /*  0 */    SDL_SCANCODE_UNKNOWN,
     /*  1 */    SDL_SCANCODE_ESCAPE,
     /*  2 */    SDL_SCANCODE_1,
--- a/src/events/scancodes_windows.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/scancodes_windows.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -26,7 +26,7 @@
    - msdn.microsoft.com
 */
 /* *INDENT-OFF* */
-static const SDL_ScanCode windows_scancode_table[] = {
+static const SDL_Scancode windows_scancode_table[] = {
     /*  0, 0x00 */      SDL_SCANCODE_UNKNOWN,
     /*  1, 0x01 */      SDL_SCANCODE_UNKNOWN,
     /*  2, 0x02 */      SDL_SCANCODE_UNKNOWN,
--- a/src/events/scancodes_xfree86.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/events/scancodes_xfree86.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -26,7 +26,7 @@
    - atKeyNames.h from XFree86 source code
 */
 /* *INDENT-OFF* */
-static const SDL_ScanCode xfree86_scancode_table[] = {
+static const SDL_Scancode xfree86_scancode_table[] = {
     /*  0 */    SDL_SCANCODE_UNKNOWN,
     /*  1 */    SDL_SCANCODE_ESCAPE,
     /*  2 */    SDL_SCANCODE_1,
@@ -177,7 +177,7 @@
 };
 
 /* for wireless usb keyboard (manufacturer TRUST) without numpad. */
-static const SDL_ScanCode xfree86_scancode_table2[] = {
+static const SDL_Scancode xfree86_scancode_table2[] = {
     /*  0 */    SDL_SCANCODE_UNKNOWN,
     /*  1 */    SDL_SCANCODE_ESCAPE,
     /*  2 */    SDL_SCANCODE_1,
--- a/src/file/SDL_rwops.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/file/SDL_rwops.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/haptic/SDL_haptic_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/haptic/SDL_haptic_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/haptic/nds/SDL_syshaptic.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/haptic/nds/SDL_syshaptic.c	Sat Feb 12 19:16:09 2011 -0800
@@ -26,21 +26,21 @@
 #include "SDL_haptic.h"
 #include "../SDL_syshaptic.h"
 #include "SDL_joystick.h"
+#include <nds/memory.h>
 #include <nds/arm9/rumble.h>
-#include <nds/memory.h>
 
 #define MAX_HAPTICS  1
 /* right now only the ezf3in1 (and maybe official rumble pak) are supported
    and there can only be one of those in at a time (in GBA slot.) */
 
-SDL_Haptic *nds_haptic = NULL;
+static SDL_Haptic *nds_haptic = NULL;
 
-typedef struct
+struct haptic_hwdata
 {
     enum
     { NONE, OFFICIAL, EZF3IN1 } type;
     int pos;
-} NDS_HapticData;
+};
 
 
 void
@@ -165,7 +165,7 @@
         return -1;
     }
 
-    haptic->hwdata = SDL_malloc(sizeof(NDS_HapticData));
+    haptic->hwdata = SDL_malloc(sizeof(struct haptic_hwdata));
     if (!haptic->hwdata) {
         SDL_OutOfMemory();
         return -1;
--- a/src/joystick/SDL_joystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/SDL_joystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/SDL_joystick_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/SDL_joystick_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/SDL_sysjoystick.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/SDL_sysjoystick.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    Copyright (C) 1997-2011 Sam Lantinga
 
     This library is SDL_free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
--- a/src/joystick/android/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/android/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/beos/SDL_bejoystick.cc	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/beos/SDL_bejoystick.cc	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
--- a/src/joystick/bsd/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/darwin/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/darwin/SDL_sysjoystick_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/darwin/SDL_sysjoystick_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/dummy/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/dummy/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/iphoneos/SDLUIAccelerationDelegate.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/iphoneos/SDLUIAccelerationDelegate.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/iphoneos/SDLUIAccelerationDelegate.m	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/iphoneos/SDLUIAccelerationDelegate.m	Sat Feb 12 19:16:09 2011 -0800
@@ -1,24 +1,24 @@
 /*
- 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
- */
+    SDL - 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 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
+*/
 
 #import "SDLUIAccelerationDelegate.h"
 /* needed for SDL_IPHONE_MAX_GFORCE macro */
--- a/src/joystick/iphoneos/SDL_sysjoystick.m	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
--- a/src/joystick/linux/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/linux/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/linux/SDL_sysjoystick_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/linux/SDL_sysjoystick_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/nds/SDL_sysjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/nds/SDL_sysjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/windows/SDL_dxjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/windows/SDL_dxjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/windows/SDL_dxjoystick_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/windows/SDL_dxjoystick_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/joystick/windows/SDL_mmjoystick.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/joystick/windows/SDL_mmjoystick.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/libm/math.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/libm/math.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/loadso/beos/SDL_sysloadso.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/loadso/beos/SDL_sysloadso.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/loadso/dlopen/SDL_sysloadso.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/loadso/dlopen/SDL_sysloadso.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/loadso/dummy/SDL_sysloadso.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/loadso/dummy/SDL_sysloadso.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/loadso/macosx/SDL_dlcompat.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/loadso/macosx/SDL_dlcompat.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/loadso/windows/SDL_sysloadso.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/loadso/windows/SDL_sysloadso.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/main/beos/SDL_BeApp.cc	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/main/beos/SDL_BeApp.cc	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    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
--- a/src/main/beos/SDL_BeApp.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/main/beos/SDL_BeApp.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/SDL_power.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/SDL_power.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/beos/SDL_syspower.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/beos/SDL_syspower.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/linux/SDL_syspower.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/linux/SDL_syspower.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/macosx/SDL_syspower.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/macosx/SDL_syspower.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/nds/SDL_syspower.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/nds/SDL_syspower.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/uikit/SDL_syspower.m	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/uikit/SDL_syspower.m	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/power/windows/SDL_syspower.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/power/windows/SDL_syspower.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/SDL_render.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/SDL_render.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -24,6 +24,7 @@
 /* The SDL 2D rendering system */
 
 #include "SDL_hints.h"
+#include "SDL_log.h"
 #include "SDL_render.h"
 #include "SDL_sysrender.h"
 #include "../video/SDL_pixels_c.h"
@@ -44,6 +45,7 @@
 
 
 static const SDL_RenderDriver *render_drivers[] = {
+#if !SDL_RENDER_DISABLED
 #if SDL_VIDEO_RENDER_D3D
     &D3D_RenderDriver,
 #endif
@@ -59,7 +61,11 @@
 #if SDL_VIDEO_RENDER_DIRECTFB
     &DirectFB_RenderDriver,
 #endif
+#if SDL_VIDEO_RENDER_NDS
+	&NDS_RenderDriver,
+#endif
     &SW_RenderDriver
+#endif /* !SDL_RENDER_DISABLED */
 };
 static char renderer_magic;
 static char texture_magic;
@@ -159,6 +165,9 @@
         renderer->window = window;
 
         SDL_AddEventWatch(SDL_RendererEventWatch, renderer);
+
+        SDL_LogInfo(SDL_LOG_CATEGORY_RENDER,
+                    "Created renderer: %s", renderer->info.name);
     }
     return renderer;
 }
@@ -166,7 +175,12 @@
 SDL_Renderer *
 SDL_CreateSoftwareRenderer(SDL_Surface * surface)
 {
+#if !SDL_RENDER_DISABLED
     return SW_CreateRendererForSurface(surface);
+#else
+    SDL_SetError("SDL not built with rendering support");
+    return NULL;
+#endif /* !SDL_RENDER_DISABLED */
 }
 
 int
@@ -195,12 +209,22 @@
 GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
 {
     Uint32 i;
-    SDL_bool hasAlpha = SDL_ISPIXELFORMAT_ALPHA(format);
 
-    /* We just want to match the first format that has the same channels */
-    for (i = 0; i < renderer->info.num_texture_formats; ++i) {
-        if (SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == hasAlpha) {
-            return renderer->info.texture_formats[i];
+    if (SDL_ISPIXELFORMAT_FOURCC(format)) {
+        /* Look for an exact match */
+        for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+            if (renderer->info.texture_formats[i] == format) {
+                return renderer->info.texture_formats[i];
+            }
+        }
+    } else {
+        SDL_bool hasAlpha = SDL_ISPIXELFORMAT_ALPHA(format);
+
+        /* We just want to match the first format that has the same channels */
+        for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+            if (SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == hasAlpha) {
+                return renderer->info.texture_formats[i];
+            }
         }
     }
     return renderer->info.texture_formats[0];
@@ -302,7 +326,8 @@
     }
     format = renderer->info.texture_formats[0];
     for (i = 0; i < renderer->info.num_texture_formats; ++i) {
-        if (SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
+        if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
+            SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
             format = renderer->info.texture_formats[i];
             break;
         }
@@ -721,6 +746,14 @@
     }
 }
 
+void
+SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+    CHECK_RENDERER_MAGIC(renderer, );
+
+    renderer->SetClipRect(renderer, rect);
+}
+
 int
 SDL_SetRenderDrawColor(SDL_Renderer * renderer,
                        Uint8 r, Uint8 g, Uint8 b, Uint8 a)
--- a/src/render/SDL_sysrender.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/SDL_sysrender.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -78,6 +78,7 @@
     int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
                         const SDL_Rect * rect, void **pixels, int *pitch);
     void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+    void (*SetClipRect) (SDL_Renderer * renderer, const SDL_Rect *rect);
     int (*RenderClear) (SDL_Renderer * renderer);
     int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
                              int count);
@@ -118,6 +119,8 @@
     SDL_RendererInfo info;
 };
 
+#if !SDL_RENDER_DISABLED
+
 #if SDL_VIDEO_RENDER_D3D
 extern SDL_RenderDriver D3D_RenderDriver;
 #endif
@@ -133,8 +136,13 @@
 #if SDL_VIDEO_RENDER_DIRECTFB
 extern SDL_RenderDriver DirectFB_RenderDriver;
 #endif
+#ifdef SDL_VIDEO_RENDER_NDS
+extern SDL_RenderDriver NDS_RenderDriver;
+#endif
 extern SDL_RenderDriver SW_RenderDriver;
 
+#endif /* !SDL_RENDER_DISABLED */
+
 #endif /* _SDL_sysrender_h */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/SDL_yuv_mmx.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/SDL_yuv_mmx.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/SDL_yuv_sw.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/SDL_yuv_sw.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -1127,7 +1127,8 @@
                 ("YV12 and IYUV textures only support full surface updates");
             return -1;
         }
-        SDL_memcpy(swdata->pixels, pixels, swdata->h * 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:
--- a/src/render/SDL_yuv_sw_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/SDL_yuv_sw_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/direct3d/SDL_render_d3d.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/direct3d/SDL_render_d3d.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,7 +21,8 @@
 */
 #include "SDL_config.h"
 
-#if SDL_VIDEO_RENDER_D3D
+#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
+
 
 #include "../../core/windows/SDL_windows.h"
 
@@ -96,6 +97,7 @@
 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 void D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
 static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
                                 const SDL_Point * points, int count);
 static int D3D_RenderDrawLines(SDL_Renderer * renderer,
@@ -308,6 +310,7 @@
     renderer->UpdateTexture = D3D_UpdateTexture;
     renderer->LockTexture = D3D_LockTexture;
     renderer->UnlockTexture = D3D_UnlockTexture;
+    renderer->SetClipRect = D3D_SetClipRect;
     renderer->RenderDrawPoints = D3D_RenderDrawPoints;
     renderer->RenderDrawLines = D3D_RenderDrawLines;
     renderer->RenderFillRects = D3D_RenderFillRects;
@@ -602,6 +605,27 @@
 }
 
 static void
+D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+    D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+
+    if (rect) {
+        RECT d3drect;
+
+        d3drect.left = rect->x;
+        d3drect.right = rect->x + rect->w;
+        d3drect.top = rect->y;
+        d3drect.bottom = rect->y + rect->h;
+        IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
+                                        TRUE);
+    } else {
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
+                                        FALSE);
+    }
+}
+
+static void
 D3D_SetBlendMode(D3D_RenderData * data, int blendMode)
 {
     switch (blendMode) {
@@ -1043,6 +1067,6 @@
     SDL_free(renderer);
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D */
+#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/opengl/SDL_glfuncs.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengl/SDL_glfuncs.h	Sat Feb 12 19:16:09 2011 -0800
@@ -337,8 +337,7 @@
                 (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
 SDL_PROC_UNUSED(void, glScaled, (GLdouble x, GLdouble y, GLdouble z))
 SDL_PROC_UNUSED(void, glScalef, (GLfloat x, GLfloat y, GLfloat z))
-SDL_PROC_UNUSED(void, glScissor,
-                (GLint x, GLint y, GLsizei width, GLsizei height))
+SDL_PROC(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
 SDL_PROC_UNUSED(void, glSelectBuffer, (GLsizei size, GLuint * buffer))
 SDL_PROC_UNUSED(void, glShadeModel, (GLenum mode))
 SDL_PROC_UNUSED(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
--- a/src/render/opengl/SDL_render_gl.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengl/SDL_render_gl.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,10 +21,13 @@
 */
 #include "SDL_config.h"
 
-#if SDL_VIDEO_RENDER_OGL
+#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
 
+#include "SDL_hints.h"
+#include "SDL_log.h"
 #include "SDL_opengl.h"
 #include "../SDL_sysrender.h"
+#include "SDL_shaders_gl.h"
 
 #ifdef __MACOSX__
 #include <OpenGL/OpenGL.h>
@@ -52,6 +55,7 @@
 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 void GL_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
 static int GL_RenderClear(SDL_Renderer * renderer);
 static int GL_RenderDrawPoints(SDL_Renderer * renderer,
                                const SDL_Point * points, int count);
@@ -93,6 +97,15 @@
 
     void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
                                  const GLvoid * pointer);
+
+    /* Multitexture support */
+    SDL_bool GL_ARB_multitexture_supported;
+    PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
+    int num_texture_units;
+
+    /* Shader support */
+    GL_ShaderContext *shaders;
+
 } GL_RenderData;
 
 typedef struct
@@ -105,6 +118,12 @@
     GLenum formattype;
     void *pixels;
     int pitch;
+    SDL_Rect locked_rect;
+
+    /* YV12 texture support */
+    SDL_bool yuv;
+    GLuint utexture;
+    GLuint vtexture;
 } GL_TextureData;
 
 
@@ -171,6 +190,7 @@
 {
     SDL_Renderer *renderer;
     GL_RenderData *data;
+    const char *hint;
     GLint value;
     Uint32 window_flags;
 
@@ -199,6 +219,7 @@
     renderer->UpdateTexture = GL_UpdateTexture;
     renderer->LockTexture = GL_LockTexture;
     renderer->UnlockTexture = GL_UnlockTexture;
+    renderer->SetClipRect = GL_SetClipRect;
     renderer->RenderClear = GL_RenderClear;
     renderer->RenderDrawPoints = GL_RenderDrawPoints;
     renderer->RenderDrawLines = GL_RenderDrawLines;
@@ -259,17 +280,35 @@
             SDL_GL_GetProcAddress("glTextureRangeAPPLE");
     }
 
+    /* Check for multitexture support */
+    if (SDL_GL_ExtensionSupported("GL_ARB_multitexture")) {
+        data->glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
+        if (data->glActiveTextureARB) {
+            data->GL_ARB_multitexture_supported = SDL_TRUE;
+            data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
+        }
+    }
+
+    /* Check for shader support */
+    hint = SDL_GetHint(SDL_HINT_RENDER_OPENGL_SHADERS);
+    if (!hint || *hint != '0') {
+        data->shaders = GL_CreateShaderContext();
+    }
+    SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
+                data->shaders ? "ENABLED" : "DISABLED");
+
+    /* We support YV12 textures using 3 textures and a shader */
+    if (data->shaders && data->num_texture_units >= 3) {
+        renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
+        renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
+    }
+
     /* Set up parameters for rendering */
     data->blendMode = -1;
     data->glDisable(GL_DEPTH_TEST);
     data->glDisable(GL_CULL_FACE);
     /* This ended up causing video discrepancies between OpenGL and Direct3D */
     /*data->glEnable(GL_LINE_SMOOTH);*/
-    if (data->GL_ARB_texture_rectangle_supported) {
-        data->glEnable(GL_TEXTURE_RECTANGLE_ARB);
-    } else {
-        data->glEnable(GL_TEXTURE_2D);
-    }
     data->updateSize = SDL_TRUE;
 
     return renderer;
@@ -337,6 +376,12 @@
         *format = GL_BGRA;
         *type = GL_UNSIGNED_INT_8_8_8_8_REV;
         break;
+    case SDL_PIXELFORMAT_YV12:
+    case SDL_PIXELFORMAT_IYUV:
+        *internalFormat = GL_LUMINANCE;
+        *format = GL_LUMINANCE;
+        *type = GL_UNSIGNED_BYTE;
+        break;
     default:
         return SDL_FALSE;
     }
@@ -369,8 +414,15 @@
     }
 
     if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+        size_t size;
         data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
-        data->pixels = SDL_malloc(texture->h * data->pitch);
+        size = texture->h * data->pitch;
+        if (texture->format == SDL_PIXELFORMAT_YV12 ||
+            texture->format == SDL_PIXELFORMAT_IYUV) {
+            /* Need to add size for the U and V planes */
+            size += (2 * (texture->h * data->pitch) / 4);
+        }
+        data->pixels = SDL_malloc(size);
         if (!data->pixels) {
             SDL_OutOfMemory();
             SDL_free(data);
@@ -443,16 +495,42 @@
         GL_SetError("glTexImage2D()", result);
         return -1;
     }
-    return 0;
-}
+
+    if (texture->format == SDL_PIXELFORMAT_YV12 ||
+        texture->format == SDL_PIXELFORMAT_IYUV) {
+        data->yuv = SDL_TRUE;
+
+        renderdata->glGenTextures(1, &data->utexture);
+        renderdata->glGenTextures(1, &data->vtexture);
+        renderdata->glEnable(data->type);
 
-static void
-SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
-                   int pitch)
-{
-    renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
-                              (pitch / SDL_BYTESPERPIXEL(texture->format)));
+        renderdata->glBindTexture(data->type, data->utexture);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
+                                    GL_LINEAR);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
+                                    GL_LINEAR);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+                                    GL_CLAMP_TO_EDGE);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+                                    GL_CLAMP_TO_EDGE);
+        renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2,
+                                 texture_h/2, 0, format, type, NULL);
+
+        renderdata->glBindTexture(data->type, data->vtexture);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
+                                    GL_LINEAR);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
+                                    GL_LINEAR);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+                                    GL_CLAMP_TO_EDGE);
+        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+                                    GL_CLAMP_TO_EDGE);
+        renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2,
+                                 texture_h/2, 0, format, type, NULL);
+
+        renderdata->glDisable(data->type);
+    }
+    return 0;
 }
 
 static int
@@ -466,12 +544,47 @@
     GL_ActivateRenderer(renderer);
 
     renderdata->glGetError();
-    SetupTextureUpdate(renderdata, texture, pitch);
+    renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
+                              (pitch / SDL_BYTESPERPIXEL(texture->format)));
     renderdata->glEnable(data->type);
     renderdata->glBindTexture(data->type, data->texture);
     renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
                                 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);
+        if (texture->format == SDL_PIXELFORMAT_YV12) {
+            renderdata->glBindTexture(data->type, data->vtexture);
+        } else {
+            renderdata->glBindTexture(data->type, data->utexture);
+        }
+        renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+                                    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);
+        if (texture->format == SDL_PIXELFORMAT_YV12) {
+            renderdata->glBindTexture(data->type, data->utexture);
+        } else {
+            renderdata->glBindTexture(data->type, data->vtexture);
+        }
+        renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+                                    rect->w/2, rect->h/2,
+                                    data->format, data->formattype, pixels);
+    }
     renderdata->glDisable(data->type);
     result = renderdata->glGetError();
     if (result != GL_NO_ERROR) {
@@ -487,7 +600,8 @@
 {
     GL_TextureData *data = (GL_TextureData *) texture->driverdata;
 
-    *pixels =
+    data->locked_rect = *rect;
+    *pixels = 
         (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
                   rect->x * SDL_BYTESPERPIXEL(texture->format));
     *pitch = data->pitch;
@@ -497,17 +611,33 @@
 static void
 GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
-    GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
     GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+    const SDL_Rect *rect;
+    void *pixels;
+
+    rect = &data->locked_rect;
+    pixels = 
+        (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
+                  rect->x * SDL_BYTESPERPIXEL(texture->format));
+    GL_UpdateTexture(renderer, texture, rect, pixels, data->pitch);
+}
+
+static void
+GL_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
 
     GL_ActivateRenderer(renderer);
 
-    SetupTextureUpdate(renderdata, texture, data->pitch);
-    renderdata->glEnable(data->type);
-    renderdata->glBindTexture(data->type, data->texture);
-    renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w, texture->h,
-                                data->format, data->formattype, data->pixels);
-    renderdata->glDisable(data->type);
+    if (rect) {
+        int w, h;
+
+        SDL_GetWindowSize(renderer->window, &w, &h);
+        data->glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h);
+        data->glEnable(GL_SCISSOR_TEST);
+    } else {
+        data->glDisable(GL_SCISSOR_TEST);
+    }
 }
 
 static void
@@ -566,6 +696,7 @@
     GL_ActivateRenderer(renderer);
 
     GL_SetBlendMode(data, renderer->blendMode);
+    GL_SelectShader(data->shaders, SHADER_SOLID);
 
     data->glColor4f((GLfloat) renderer->r * inv255f,
                     (GLfloat) renderer->g * inv255f,
@@ -591,6 +722,7 @@
     GL_ActivateRenderer(renderer);
 
     GL_SetBlendMode(data, renderer->blendMode);
+    GL_SelectShader(data->shaders, SHADER_SOLID);
 
     data->glColor4f((GLfloat) renderer->r * inv255f,
                     (GLfloat) renderer->g * inv255f,
@@ -661,6 +793,7 @@
     GL_ActivateRenderer(renderer);
 
     GL_SetBlendMode(data, renderer->blendMode);
+    GL_SelectShader(data->shaders, SHADER_SOLID);
 
     data->glColor4f((GLfloat) renderer->r * inv255f,
                     (GLfloat) renderer->g * inv255f,
@@ -702,6 +835,13 @@
     maxv *= texturedata->texh;
 
     data->glEnable(texturedata->type);
+    if (texturedata->yuv) {
+        data->glActiveTextureARB(GL_TEXTURE2_ARB);
+        data->glBindTexture(texturedata->type, texturedata->vtexture);
+        data->glActiveTextureARB(GL_TEXTURE1_ARB);
+        data->glBindTexture(texturedata->type, texturedata->utexture);
+        data->glActiveTextureARB(GL_TEXTURE0_ARB);
+    }
     data->glBindTexture(texturedata->type, texturedata->texture);
 
     if (texture->modMode) {
@@ -714,6 +854,11 @@
     }
 
     GL_SetBlendMode(data, texture->blendMode);
+    if (texturedata->yuv) {
+        GL_SelectShader(data->shaders, SHADER_YV12);
+    } else {
+        GL_SelectShader(data->shaders, SHADER_RGB);
+    }
 
     data->glBegin(GL_TRIANGLE_STRIP);
     data->glTexCoord2f(minu, minv);
@@ -799,6 +944,10 @@
     if (data->texture) {
         renderdata->glDeleteTextures(1, &data->texture);
     }
+    if (data->yuv) {
+        renderdata->glDeleteTextures(1, &data->utexture);
+        renderdata->glDeleteTextures(1, &data->vtexture);
+    }
     if (data->pixels) {
         SDL_free(data->pixels);
     }
@@ -821,6 +970,6 @@
     SDL_free(renderer);
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL */
+#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/render/opengl/SDL_shaders_gl.c	Sat Feb 12 19:16:09 2011 -0800
@@ -0,0 +1,371 @@
+/*
+    SDL - 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 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
+*/
+#include "SDL_config.h"
+
+#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
+
+#include "SDL_stdinc.h"
+#include "SDL_log.h"
+#include "SDL_opengl.h"
+#include "SDL_video.h"
+#include "SDL_shaders_gl.h"
+
+/* OpenGL shader implementation */
+
+/*#define DEBUG_SHADERS*/
+
+typedef struct
+{
+    GLenum program;
+    GLenum vert_shader;
+    GLenum frag_shader;
+} GL_ShaderData;
+
+struct GL_ShaderContext
+{
+    GLenum (*glGetError)(void);
+
+    PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
+    PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
+    PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
+    PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
+    PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
+    PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
+    PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
+    PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
+    PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
+    PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
+    PFNGLUNIFORM1IARBPROC glUniform1iARB;
+    PFNGLUNIFORM1FARBPROC glUniform1fARB;
+    PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
+
+    SDL_bool GL_ARB_texture_rectangle_supported;
+
+    GL_Shader current_shader;
+    GL_ShaderData shaders[NUM_SHADERS];
+};
+
+/*
+ * NOTE: Always use sampler2D, etc here. We'll #define them to the
+ *  texture_rectangle versions if we choose to use that extension.
+ */
+static const char *shader_source[NUM_SHADERS][2] =
+{
+    /* SHADER_NONE */
+    { NULL, NULL },
+
+    /* SHADER_SOLID */
+    {
+        /* vertex shader */
+"varying vec4 v_color;\n"
+"\n"
+"void main()\n"
+"{\n"
+"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+"    v_color = gl_Color;\n"
+"}",
+        /* fragment shader */
+"varying vec4 v_color;\n"
+"\n"
+"void main()\n"
+"{\n"
+"    gl_FragColor = v_color;\n"
+"}"
+    },
+
+    /* SHADER_RGB */
+    {
+        /* vertex shader */
+"varying vec4 v_color;\n"
+"varying vec2 v_texCoord;\n"
+"\n"
+"void main()\n"
+"{\n"
+"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+"    v_color = gl_Color;\n"
+"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
+"}",
+        /* fragment shader */
+"varying vec4 v_color;\n"
+"varying vec2 v_texCoord;\n"
+"uniform sampler2D tex0;\n"
+"\n"
+"void main()\n"
+"{\n"
+"    gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n"
+"}"
+    },
+
+    /* SHADER_YV12 */
+    {
+        /* vertex shader */
+"varying vec4 v_color;\n"
+"varying vec2 v_texCoord;\n"
+"\n"
+"void main()\n"
+"{\n"
+"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+"    v_color = gl_Color;\n"
+"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
+"}",
+        /* fragment shader */
+"varying vec4 v_color;\n"
+"varying vec2 v_texCoord;\n"
+"uniform sampler2D tex0; // Y \n"
+"uniform sampler2D tex1; // U \n"
+"uniform sampler2D tex2; // V \n"
+"\n"
+"// YUV offset \n"
+"const vec3 offset = vec3(-0.0625, -0.5, -0.5);\n"
+"\n"
+"// RGB coefficients \n"
+"const vec3 Rcoeff = vec3(1.164,  0.000,  1.596);\n"
+"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
+"const vec3 Bcoeff = vec3(1.164,  2.018,  0.000);\n"
+"\n"
+"void main()\n"
+"{\n"
+"    vec2 tcoord;\n"
+"    vec3 yuv, rgb;\n"
+"\n"
+"    // Get the Y value \n"
+"    tcoord = v_texCoord;\n"
+"    yuv.x = texture2D(tex0, tcoord).r;\n"
+"\n"
+"    // Get the U and V values \n"
+"    tcoord *= 0.5;\n"
+"    yuv.y = texture2D(tex1, tcoord).r;\n"
+"    yuv.z = texture2D(tex2, tcoord).r;\n"
+"\n"
+"    // Do the color transform \n"
+"    yuv += offset;\n"
+"    rgb.r = dot(yuv, Rcoeff);\n"
+"    rgb.g = dot(yuv, Gcoeff);\n"
+"    rgb.b = dot(yuv, Bcoeff);\n"
+"\n"
+"    // That was easy. :) \n"
+"    gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
+"}"
+    },
+};
+
+static SDL_bool
+CompileShader(GL_ShaderContext *ctx, GLenum shader, const char *defines, const char *source)
+{
+    GLint status;
+    const char *sources[2];
+
+    sources[0] = defines;
+    sources[1] = source;
+
+    ctx->glShaderSourceARB(shader, SDL_arraysize(sources), sources, NULL);
+    ctx->glCompileShaderARB(shader);
+    ctx->glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
+    if (status == 0) {
+        GLint length;
+        char *info;
+
+        ctx->glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
+        info = SDL_stack_alloc(char, length+1);
+        ctx->glGetInfoLogARB(shader, length, NULL, info);
+        SDL_LogError(SDL_LOG_CATEGORY_RENDER,
+            "Failed to compile shader:\n%s%s\n%s", defines, source, info);
+#ifdef DEBUG_SHADERS
+        fprintf(stderr,
+            "Failed to compile shader:\n%s%s\n%s", defines, source, info);
+#endif
+        SDL_stack_free(info);
+
+        return SDL_FALSE;
+    } else {
+        return SDL_TRUE;
+    }
+}
+
+static SDL_bool
+CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
+{
+    const int num_tmus_bound = 4;
+    const char *vert_defines = "";
+    const char *frag_defines = "";
+    int i;
+    GLint location;
+
+    if (index == SHADER_NONE) {
+        return SDL_TRUE;
+    }
+
+    ctx->glGetError();
+
+    /* Make sure we use the correct sampler type for our texture type */
+    if (ctx->GL_ARB_texture_rectangle_supported) {
+        frag_defines = 
+"#define sampler2D sampler2DRect\n"
+"#define texture2D texture2DRect\n";
+    }
+
+    /* Create one program object to rule them all */
+    data->program = ctx->glCreateProgramObjectARB();
+
+    /* Create the vertex shader */
+    data->vert_shader = ctx->glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
+    if (!CompileShader(ctx, data->vert_shader, vert_defines, shader_source[index][0])) {
+        return SDL_FALSE;
+    }
+
+    /* Create the fragment shader */
+    data->frag_shader = ctx->glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
+    if (!CompileShader(ctx, data->frag_shader, frag_defines, shader_source[index][1])) {
+        return SDL_FALSE;
+    }
+
+    /* ... and in the darkness bind them */
+    ctx->glAttachObjectARB(data->program, data->vert_shader);
+    ctx->glAttachObjectARB(data->program, data->frag_shader);
+    ctx->glLinkProgramARB(data->program);
+
+    /* Set up some uniform variables */
+    ctx->glUseProgramObjectARB(data->program);
+    for (i = 0; i < num_tmus_bound; ++i) {
+        char tex_name[5];
+        SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i);
+        location = ctx->glGetUniformLocationARB(data->program, tex_name);
+        if (location >= 0) {
+            ctx->glUniform1iARB(location, i);
+        }
+    }
+    ctx->glUseProgramObjectARB(0);
+    
+    return (ctx->glGetError() == GL_NO_ERROR);
+}
+
+static void
+DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data)
+{
+    ctx->glDeleteObjectARB(data->vert_shader);
+    ctx->glDeleteObjectARB(data->frag_shader);
+    ctx->glDeleteObjectARB(data->program);
+}
+
+GL_ShaderContext *
+GL_CreateShaderContext()
+{
+    GL_ShaderContext *ctx;
+    SDL_bool shaders_supported;
+    int i;
+
+    ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx));
+    if (!ctx) {
+        return NULL;
+    }
+
+    if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
+        || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
+        ctx->GL_ARB_texture_rectangle_supported = SDL_TRUE;
+    }
+
+    /* Check for shader support */
+    shaders_supported = SDL_FALSE;
+    if (SDL_GL_ExtensionSupported("GL_ARB_shader_objects") &&
+        SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") &&
+        SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") &&
+        SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) {
+        ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError");
+        ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
+        ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
+        ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
+        ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
+        ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
+        ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
+        ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
+        ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
+        ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
+        ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
+        ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
+        ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB");
+        ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
+        if (ctx->glGetError &&
+            ctx->glAttachObjectARB &&
+            ctx->glCompileShaderARB &&
+            ctx->glCreateProgramObjectARB &&
+            ctx->glCreateShaderObjectARB &&
+            ctx->glDeleteObjectARB &&
+            ctx->glGetInfoLogARB &&
+            ctx->glGetObjectParameterivARB &&
+            ctx->glGetUniformLocationARB &&
+            ctx->glLinkProgramARB &&
+            ctx->glShaderSourceARB &&
+            ctx->glUniform1iARB &&
+            ctx->glUniform1fARB &&
+            ctx->glUseProgramObjectARB) {
+            shaders_supported = SDL_TRUE;
+        }
+    }
+
+    if (!shaders_supported) {
+        SDL_free(ctx);
+        return NULL;
+    }
+
+    /* Compile all the shaders */
+    for (i = 0; i < NUM_SHADERS; ++i) {
+        if (!CompileShaderProgram(ctx, i, &ctx->shaders[i])) {
+            GL_DestroyShaderContext(ctx);
+            return NULL;
+        }
+    }
+
+    /* We're done! */
+    return ctx;
+}
+
+void
+GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader)
+{
+    /* Nothing to do if there's no shader support */
+    if (!ctx) {
+        return;
+    }
+
+    /* Nothing to do if there's no shader change */
+    if (shader == ctx->current_shader) {
+        return;
+    }
+
+    ctx->glUseProgramObjectARB(ctx->shaders[shader].program);
+    ctx->current_shader = shader;
+}
+
+void
+GL_DestroyShaderContext(GL_ShaderContext *ctx)
+{
+    int i;
+
+    for (i = 0; i < NUM_SHADERS; ++i) {
+        DestroyShaderProgram(ctx, &ctx->shaders[i]);
+    }
+    SDL_free(ctx);
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/render/opengl/SDL_shaders_gl.h	Sat Feb 12 19:16:09 2011 -0800
@@ -0,0 +1,40 @@
+/*
+    SDL - 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 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
+*/
+#include "SDL_config.h"
+
+/* OpenGL shader implementation */
+
+typedef enum {
+    SHADER_NONE,
+    SHADER_SOLID,
+    SHADER_RGB,
+    SHADER_YV12,
+    NUM_SHADERS
+} GL_Shader;
+
+typedef struct GL_ShaderContext GL_ShaderContext;
+
+extern GL_ShaderContext * GL_CreateShaderContext();
+extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader);
+extern void GL_DestroyShaderContext(GL_ShaderContext *ctx);
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/opengles/SDL_render_gles.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,7 +21,7 @@
 */
 #include "SDL_config.h"
 
-#if SDL_VIDEO_RENDER_OGL_ES
+#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
 
 #include "SDL_opengles.h"
 #include "../SDL_sysrender.h"
@@ -40,9 +40,6 @@
 
 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
 
-/* Used to re-create the window with OpenGL 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);
@@ -56,6 +53,7 @@
                             const SDL_Rect * rect, void **pixels, int *pitch);
 static void GLES_UnlockTexture(SDL_Renderer * renderer,
                                SDL_Texture * texture);
+static void GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
 static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
                                  const SDL_Point * points, int count);
 static int GLES_RenderDrawLines(SDL_Renderer * renderer,
@@ -145,14 +143,6 @@
     SDL_Renderer *renderer;
     GLES_RenderData *data;
     GLint value;
-    Uint32 window_flags;
-
-    window_flags = SDL_GetWindowFlags(window);
-    if (!(window_flags & SDL_WINDOW_OPENGL)) {
-        if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
-            return NULL;
-        }
-    }
 
     renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
     if (!renderer) {
@@ -172,6 +162,7 @@
     renderer->UpdateTexture = GLES_UpdateTexture;
     renderer->LockTexture = GLES_LockTexture;
     renderer->UnlockTexture = GLES_UnlockTexture;
+    renderer->SetClipRect = GLES_SetClipRect;
     renderer->RenderDrawPoints = GLES_RenderDrawPoints;
     renderer->RenderDrawLines = GLES_RenderDrawLines;
     renderer->RenderFillRects = GLES_RenderFillRects;
@@ -291,7 +282,6 @@
 static int
 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
-    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
     GLES_TextureData *data;
     GLint internalFormat;
     GLenum format, type;
@@ -368,46 +358,60 @@
 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;
-    GLenum result;
-    int bpp = SDL_BYTESPERPIXEL(texture->format);
-    void * temp_buffer;
-    void * temp_ptr;
-    int i;
+    Uint8 *blob = NULL;
+    Uint8 *src;
+    int srcPitch;
+    int y;
 
     GLES_ActivateRenderer(renderer);
 
+    /* Bail out if we're supposed to update an empty rectangle */
+    if (rect->w <= 0 || rect->h <= 0)
+        return 0;
+
+    /* Reformat the texture data into a tightly packed array */
+    srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format);
+    src = (Uint8 *)pixels;
+    if (pitch != srcPitch)
+    {
+        blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
+        if (!blob)
+        {
+            SDL_OutOfMemory();
+            return -1;
+        }
+        src = blob;
+        for (y = 0; y < rect->h; ++y)
+        {
+            SDL_memcpy(src, pixels, srcPitch);
+            src += srcPitch;
+            pixels = (Uint8 *)pixels + pitch;
+        }
+        src = blob;
+    }
+
+    /* Create a texture subimage with the supplied data */
     glGetError();
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     glEnable(data->type);
     glBindTexture(data->type, data->texture);
-
-    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;
-         }
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glTexSubImage2D(data->type,
+                    0,
+                    rect->x,
+                    rect->y,
+                    rect->w,
+                    rect->h,
+                    data->format,
+                    data->formattype,
+                    src);
+    if (blob) {
+        SDL_free(blob);
     }
 
-    glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
-                                rect->h, data->format, data->formattype,
-                                temp_buffer);
-
-    if( temp_buffer != pixels ) {
-        SDL_free(temp_buffer);
-    }
-
-    glDisable(data->type);
-    result = glGetError();
-    if (result != GL_NO_ERROR) {
-        GLES_SetError("glTexSubImage2D()", result);
+    if (glGetError() != GL_NO_ERROR)
+    {
+        SDL_SetError("Failed to update texture");
         return -1;
     }
     return 0;
@@ -429,18 +433,31 @@
 static void
 GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
-    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
     GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+    SDL_Rect rect;
 
+    /* We do whole texture updates, at least for now */
+    rect.x = 0;
+    rect.y = 0;
+    rect.w = texture->w;
+    rect.h = texture->h;
+    GLES_UpdateTexture(renderer, texture, &rect, data->pixels, data->pitch);
+}
+
+static void
+GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
     GLES_ActivateRenderer(renderer);
 
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    glEnable(data->type);
-    glBindTexture(data->type, data->texture);
-    glTexSubImage2D(data->type, 0, 0, 0, texture->w,
-                                texture->h, data->format, data->formattype,
-                                data->pixels);
-    glDisable(data->type);
+    if (rect) {
+        int w, h;
+
+        SDL_GetWindowSize(renderer->window, &w, &h);
+        glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h);
+        glEnable(GL_SCISSOR_TEST);
+    } else {
+        glDisable(GL_SCISSOR_TEST);
+    }
 }
 
 static void
@@ -710,6 +727,6 @@
     SDL_free(renderer);
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES */
+#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/opengles2/SDL_render_gles2.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,29 +1,28 @@
 /*
     SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2011 Sam Lantinga
     Copyright (C) 2010 itsnotabigtruck.
 
-    Permission is hereby granted, free of charge, to any person obtaining a
-    copy of this software and associated documentation files (the "Software"),
-    to deal in the Software without restriction, including without limitation
-    the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the
-    Software is furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
+    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.
 
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE 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.
+
+    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
 */
-
 #include "SDL_config.h"
 
-#if SDL_VIDEO_RENDER_OGL_ES2
+#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
 
 #include "SDL_opengles2.h"
 #include "../SDL_sysrender.h"
@@ -133,10 +132,10 @@
  * Renderer state APIs                                                                           *
  *************************************************************************************************/
 
+static int GLES2_ActivateRenderer(SDL_Renderer *renderer);
 static void GLES2_WindowEvent(SDL_Renderer * renderer,
                               const SDL_WindowEvent *event);
-static int GLES2_ActivateRenderer(SDL_Renderer *renderer);
-static int GLES2_DisplayModeChanged(SDL_Renderer *renderer);
+static void GLES2_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
 static void GLES2_DestroyRenderer(SDL_Renderer *renderer);
 
 static SDL_GLContext SDL_CurrentContext = NULL;
@@ -179,6 +178,22 @@
 }
 
 static void
+GLES2_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+    GLES2_ActivateRenderer(renderer);
+
+    if (rect) {
+        int w, h;
+
+        SDL_GetWindowSize(renderer->window, &w, &h);
+        glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h);
+        glEnable(GL_SCISSOR_TEST);
+    } else {
+        glDisable(GL_SCISSOR_TEST);
+    }
+}
+
+static void
 GLES2_DestroyRenderer(SDL_Renderer *renderer)
 {
     GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
@@ -327,14 +342,14 @@
 GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
 {
     GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
-
-    GLES2_ActivateRenderer(renderer);
+    SDL_Rect rect;
 
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    glActiveTexture(GL_TEXTURE0);
-    glBindTexture(tdata->texture_type, tdata->texture);
-    glTexSubImage2D(tdata->texture_type, 0, 0, 0, texture->w, texture->h,
-                    tdata->pixel_format, tdata->pixel_type, tdata->pixel_data);
+    /* We do whole texture updates, at least for now */
+    rect.x = 0;
+    rect.y = 0;
+    rect.w = texture->w;
+    rect.h = texture->h;
+    GLES2_UpdateTexture(renderer, texture, &rect, tdata->pixel_data, tdata->pitch);
 }
 
 static int
@@ -345,7 +360,6 @@
     Uint8 *blob = NULL;
     Uint8 *src;
     int srcPitch;
-    Uint8 *dest;
     int y;
 
     GLES2_ActivateRenderer(renderer);
@@ -389,7 +403,9 @@
                     tdata->pixel_format,
                     tdata->pixel_type,
                     src);
-    SDL_free(blob);
+    if (blob) {
+        SDL_free(blob);
+    }
 
     if (glGetError() != GL_NO_ERROR)
     {
@@ -761,6 +777,8 @@
  * Rendering functions                                                                           *
  *************************************************************************************************/
 
+static const float inv255f = 1.0f / 255.0f;
+
 static int GLES2_RenderClear(SDL_Renderer *renderer);
 static int GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count);
 static int GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count);
@@ -772,10 +790,10 @@
 static int
 GLES2_RenderClear(SDL_Renderer *renderer)
 {
-    float r = (float)renderer->r / 255.0f;
-    float g = (float)renderer->g / 255.0f;
-    float b = (float)renderer->b / 255.0f;
-    float a = (float)renderer->a / 255.0f;
+    float r = (float)renderer->r * inv255f;
+    float g = (float)renderer->g * inv255f;
+    float b = (float)renderer->b * inv255f;
+    float a = (float)renderer->a * inv255f;
 
     GLES2_ActivateRenderer(renderer);
 
@@ -832,10 +850,10 @@
     locColor = rdata->current_program->uniform_locations[GLES2_UNIFORM_COLOR];
     glGetError();
     glUniform4f(locColor,
-                renderer->r / 255.0f,
-                renderer->g / 255.0f,
-                renderer->b / 255.0f,
-                alpha / 255.0f);
+                renderer->r * inv255f,
+                renderer->g * inv255f,
+                renderer->b * inv255f,
+                alpha * inv255f);
 
     /* Configure the correct blend mode */
     GLES2_SetBlendMode(blendMode);
@@ -886,10 +904,10 @@
     locColor = rdata->current_program->uniform_locations[GLES2_UNIFORM_COLOR];
     glGetError();
     glUniform4f(locColor,
-                renderer->r / 255.0f,
-                renderer->g / 255.0f,
-                renderer->b / 255.0f,
-                alpha / 255.0f);
+                renderer->r * inv255f,
+                renderer->g * inv255f,
+                renderer->b * inv255f,
+                alpha * inv255f);
 
     /* Configure the correct blend mode */
     GLES2_SetBlendMode(blendMode);
@@ -940,10 +958,10 @@
     locColor = rdata->current_program->uniform_locations[GLES2_UNIFORM_COLOR];
     glGetError();
     glUniform4f(locColor,
-                renderer->r / 255.0f,
-                renderer->g / 255.0f,
-                renderer->b / 255.0f,
-                alpha / 255.0f);
+                renderer->r * inv255f,
+                renderer->g * inv255f,
+                renderer->b * inv255f,
+                alpha * inv255f);
 
     /* Configure the correct blend mode */
     GLES2_SetBlendMode(blendMode);
@@ -1014,10 +1032,10 @@
     /* Configure color modulation */
     locModulation = rdata->current_program->uniform_locations[GLES2_UNIFORM_MODULATION];
     glUniform4f(locModulation,
-                texture->r / 255.0f,
-                texture->g / 255.0f,
-                texture->b / 255.0f,
-                alpha / 255.0f);
+                texture->r * inv255f,
+                texture->g * inv255f,
+                texture->b * inv255f,
+                alpha * inv255f);
 
     /* Emit the textured quad */
     glEnableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
@@ -1160,6 +1178,7 @@
     renderer->UpdateTexture       = &GLES2_UpdateTexture;
     renderer->LockTexture         = &GLES2_LockTexture;
     renderer->UnlockTexture       = &GLES2_UnlockTexture;
+    renderer->SetClipRect         = &GLES2_SetClipRect;
     renderer->RenderClear         = &GLES2_RenderClear;
     renderer->RenderDrawPoints    = &GLES2_RenderDrawPoints;
     renderer->RenderDrawLines     = &GLES2_RenderDrawLines;
@@ -1171,6 +1190,6 @@
     return renderer;
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/opengles2/SDL_shaders_gles2.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengles2/SDL_shaders_gles2.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,29 +1,28 @@
 /*
     SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2011 Sam Lantinga
     Copyright (C) 2010 itsnotabigtruck.
 
-    Permission is hereby granted, free of charge, to any person obtaining a
-    copy of this software and associated documentation files (the "Software"),
-    to deal in the Software without restriction, including without limitation
-    the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the
-    Software is furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
+    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.
 
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE 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.
+
+    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
 */
-
 #include "SDL_config.h"
 
-#if SDL_VIDEO_RENDER_OGL_ES2
+#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
 
 #include "SDL_video.h"
 #include "SDL_opengles2.h"
@@ -539,6 +538,6 @@
     }
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/opengles2/SDL_shaders_gles2.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/opengles2/SDL_shaders_gles2.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,26 +1,25 @@
 /*
     SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2011 Sam Lantinga
     Copyright (C) 2010 itsnotabigtruck.
 
-    Permission is hereby granted, free of charge, to any person obtaining a
-    copy of this software and associated documentation files (the "Software"),
-    to deal in the Software without restriction, including without limitation
-    the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the
-    Software is furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
+    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.
 
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE 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.
+
+    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
 */
-
 #include "SDL_config.h"
 
 #if SDL_VIDEO_RENDER_OGL_ES2
--- a/src/render/software/SDL_blendfillrect.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendfillrect.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "SDL_draw.h"
 #include "SDL_blendfillrect.h"
 
@@ -345,4 +347,6 @@
     return status;
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_blendfillrect.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendfillrect.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_blendline.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendline.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "SDL_draw.h"
 #include "SDL_blendline.h"
 #include "SDL_blendpoint.h"
@@ -779,4 +781,6 @@
     return 0;
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_blendline.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendline.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_blendpoint.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendpoint.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "SDL_draw.h"
 #include "SDL_blendpoint.h"
 
@@ -343,4 +345,6 @@
     return status;
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_blendpoint.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_blendpoint.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_draw.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_draw.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_drawline.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_drawline.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "SDL_draw.h"
 #include "SDL_drawline.h"
 #include "SDL_drawpoint.h"
@@ -208,4 +210,6 @@
     return 0;
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_drawline.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_drawline.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_drawpoint.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_drawpoint.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "SDL_draw.h"
 #include "SDL_drawpoint.h"
 
@@ -114,4 +116,6 @@
     return 0;
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_drawpoint.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_drawpoint.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/render/software/SDL_render_sw.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_render_sw.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -21,6 +21,8 @@
 */
 #include "SDL_config.h"
 
+#if !SDL_RENDER_DISABLED
+
 #include "../SDL_sysrender.h"
 #include "../../video/SDL_pixels_c.h"
 
@@ -50,6 +52,7 @@
 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 void SW_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
 static int SW_RenderDrawPoints(SDL_Renderer * renderer,
                                const SDL_Point * points, int count);
 static int SW_RenderDrawLines(SDL_Renderer * renderer,
@@ -125,6 +128,7 @@
     renderer->UpdateTexture = SW_UpdateTexture;
     renderer->LockTexture = SW_LockTexture;
     renderer->UnlockTexture = SW_UnlockTexture;
+    renderer->SetClipRect = SW_SetClipRect;
     renderer->DestroyTexture = SW_DestroyTexture;
     renderer->RenderDrawPoints = SW_RenderDrawPoints;
     renderer->RenderDrawLines = SW_RenderDrawLines;
@@ -266,6 +270,17 @@
 {
 }
 
+static void
+SW_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+    SDL_Surface *surface = SW_ActivateRenderer(renderer);
+
+    if (!surface) {
+        return;
+    }
+    SDL_SetClipRect(surface, rect);
+}
+
 static int
 SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
                     int count)
@@ -415,4 +430,6 @@
     SDL_free(renderer);
 }
 
+#endif /* !SDL_RENDER_DISABLED */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/software/SDL_render_sw_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/render/software/SDL_render_sw_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/stdlib/SDL_getenv.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/stdlib/SDL_getenv.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/stdlib/SDL_iconv.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/stdlib/SDL_iconv.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/stdlib/SDL_malloc.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/stdlib/SDL_malloc.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/stdlib/SDL_stdlib.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/stdlib/SDL_stdlib.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/stdlib/SDL_string.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/stdlib/SDL_string.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/SDL_systhread.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/SDL_systhread.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/SDL_thread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/SDL_thread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/SDL_thread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/SDL_thread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/beos/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/beos/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/beos/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/beos/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/beos/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/beos/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_syscond.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_syscond.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_sysmutex.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_sysmutex.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_sysmutex_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_sysmutex_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/generic/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/generic/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/irix/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/irix/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/irix/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/irix/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/irix/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/irix/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_syscond.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_syscond.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_syscond_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_syscond_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_sysmutex.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_sysmutex.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_sysmutex_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_sysmutex_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_syssem_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_syssem_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/nds/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/nds/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_syscond.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_syscond.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_sysmutex.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_sysmutex.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_sysmutex_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_sysmutex_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/pthread/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/pthread/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/windows/SDL_sysmutex.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/windows/SDL_sysmutex.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/windows/SDL_syssem.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/windows/SDL_syssem.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/windows/SDL_systhread.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/windows/SDL_systhread.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/thread/windows/SDL_systhread_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/thread/windows/SDL_systhread_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/SDL_timer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/SDL_timer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/SDL_timer_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/SDL_timer_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/beos/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/beos/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/dummy/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/dummy/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/nds/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/nds/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -28,7 +28,7 @@
 
 #include "SDL_timer.h"
 
-
+/* Will wrap afetr 49 days. Shouldn't be an issue. */
 static volatile Uint32 timer_ticks;
 
 static void
@@ -42,10 +42,8 @@
 {
     timer_ticks = 0;
 
-    TIMER_CR(3) = TIMER_DIV_1024 | TIMER_IRQ_REQ;
-    TIMER_DATA(3) = TIMER_FREQ_1024(1000);
-    irqSet(IRQ_TIMER3, NDS_TimerInterrupt);
-    irqEnable(IRQ_TIMER3);
+	/* Set timer 2 to fire every ms. */
+	timerStart(2, ClockDivider_1024, TIMER_FREQ_1024(1000), NDS_TimerInterrupt);
 }
 
 Uint32
@@ -58,7 +56,7 @@
 SDL_Delay(Uint32 ms)
 {
     Uint32 start = SDL_GetTicks();
-    while (timer_alive) {
+    while (1) {
         if ((SDL_GetTicks() - start) >= ms)
             break;
     }
--- a/src/timer/unix/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/unix/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/wince/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/wince/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/timer/windows/SDL_systimer.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/timer/windows/SDL_systimer.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_RLEaccel.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_RLEaccel.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_RLEaccel_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_RLEaccel_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -100,30 +100,6 @@
     return (okay ? 0 : -1);
 }
 
-#ifdef __MACOSX__
-#include <sys/sysctl.h>
-
-static SDL_bool
-SDL_UseAltivecPrefetch()
-{
-    const char key[] = "hw.l3cachesize";
-    u_int64_t result = 0;
-    size_t typeSize = sizeof(result);
-
-    if (sysctlbyname(key, &result, &typeSize, NULL, 0) == 0 && result > 0) {
-        return SDL_TRUE;
-    } else {
-        return SDL_FALSE;
-    }
-}
-#else
-static SDL_bool
-SDL_UseAltivecPrefetch()
-{
-    /* Just guess G4 */
-    return SDL_TRUE;
-}
-#endif /* __MACOSX__ */
 
 static SDL_BlitFunc
 SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags,
@@ -145,22 +121,12 @@
             if (SDL_HasMMX()) {
                 features |= SDL_CPU_MMX;
             }
-            if (SDL_Has3DNow()) {
-                features |= SDL_CPU_3DNOW;
-            }
             if (SDL_HasSSE()) {
                 features |= SDL_CPU_SSE;
             }
             if (SDL_HasSSE2()) {
                 features |= SDL_CPU_SSE2;
             }
-            if (SDL_HasAltiVec()) {
-                if (SDL_UseAltivecPrefetch()) {
-                    features |= SDL_CPU_ALTIVEC_PREFETCH;
-                } else {
-                    features |= SDL_CPU_ALTIVEC_NOPREFETCH;
-                }
-            }
         }
     }
 
--- a/src/video/SDL_blit.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -34,9 +34,6 @@
 #ifdef __MMX__
 #include <mmintrin.h>
 #endif
-#ifdef __3dNOW__
-#include <mm3dnow.h>
-#endif
 #ifdef __SSE__
 #include <xmmintrin.h>
 #endif
@@ -65,11 +62,8 @@
 /* SDL blit CPU flags */
 #define SDL_CPU_ANY                 0x00000000
 #define SDL_CPU_MMX                 0x00000001
-#define SDL_CPU_3DNOW               0x00000002
 #define SDL_CPU_SSE                 0x00000004
 #define SDL_CPU_SSE2                0x00000008
-#define SDL_CPU_ALTIVEC_PREFETCH    0x00000010
-#define SDL_CPU_ALTIVEC_NOPREFETCH  0x00000020
 
 typedef struct
 {
--- a/src/video/SDL_blit_0.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_0.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit_1.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_1.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit_A.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_A.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -419,806 +419,6 @@
 
 #endif /* __MMX__ */
 
-#if SDL_ALTIVEC_BLITTERS
-#if __MWERKS__
-#pragma altivec_model on
-#endif
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-#include <assert.h>
-
-#if (defined(__MACOSX__) && (__GNUC__ < 4))
-#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
-        (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )
-#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
-        (vector unsigned short) ( a,b,c,d,e,f,g,h )
-#else
-#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
-        (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p }
-#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
-        (vector unsigned short) { a,b,c,d,e,f,g,h }
-#endif
-
-#define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F)
-#define VECPRINT(msg, v) do { \
-    vector unsigned int tmpvec = (vector unsigned int)(v); \
-    unsigned int *vp = (unsigned int *)&tmpvec; \
-    printf("%s = %08X %08X %08X %08X\n", msg, vp[0], vp[1], vp[2], vp[3]); \
-} while (0)
-
-/* the permuation vector that takes the high bytes out of all the appropriate shorts 
-    (vector unsigned char)(
-        0x00, 0x10, 0x02, 0x12,
-        0x04, 0x14, 0x06, 0x16,
-        0x08, 0x18, 0x0A, 0x1A,
-        0x0C, 0x1C, 0x0E, 0x1E );
-*/
-#define VEC_MERGE_PERMUTE() (vec_add(vec_lvsl(0, (int*)NULL), (vector unsigned char)vec_splat_u16(0x0F)))
-#define VEC_U32_24() (vec_add(vec_splat_u32(12), vec_splat_u32(12)))
-#define VEC_ALPHA_MASK() ((vector unsigned char)vec_sl((vector unsigned int)vec_splat_s8(-1), VEC_U32_24()))
-#define VEC_ALIGNER(src) ((UNALIGNED_PTR(src)) \
-    ? vec_lvsl(0, src) \
-    : vec_add(vec_lvsl(8, src), vec_splat_u8(8)))
-
-
-#define VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1_16, v8_16) do { \
-    /* vtemp1 contains source AAGGAAGGAAGGAAGG */ \
-    vector unsigned short vtemp1 = vec_mule(vs, valpha); \
-    /* vtemp2 contains source RRBBRRBBRRBBRRBB */ \
-    vector unsigned short vtemp2 = vec_mulo(vs, valpha); \
-    /* valpha2 is 255-alpha */ \
-    vector unsigned char valpha2 = vec_nor(valpha, valpha); \
-    /* vtemp3 contains dest AAGGAAGGAAGGAAGG */ \
-    vector unsigned short vtemp3 = vec_mule(vd, valpha2); \
-    /* vtemp4 contains dest RRBBRRBBRRBBRRBB */ \
-    vector unsigned short vtemp4 = vec_mulo(vd, valpha2); \
-    /* add source and dest */ \
-    vtemp1 = vec_add(vtemp1, vtemp3); \
-    vtemp2 = vec_add(vtemp2, vtemp4); \
-    /* vtemp1 = (vtemp1 + 1) + ((vtemp1 + 1) >> 8) */ \
-    vtemp1 = vec_add(vtemp1, v1_16); \
-    vtemp3 = vec_sr(vtemp1, v8_16); \
-    vtemp1 = vec_add(vtemp1, vtemp3); \
-    /* vtemp2 = (vtemp2 + 1) + ((vtemp2 + 1) >> 8) */ \
-    vtemp2 = vec_add(vtemp2, v1_16); \
-    vtemp4 = vec_sr(vtemp2, v8_16); \
-    vtemp2 = vec_add(vtemp2, vtemp4); \
-    /* (>>8) and get ARGBARGBARGBARGB */ \
-    vd = (vector unsigned char)vec_perm(vtemp1, vtemp2, mergePermute); \
-} while (0)
-
-/* Calculate the permute vector used for 32->32 swizzling */
-static vector unsigned char
-calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt)
-{
-    /*
-     * We have to assume that the bits that aren't used by other
-     *  colors is alpha, and it's one complete byte, since some formats
-     *  leave alpha with a zero mask, but we should still swizzle the bits.
-     */
-    /* ARGB */
-    const static struct SDL_PixelFormat default_pixel_format = {
-        NULL, 0, 0,
-        0, 0, 0, 0,
-        16, 8, 0, 24,
-        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
-    };
-    if (!srcfmt) {
-        srcfmt = &default_pixel_format;
-    }
-    if (!dstfmt) {
-        dstfmt = &default_pixel_format;
-    }
-    const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
-                                                       0x04, 0x04, 0x04, 0x04,
-                                                       0x08, 0x08, 0x08, 0x08,
-                                                       0x0C, 0x0C, 0x0C,
-                                                       0x0C);
-    vector unsigned char vswiz;
-    vector unsigned int srcvec;
-#define RESHIFT(X) (3 - ((X) >> 3))
-    Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
-    Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
-    Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
-    Uint32 amask;
-    /* Use zero for alpha if either surface doesn't have alpha */
-    if (dstfmt->Amask) {
-        amask =
-            ((srcfmt->Amask) ? RESHIFT(srcfmt->
-                                       Ashift) : 0x10) << (dstfmt->Ashift);
-    } else {
-        amask =
-            0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^
-                          0xFFFFFFFF);
-    }
-#undef RESHIFT
-    ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask);
-    vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0));
-    return (vswiz);
-}
-
-static void
-Blit32to565PixelAlphaAltivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint8 *src = (Uint8 *) info->src;
-    int srcskip = info->src_skip;
-    Uint8 *dst = (Uint8 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-
-    vector unsigned char v0 = vec_splat_u8(0);
-    vector unsigned short v8_16 = vec_splat_u16(8);
-    vector unsigned short v1_16 = vec_splat_u16(1);
-    vector unsigned short v2_16 = vec_splat_u16(2);
-    vector unsigned short v3_16 = vec_splat_u16(3);
-    vector unsigned int v8_32 = vec_splat_u32(8);
-    vector unsigned int v16_32 = vec_add(v8_32, v8_32);
-    vector unsigned short v3f =
-        VECUINT16_LITERAL(0x003f, 0x003f, 0x003f, 0x003f,
-                          0x003f, 0x003f, 0x003f, 0x003f);
-    vector unsigned short vfc =
-        VECUINT16_LITERAL(0x00fc, 0x00fc, 0x00fc, 0x00fc,
-                          0x00fc, 0x00fc, 0x00fc, 0x00fc);
-
-    /* 
-       0x10 - 0x1f is the alpha
-       0x00 - 0x0e evens are the red
-       0x01 - 0x0f odds are zero
-     */
-    vector unsigned char vredalpha1 = VECUINT8_LITERAL(0x10, 0x00, 0x01, 0x01,
-                                                       0x10, 0x02, 0x01, 0x01,
-                                                       0x10, 0x04, 0x01, 0x01,
-                                                       0x10, 0x06, 0x01,
-                                                       0x01);
-    vector unsigned char vredalpha2 =
-        (vector unsigned char) (vec_add((vector unsigned int) vredalpha1,
-                                        vec_sl(v8_32, v16_32))
-        );
-    /*
-       0x00 - 0x0f is ARxx ARxx ARxx ARxx
-       0x11 - 0x0f odds are blue
-     */
-    vector unsigned char vblue1 = VECUINT8_LITERAL(0x00, 0x01, 0x02, 0x11,
-                                                   0x04, 0x05, 0x06, 0x13,
-                                                   0x08, 0x09, 0x0a, 0x15,
-                                                   0x0c, 0x0d, 0x0e, 0x17);
-    vector unsigned char vblue2 =
-        (vector unsigned char) (vec_add((vector unsigned int) vblue1, v8_32)
-        );
-    /*
-       0x00 - 0x0f is ARxB ARxB ARxB ARxB
-       0x10 - 0x0e evens are green
-     */
-    vector unsigned char vgreen1 = VECUINT8_LITERAL(0x00, 0x01, 0x10, 0x03,
-                                                    0x04, 0x05, 0x12, 0x07,
-                                                    0x08, 0x09, 0x14, 0x0b,
-                                                    0x0c, 0x0d, 0x16, 0x0f);
-    vector unsigned char vgreen2 =
-        (vector unsigned
-         char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8_32, v8_32))
-        );
-    vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
-                                                    0x00, 0x0a, 0x00, 0x0e,
-                                                    0x00, 0x12, 0x00, 0x16,
-                                                    0x00, 0x1a, 0x00, 0x1e);
-    vector unsigned char mergePermute = VEC_MERGE_PERMUTE();
-    vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
-    vector unsigned char valphaPermute =
-        vec_and(vec_lvsl(0, (int *) NULL), vec_splat_u8(0xC));
-
-    vector unsigned short vf800 = (vector unsigned short) vec_splat_u8(-7);
-    vf800 = vec_sl(vf800, vec_splat_u16(8));
-
-    while (height--) {
-        int extrawidth;
-        vector unsigned char valigner;
-        vector unsigned char vsrc;
-        vector unsigned char voverflow;
-        int width = info->dst_w;
-
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while (condition) { \
-            Uint32 Pixel; \
-            unsigned sR, sG, sB, dR, dG, dB, sA; \
-            DISEMBLE_RGBA(src, 4, srcfmt, Pixel, sR, sG, sB, sA); \
-            if(sA) { \
-                unsigned short dstpixel = *((unsigned short *)dst); \
-                dR = (dstpixel >> 8) & 0xf8; \
-                dG = (dstpixel >> 3) & 0xfc; \
-                dB = (dstpixel << 3) & 0xf8; \
-                ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
-                *((unsigned short *)dst) = ( \
-                    ((dR & 0xf8) << 8) | ((dG & 0xfc) << 3) | (dB >> 3) \
-                ); \
-            } \
-            src += 4; \
-            dst += 2; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dst)) && (width), width);
-        extrawidth = (width % 8);
-        valigner = VEC_ALIGNER(src);
-        vsrc = (vector unsigned char) vec_ld(0, src);
-        width -= extrawidth;
-        while (width) {
-            vector unsigned char valpha;
-            vector unsigned char vsrc1, vsrc2;
-            vector unsigned char vdst1, vdst2;
-            vector unsigned short vR, vG, vB;
-            vector unsigned short vpixel, vrpixel, vgpixel, vbpixel;
-
-            /* Load 8 pixels from src as ARGB */
-            voverflow = (vector unsigned char) vec_ld(15, src);
-            vsrc = vec_perm(vsrc, voverflow, valigner);
-            vsrc1 = vec_perm(vsrc, vsrc, vpermute);
-            src += 16;
-            vsrc = (vector unsigned char) vec_ld(15, src);
-            voverflow = vec_perm(voverflow, vsrc, valigner);
-            vsrc2 = vec_perm(voverflow, voverflow, vpermute);
-            src += 16;
-
-            /* Load 8 pixels from dst as XRGB */
-            voverflow = vec_ld(0, dst);
-            vR = vec_and((vector unsigned short) voverflow, vf800);
-            vB = vec_sl((vector unsigned short) voverflow, v3_16);
-            vG = vec_sl(vB, v2_16);
-            vdst1 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                (vector unsigned char) vR,
-                                                vredalpha1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vB, vblue1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vG, vgreen1);
-            vdst2 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                (vector unsigned char) vR,
-                                                vredalpha2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vB, vblue2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vG, vgreen2);
-
-            /* Alpha blend 8 pixels as ARGB */
-            valpha = vec_perm(vsrc1, v0, valphaPermute);
-            VEC_MULTIPLY_ALPHA(vsrc1, vdst1, valpha, mergePermute, v1_16,
-                               v8_16);
-            valpha = vec_perm(vsrc2, v0, valphaPermute);
-            VEC_MULTIPLY_ALPHA(vsrc2, vdst2, valpha, mergePermute, v1_16,
-                               v8_16);
-
-            /* Convert 8 pixels to 565 */
-            vpixel = (vector unsigned short) vec_packpx((vector unsigned int)
-                                                        vdst1,
-                                                        (vector unsigned int)
-                                                        vdst2);
-            vgpixel = (vector unsigned short) vec_perm(vdst1, vdst2, vgmerge);
-            vgpixel = vec_and(vgpixel, vfc);
-            vgpixel = vec_sl(vgpixel, v3_16);
-            vrpixel = vec_sl(vpixel, v1_16);
-            vrpixel = vec_and(vrpixel, vf800);
-            vbpixel = vec_and(vpixel, v3f);
-            vdst1 =
-                vec_or((vector unsigned char) vrpixel,
-                       (vector unsigned char) vgpixel);
-            vdst1 = vec_or(vdst1, (vector unsigned char) vbpixel);
-
-            /* Store 8 pixels */
-            vec_st(vdst1, 0, dst);
-
-            width -= 8;
-            dst += 16;
-        }
-        ONE_PIXEL_BLEND((extrawidth), extrawidth);
-#undef ONE_PIXEL_BLEND
-        src += srcskip;
-        dst += dstskip;
-    }
-}
-
-static void
-Blit32to32SurfaceAlphaKeyAltivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    unsigned sA = info->a;
-    unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
-    Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
-    Uint32 ckey = info->colorkey;
-    vector unsigned char mergePermute;
-    vector unsigned char vsrcPermute;
-    vector unsigned char vdstPermute;
-    vector unsigned char vsdstPermute;
-    vector unsigned char valpha;
-    vector unsigned char valphamask;
-    vector unsigned char vbits;
-    vector unsigned char v0;
-    vector unsigned short v1;
-    vector unsigned short v8;
-    vector unsigned int vckey;
-    vector unsigned int vrgbmask;
-
-    mergePermute = VEC_MERGE_PERMUTE();
-    v0 = vec_splat_u8(0);
-    v1 = vec_splat_u16(1);
-    v8 = vec_splat_u16(8);
-
-    /* set the alpha to 255 on the destination surf */
-    valphamask = VEC_ALPHA_MASK();
-
-    vsrcPermute = calc_swizzle32(srcfmt, NULL);
-    vdstPermute = calc_swizzle32(NULL, dstfmt);
-    vsdstPermute = calc_swizzle32(dstfmt, NULL);
-
-    /* set a vector full of alpha and 255-alpha */
-    ((unsigned char *) &valpha)[0] = sA;
-    valpha = vec_splat(valpha, 0);
-    vbits = (vector unsigned char) vec_splat_s8(-1);
-
-    ckey &= rgbmask;
-    ((unsigned int *) (char *) &vckey)[0] = ckey;
-    vckey = vec_splat(vckey, 0);
-    ((unsigned int *) (char *) &vrgbmask)[0] = rgbmask;
-    vrgbmask = vec_splat(vrgbmask, 0);
-
-    while (height--) {
-        int width = info->dst_w;
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while (condition) { \
-            Uint32 Pixel; \
-            unsigned sR, sG, sB, dR, dG, dB; \
-            RETRIEVE_RGB_PIXEL(((Uint8 *)srcp), 4, Pixel); \
-            if(sA && Pixel != ckey) { \
-                RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \
-                DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, Pixel, dR, dG, dB); \
-                ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
-                ASSEMBLE_RGBA(((Uint8 *)dstp), 4, dstfmt, dR, dG, dB, dA); \
-            } \
-            dstp++; \
-            srcp++; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        if (width > 0) {
-            int extrawidth = (width % 4);
-            vector unsigned char valigner = VEC_ALIGNER(srcp);
-            vector unsigned char vs = (vector unsigned char) vec_ld(0, srcp);
-            width -= extrawidth;
-            while (width) {
-                vector unsigned char vsel;
-                vector unsigned char voverflow;
-                vector unsigned char vd;
-                vector unsigned char vd_orig;
-
-                /* s = *srcp */
-                voverflow = (vector unsigned char) vec_ld(15, srcp);
-                vs = vec_perm(vs, voverflow, valigner);
-
-                /* vsel is set for items that match the key */
-                vsel =
-                    (vector unsigned char) vec_and((vector unsigned int) vs,
-                                                   vrgbmask);
-                vsel = (vector unsigned char) vec_cmpeq((vector unsigned int)
-                                                        vsel, vckey);
-
-                /* permute to source format */
-                vs = vec_perm(vs, valpha, vsrcPermute);
-
-                /* d = *dstp */
-                vd = (vector unsigned char) vec_ld(0, dstp);
-                vd_orig = vd = vec_perm(vd, v0, vsdstPermute);
-
-                VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1, v8);
-
-                /* set the alpha channel to full on */
-                vd = vec_or(vd, valphamask);
-
-                /* mask out color key */
-                vd = vec_sel(vd, vd_orig, vsel);
-
-                /* permute to dest format */
-                vd = vec_perm(vd, vbits, vdstPermute);
-
-                /* *dstp = res */
-                vec_st((vector unsigned int) vd, 0, dstp);
-
-                srcp += 4;
-                dstp += 4;
-                width -= 4;
-                vs = voverflow;
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-        }
-#undef ONE_PIXEL_BLEND
-
-        srcp += srcskip;
-        dstp += dstskip;
-    }
-}
-
-
-static void
-Blit32to32PixelAlphaAltivec(SDL_BlitInfo * info)
-{
-    int width = info->dst_w;
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    vector unsigned char mergePermute;
-    vector unsigned char valphaPermute;
-    vector unsigned char vsrcPermute;
-    vector unsigned char vdstPermute;
-    vector unsigned char vsdstPermute;
-    vector unsigned char valphamask;
-    vector unsigned char vpixelmask;
-    vector unsigned char v0;
-    vector unsigned short v1;
-    vector unsigned short v8;
-
-    v0 = vec_splat_u8(0);
-    v1 = vec_splat_u16(1);
-    v8 = vec_splat_u16(8);
-    mergePermute = VEC_MERGE_PERMUTE();
-    valphamask = VEC_ALPHA_MASK();
-    valphaPermute = vec_and(vec_lvsl(0, (int *) NULL), vec_splat_u8(0xC));
-    vpixelmask = vec_nor(valphamask, v0);
-    vsrcPermute = calc_swizzle32(srcfmt, NULL);
-    vdstPermute = calc_swizzle32(NULL, dstfmt);
-    vsdstPermute = calc_swizzle32(dstfmt, NULL);
-
-    while (height--) {
-        width = info->dst_w;
-#define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
-            Uint32 Pixel; \
-            unsigned sR, sG, sB, dR, dG, dB, sA, dA; \
-            DISEMBLE_RGBA((Uint8 *)srcp, 4, srcfmt, Pixel, sR, sG, sB, sA); \
-            if(sA) { \
-              DISEMBLE_RGBA((Uint8 *)dstp, 4, dstfmt, Pixel, dR, dG, dB, dA); \
-              ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
-              ASSEMBLE_RGBA((Uint8 *)dstp, 4, dstfmt, dR, dG, dB, dA); \
-            } \
-            ++srcp; \
-            ++dstp; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        if (width > 0) {
-            /* vsrcPermute */
-            /* vdstPermute */
-            int extrawidth = (width % 4);
-            vector unsigned char valigner = VEC_ALIGNER(srcp);
-            vector unsigned char vs = (vector unsigned char) vec_ld(0, srcp);
-            width -= extrawidth;
-            while (width) {
-                vector unsigned char voverflow;
-                vector unsigned char vd;
-                vector unsigned char valpha;
-                vector unsigned char vdstalpha;
-                /* s = *srcp */
-                voverflow = (vector unsigned char) vec_ld(15, srcp);
-                vs = vec_perm(vs, voverflow, valigner);
-                vs = vec_perm(vs, v0, vsrcPermute);
-
-                valpha = vec_perm(vs, v0, valphaPermute);
-
-                /* d = *dstp */
-                vd = (vector unsigned char) vec_ld(0, dstp);
-                vd = vec_perm(vd, v0, vsdstPermute);
-                vdstalpha = vec_and(vd, valphamask);
-
-                VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1, v8);
-
-                /* set the alpha to the dest alpha */
-                vd = vec_and(vd, vpixelmask);
-                vd = vec_or(vd, vdstalpha);
-                vd = vec_perm(vd, v0, vdstPermute);
-
-                /* *dstp = res */
-                vec_st((vector unsigned int) vd, 0, dstp);
-
-                srcp += 4;
-                dstp += 4;
-                width -= 4;
-                vs = voverflow;
-
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-        }
-        srcp += srcskip;
-        dstp += dstskip;
-#undef ONE_PIXEL_BLEND
-    }
-}
-
-/* fast ARGB888->(A)RGB888 blending with pixel alpha */
-static void
-BlitRGBtoRGBPixelAlphaAltivec(SDL_BlitInfo * info)
-{
-    int width = info->dst_w;
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    vector unsigned char mergePermute;
-    vector unsigned char valphaPermute;
-    vector unsigned char valphamask;
-    vector unsigned char vpixelmask;
-    vector unsigned char v0;
-    vector unsigned short v1;
-    vector unsigned short v8;
-    v0 = vec_splat_u8(0);
-    v1 = vec_splat_u16(1);
-    v8 = vec_splat_u16(8);
-    mergePermute = VEC_MERGE_PERMUTE();
-    valphamask = VEC_ALPHA_MASK();
-    valphaPermute = vec_and(vec_lvsl(0, (int *) NULL), vec_splat_u8(0xC));
-
-
-    vpixelmask = vec_nor(valphamask, v0);
-    while (height--) {
-        width = info->dst_w;
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while ((condition)) { \
-            Uint32 dalpha; \
-            Uint32 d; \
-            Uint32 s1; \
-            Uint32 d1; \
-            Uint32 s = *srcp; \
-            Uint32 alpha = s >> 24; \
-            if(alpha) { \
-              if(alpha == SDL_ALPHA_OPAQUE) { \
-                *dstp = (s & 0x00ffffff) | (*dstp & 0xff000000); \
-              } else { \
-                d = *dstp; \
-                dalpha = d & 0xff000000; \
-                s1 = s & 0xff00ff; \
-                d1 = d & 0xff00ff; \
-                d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
-                s &= 0xff00; \
-                d &= 0xff00; \
-                d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
-                *dstp = d1 | d | dalpha; \
-              } \
-            } \
-            ++srcp; \
-            ++dstp; \
-            widthvar--; \
-	    }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        if (width > 0) {
-            int extrawidth = (width % 4);
-            vector unsigned char valigner = VEC_ALIGNER(srcp);
-            vector unsigned char vs = (vector unsigned char) vec_ld(0, srcp);
-            width -= extrawidth;
-            while (width) {
-                vector unsigned char voverflow;
-                vector unsigned char vd;
-                vector unsigned char valpha;
-                vector unsigned char vdstalpha;
-                /* s = *srcp */
-                voverflow = (vector unsigned char) vec_ld(15, srcp);
-                vs = vec_perm(vs, voverflow, valigner);
-
-                valpha = vec_perm(vs, v0, valphaPermute);
-
-                /* d = *dstp */
-                vd = (vector unsigned char) vec_ld(0, dstp);
-                vdstalpha = vec_and(vd, valphamask);
-
-                VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1, v8);
-
-                /* set the alpha to the dest alpha */
-                vd = vec_and(vd, vpixelmask);
-                vd = vec_or(vd, vdstalpha);
-
-                /* *dstp = res */
-                vec_st((vector unsigned int) vd, 0, dstp);
-
-                srcp += 4;
-                dstp += 4;
-                width -= 4;
-                vs = voverflow;
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-        }
-        srcp += srcskip;
-        dstp += dstskip;
-    }
-#undef ONE_PIXEL_BLEND
-}
-
-static void
-Blit32to32SurfaceAlphaAltivec(SDL_BlitInfo * info)
-{
-    /* XXX : 6 */
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    unsigned sA = info->a;
-    unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
-    vector unsigned char mergePermute;
-    vector unsigned char vsrcPermute;
-    vector unsigned char vdstPermute;
-    vector unsigned char vsdstPermute;
-    vector unsigned char valpha;
-    vector unsigned char valphamask;
-    vector unsigned char vbits;
-    vector unsigned short v1;
-    vector unsigned short v8;
-
-    mergePermute = VEC_MERGE_PERMUTE();
-    v1 = vec_splat_u16(1);
-    v8 = vec_splat_u16(8);
-
-    /* set the alpha to 255 on the destination surf */
-    valphamask = VEC_ALPHA_MASK();
-
-    vsrcPermute = calc_swizzle32(srcfmt, NULL);
-    vdstPermute = calc_swizzle32(NULL, dstfmt);
-    vsdstPermute = calc_swizzle32(dstfmt, NULL);
-
-    /* set a vector full of alpha and 255-alpha */
-    ((unsigned char *) &valpha)[0] = sA;
-    valpha = vec_splat(valpha, 0);
-    vbits = (vector unsigned char) vec_splat_s8(-1);
-
-    while (height--) {
-        int width = info->dst_w;
-#define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
-            Uint32 Pixel; \
-            unsigned sR, sG, sB, dR, dG, dB; \
-            DISEMBLE_RGB(((Uint8 *)srcp), 4, srcfmt, Pixel, sR, sG, sB); \
-            DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, Pixel, dR, dG, dB); \
-            ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
-            ASSEMBLE_RGBA(((Uint8 *)dstp), 4, dstfmt, dR, dG, dB, dA); \
-            ++srcp; \
-            ++dstp; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        if (width > 0) {
-            int extrawidth = (width % 4);
-            vector unsigned char valigner = VEC_ALIGNER(srcp);
-            vector unsigned char vs = (vector unsigned char) vec_ld(0, srcp);
-            width -= extrawidth;
-            while (width) {
-                vector unsigned char voverflow;
-                vector unsigned char vd;
-
-                /* s = *srcp */
-                voverflow = (vector unsigned char) vec_ld(15, srcp);
-                vs = vec_perm(vs, voverflow, valigner);
-                vs = vec_perm(vs, valpha, vsrcPermute);
-
-                /* d = *dstp */
-                vd = (vector unsigned char) vec_ld(0, dstp);
-                vd = vec_perm(vd, vd, vsdstPermute);
-
-                VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1, v8);
-
-                /* set the alpha channel to full on */
-                vd = vec_or(vd, valphamask);
-                vd = vec_perm(vd, vbits, vdstPermute);
-
-                /* *dstp = res */
-                vec_st((vector unsigned int) vd, 0, dstp);
-
-                srcp += 4;
-                dstp += 4;
-                width -= 4;
-                vs = voverflow;
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-        }
-#undef ONE_PIXEL_BLEND
-
-        srcp += srcskip;
-        dstp += dstskip;
-    }
-
-}
-
-
-/* fast RGB888->(A)RGB888 blending */
-static void
-BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
-{
-    unsigned alpha = info->a;
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    vector unsigned char mergePermute;
-    vector unsigned char valpha;
-    vector unsigned char valphamask;
-    vector unsigned short v1;
-    vector unsigned short v8;
-
-    mergePermute = VEC_MERGE_PERMUTE();
-    v1 = vec_splat_u16(1);
-    v8 = vec_splat_u16(8);
-
-    /* set the alpha to 255 on the destination surf */
-    valphamask = VEC_ALPHA_MASK();
-
-    /* set a vector full of alpha and 255-alpha */
-    ((unsigned char *) &valpha)[0] = alpha;
-    valpha = vec_splat(valpha, 0);
-
-    while (height--) {
-        int width = info->dst_w;
-#define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
-            Uint32 s = *srcp; \
-            Uint32 d = *dstp; \
-            Uint32 s1 = s & 0xff00ff; \
-            Uint32 d1 = d & 0xff00ff; \
-            d1 = (d1 + ((s1 - d1) * alpha >> 8)) \
-                 & 0xff00ff; \
-            s &= 0xff00; \
-            d &= 0xff00; \
-            d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
-            *dstp = d1 | d | 0xff000000; \
-            ++srcp; \
-            ++dstp; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        if (width > 0) {
-            int extrawidth = (width % 4);
-            vector unsigned char valigner = VEC_ALIGNER(srcp);
-            vector unsigned char vs = (vector unsigned char) vec_ld(0, srcp);
-            width -= extrawidth;
-            while (width) {
-                vector unsigned char voverflow;
-                vector unsigned char vd;
-
-                /* s = *srcp */
-                voverflow = (vector unsigned char) vec_ld(15, srcp);
-                vs = vec_perm(vs, voverflow, valigner);
-
-                /* d = *dstp */
-                vd = (vector unsigned char) vec_ld(0, dstp);
-
-                VEC_MULTIPLY_ALPHA(vs, vd, valpha, mergePermute, v1, v8);
-
-                /* set the alpha channel to full on */
-                vd = vec_or(vd, valphamask);
-
-                /* *dstp = res */
-                vec_st((vector unsigned int) vd, 0, dstp);
-
-                srcp += 4;
-                dstp += 4;
-                width -= 4;
-                vs = voverflow;
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-        }
-#undef ONE_PIXEL_BLEND
-
-        srcp += srcskip;
-        dstp += dstskip;
-    }
-}
-
-#if __MWERKS__
-#pragma altivec_model off
-#endif
-#endif /* SDL_ALTIVEC_BLITTERS */
-
 /* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
 static void
 BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
@@ -1338,79 +538,6 @@
     }
 }
 
-#ifdef __3dNOW__
-/* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
-static void
-BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
-{
-    int width = info->dst_w;
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip >> 2;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip >> 2;
-    SDL_PixelFormat *sf = info->src_fmt;
-    Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
-    Uint32 amask = sf->Amask;
-    Uint32 ashift = sf->Ashift;
-    Uint64 multmask;
-
-    __m64 src1, dst1, mm_alpha, mm_zero, dmask;
-
-    mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
-    multmask = 0xFFFF;
-    multmask <<= (ashift * 2);
-    multmask = ~multmask;
-    dmask = *(__m64 *) & multmask;      /* dst alpha mask -> dmask */
-
-    while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		Uint32 alpha;
-
-		_m_prefetch(srcp + 16);
-		_m_prefetch(dstp + 16);
-
-		alpha = *srcp & amask;
-		if (alpha == 0) {
-			/* do nothing */
-		} else if (alpha == amask) {
-			/* copy RGB, keep dst alpha */
-			*dstp = (*srcp & chanmask) | (*dstp & ~chanmask);
-		} else {
-			src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB)*/
-			src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
-
-			dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB)*/
-			dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
-
-			mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
-			mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
-			mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
-			mm_alpha = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha */
-			mm_alpha = _mm_and_si64(mm_alpha, dmask); /* 000A0A0A -> mm_alpha, preserve dst alpha on add */
-
-			/* blend */		    
-			src1 = _mm_sub_pi16(src1, dst1);/* src - dst -> src1 */
-			src1 = _mm_mullo_pi16(src1, mm_alpha); /* (src - dst) * alpha -> src1 */
-			src1 = _mm_srli_pi16(src1, 8); /* src1 >> 8 -> src1(000R0G0B) */
-			dst1 = _mm_add_pi8(src1, dst1); /* src1 + dst1(dst) -> dst1(0A0R0G0B) */
-			dst1 = _mm_packs_pu16(dst1, mm_zero);  /* 0000ARGB -> dst1 */
-			
-			*dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
-		}
-		++srcp;
-		++dstp;
-	    }, width);
-	    /* *INDENT-ON* */
-        srcp += srcskip;
-        dstp += dstskip;
-    }
-    _mm_empty();
-}
-
-#endif /* __MMX__ */
-
 /* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
 
 /* blend a single 16 bit pixel at 50% */
@@ -2130,17 +1257,10 @@
             return BlitNto1PixelAlpha;
 
         case 2:
-#if SDL_ALTIVEC_BLITTERS
-            if (sf->BytesPerPixel == 4
-                && df->Gmask == 0x7e0 && df->Bmask == 0x1f
-                && SDL_HasAltiVec())
-                return Blit32to565PixelAlphaAltivec;
-            else
-#endif
-                if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000
-                    && sf->Gmask == 0xff00
-                    && ((sf->Rmask == 0xff && df->Rmask == 0x1f)
-                        || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
+            if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000
+                && sf->Gmask == 0xff00
+                && ((sf->Rmask == 0xff && df->Rmask == 0x1f)
+                    || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
                 if (df->Gmask == 0x7e0)
                     return BlitARGBto565PixelAlpha;
                 else if (df->Gmask == 0x3e0)
@@ -2152,35 +1272,20 @@
             if (sf->Rmask == df->Rmask
                 && sf->Gmask == df->Gmask
                 && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
-#if defined(__MMX__) || defined(__3dNOW__)
+#if defined(__MMX__)
                 if (sf->Rshift % 8 == 0
                     && sf->Gshift % 8 == 0
                     && sf->Bshift % 8 == 0
                     && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
-#ifdef __3dNOW__
-                    if (SDL_Has3DNow())
-                        return BlitRGBtoRGBPixelAlphaMMX3DNOW;
-#endif
-#ifdef __MMX__
                     if (SDL_HasMMX())
                         return BlitRGBtoRGBPixelAlphaMMX;
-#endif
                 }
-#endif /* __MMX__ || __3dNOW__ */
+#endif /* __MMX__ */
                 if (sf->Amask == 0xff000000) {
-#if SDL_ALTIVEC_BLITTERS
-                    if (SDL_HasAltiVec())
-                        return BlitRGBtoRGBPixelAlphaAltivec;
-#endif
                     return BlitRGBtoRGBPixelAlpha;
                 }
             }
-#if SDL_ALTIVEC_BLITTERS
-            if (sf->Amask && sf->BytesPerPixel == 4 && SDL_HasAltiVec())
-                return Blit32to32PixelAlphaAltivec;
-            else
-#endif
-                return BlitNtoNPixelAlpha;
+            return BlitNtoNPixelAlpha;
 
         case 3:
         default:
@@ -2226,19 +1331,10 @@
                         return BlitRGBtoRGBSurfaceAlphaMMX;
 #endif
                     if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
-#if SDL_ALTIVEC_BLITTERS
-                        if (SDL_HasAltiVec())
-                            return BlitRGBtoRGBSurfaceAlphaAltivec;
-#endif
                         return BlitRGBtoRGBSurfaceAlpha;
                     }
                 }
-#if SDL_ALTIVEC_BLITTERS
-                if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
-                    return Blit32to32SurfaceAlphaAltivec;
-                else
-#endif
-                    return BlitNtoNSurfaceAlpha;
+                return BlitNtoNSurfaceAlpha;
 
             case 3:
             default:
@@ -2252,12 +1348,6 @@
             if (df->BytesPerPixel == 1)
                 return BlitNto1SurfaceAlphaKey;
             else
-#if SDL_ALTIVEC_BLITTERS
-            if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
-                    SDL_HasAltiVec())
-                return Blit32to32SurfaceAlphaKeyAltivec;
-            else
-#endif
                 return BlitNtoNSurfaceAlphaKey;
         }
         break;
--- a/src/video/SDL_blit_N.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_N.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -28,846 +28,8 @@
 
 /* Functions to blit from N-bit surfaces to other surfaces */
 
-#if SDL_ALTIVEC_BLITTERS
-#if __MWERKS__
-#pragma altivec_model on
-#endif
-#ifdef HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-#define assert(X)
-#ifdef __MACOSX__
-#include <sys/sysctl.h>
-static size_t
-GetL3CacheSize(void)
-{
-    const char key[] = "hw.l3cachesize";
-    u_int64_t result = 0;
-    size_t typeSize = sizeof(result);
-
-
-    int err = sysctlbyname(key, &result, &typeSize, NULL, 0);
-    if (0 != err)
-        return 0;
-
-    return result;
-}
-#else
-static size_t
-GetL3CacheSize(void)
-{
-    /* XXX: Just guess G4 */
-    return 2097152;
-}
-#endif /* __MACOSX__ */
-
-#if (defined(__MACOSX__) && (__GNUC__ < 4))
-#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
-        (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )
-#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
-        (vector unsigned short) ( a,b,c,d,e,f,g,h )
-#else
-#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
-        (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p }
-#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
-        (vector unsigned short) { a,b,c,d,e,f,g,h }
-#endif
-
-#define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F)
-#define VSWIZZLE32(a,b,c,d) (vector unsigned char) \
-                               ( 0x00+a, 0x00+b, 0x00+c, 0x00+d, \
-                                 0x04+a, 0x04+b, 0x04+c, 0x04+d, \
-                                 0x08+a, 0x08+b, 0x08+c, 0x08+d, \
-                                 0x0C+a, 0x0C+b, 0x0C+c, 0x0C+d )
-
-#define MAKE8888(dstfmt, r, g, b, a)  \
-    ( ((r<<dstfmt->Rshift)&dstfmt->Rmask) | \
-      ((g<<dstfmt->Gshift)&dstfmt->Gmask) | \
-      ((b<<dstfmt->Bshift)&dstfmt->Bmask) | \
-      ((a<<dstfmt->Ashift)&dstfmt->Amask) )
-
-/*
- * Data Stream Touch...Altivec cache prefetching.
- *
- *  Don't use this on a G5...however, the speed boost is very significant
- *   on a G4.
- */
-#define DST_CHAN_SRC 1
-#define DST_CHAN_DEST 2
-
-/* macro to set DST control word value... */
-#define DST_CTRL(size, count, stride) \
-    (((size) << 24) | ((count) << 16) | (stride))
-
-#define VEC_ALIGNER(src) ((UNALIGNED_PTR(src)) \
-    ? vec_lvsl(0, src) \
-    : vec_add(vec_lvsl(8, src), vec_splat_u8(8)))
-
-/* Calculate the permute vector used for 32->32 swizzling */
-static vector unsigned char
-calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt)
-{
-    /*
-     * We have to assume that the bits that aren't used by other
-     *  colors is alpha, and it's one complete byte, since some formats
-     *  leave alpha with a zero mask, but we should still swizzle the bits.
-     */
-    /* ARGB */
-    const static const struct SDL_PixelFormat default_pixel_format = {
-        NULL, 32, 4,
-        0, 0, 0, 0,
-        16, 8, 0, 24,
-        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
-    };
-    if (!srcfmt) {
-        srcfmt = &default_pixel_format;
-    }
-    if (!dstfmt) {
-        dstfmt = &default_pixel_format;
-    }
-    const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
-                                                       0x04, 0x04, 0x04, 0x04,
-                                                       0x08, 0x08, 0x08, 0x08,
-                                                       0x0C, 0x0C, 0x0C,
-                                                       0x0C);
-    vector unsigned char vswiz;
-    vector unsigned int srcvec;
-#define RESHIFT(X) (3 - ((X) >> 3))
-    Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
-    Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
-    Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
-    Uint32 amask;
-    /* Use zero for alpha if either surface doesn't have alpha */
-    if (dstfmt->Amask) {
-        amask =
-            ((srcfmt->Amask) ? RESHIFT(srcfmt->
-                                       Ashift) : 0x10) << (dstfmt->Ashift);
-    } else {
-        amask =
-            0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^
-                          0xFFFFFFFF);
-    }
-#undef RESHIFT
-    ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask);
-    vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0));
-    return (vswiz);
-}
-
-static void Blit_RGB888_RGB565(SDL_BlitInfo * info);
-static void
-Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint8 *src = (Uint8 *) info->src;
-    int srcskip = info->src_skip;
-    Uint8 *dst = (Uint8 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    vector unsigned char valpha = vec_splat_u8(0);
-    vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
-    vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
-                                                    0x00, 0x0a, 0x00, 0x0e,
-                                                    0x00, 0x12, 0x00, 0x16,
-                                                    0x00, 0x1a, 0x00, 0x1e);
-    vector unsigned short v1 = vec_splat_u16(1);
-    vector unsigned short v3 = vec_splat_u16(3);
-    vector unsigned short v3f =
-        VECUINT16_LITERAL(0x003f, 0x003f, 0x003f, 0x003f,
-                          0x003f, 0x003f, 0x003f, 0x003f);
-    vector unsigned short vfc =
-        VECUINT16_LITERAL(0x00fc, 0x00fc, 0x00fc, 0x00fc,
-                          0x00fc, 0x00fc, 0x00fc, 0x00fc);
-    vector unsigned short vf800 = (vector unsigned short) vec_splat_u8(-7);
-    vf800 = vec_sl(vf800, vec_splat_u16(8));
-
-    while (height--) {
-        vector unsigned char valigner;
-        vector unsigned char voverflow;
-        vector unsigned char vsrc;
-
-        int width = info->dst_w;
-        int extrawidth;
-
-        /* do scalar until we can align... */
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while (condition) { \
-            Uint32 Pixel; \
-            unsigned sR, sG, sB, sA; \
-            DISEMBLE_RGBA((Uint8 *)src, 4, srcfmt, Pixel, \
-                          sR, sG, sB, sA); \
-            *(Uint16 *)(dst) = (((sR << 8) & 0x0000F800) | \
-                                ((sG << 3) & 0x000007E0) | \
-                                ((sB >> 3) & 0x0000001F)); \
-            dst += 2; \
-            src += 4; \
-            widthvar--; \
-        }
-
-        ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
-
-        /* After all that work, here's the vector part! */
-        extrawidth = (width % 8);       /* trailing unaligned stores */
-        width -= extrawidth;
-        vsrc = vec_ld(0, src);
-        valigner = VEC_ALIGNER(src);
-
-        while (width) {
-            vector unsigned short vpixel, vrpixel, vgpixel, vbpixel;
-            vector unsigned int vsrc1, vsrc2;
-            vector unsigned char vdst;
-
-            voverflow = vec_ld(15, src);
-            vsrc = vec_perm(vsrc, voverflow, valigner);
-            vsrc1 = (vector unsigned int) vec_perm(vsrc, valpha, vpermute);
-            src += 16;
-            vsrc = voverflow;
-            voverflow = vec_ld(15, src);
-            vsrc = vec_perm(vsrc, voverflow, valigner);
-            vsrc2 = (vector unsigned int) vec_perm(vsrc, valpha, vpermute);
-            /* 1555 */
-            vpixel = (vector unsigned short) vec_packpx(vsrc1, vsrc2);
-            vgpixel = (vector unsigned short) vec_perm(vsrc1, vsrc2, vgmerge);
-            vgpixel = vec_and(vgpixel, vfc);
-            vgpixel = vec_sl(vgpixel, v3);
-            vrpixel = vec_sl(vpixel, v1);
-            vrpixel = vec_and(vrpixel, vf800);
-            vbpixel = vec_and(vpixel, v3f);
-            vdst =
-                vec_or((vector unsigned char) vrpixel,
-                       (vector unsigned char) vgpixel);
-            /* 565 */
-            vdst = vec_or(vdst, (vector unsigned char) vbpixel);
-            vec_st(vdst, 0, dst);
-
-            width -= 8;
-            src += 16;
-            dst += 16;
-            vsrc = voverflow;
-        }
-
-        assert(width == 0);
-
-        /* do scalar until we can align... */
-        ONE_PIXEL_BLEND((extrawidth), extrawidth);
-#undef ONE_PIXEL_BLEND
-
-        src += srcskip;         /* move to next row, accounting for pitch. */
-        dst += dstskip;
-    }
-
-
-}
-
-static void
-Blit_RGB565_32Altivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint8 *src = (Uint8 *) info->src;
-    int srcskip = info->src_skip;
-    Uint8 *dst = (Uint8 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    unsigned alpha;
-    vector unsigned char valpha;
-    vector unsigned char vpermute;
-    vector unsigned short vf800;
-    vector unsigned int v8 = vec_splat_u32(8);
-    vector unsigned int v16 = vec_add(v8, v8);
-    vector unsigned short v2 = vec_splat_u16(2);
-    vector unsigned short v3 = vec_splat_u16(3);
-    /* 
-       0x10 - 0x1f is the alpha
-       0x00 - 0x0e evens are the red
-       0x01 - 0x0f odds are zero
-     */
-    vector unsigned char vredalpha1 = VECUINT8_LITERAL(0x10, 0x00, 0x01, 0x01,
-                                                       0x10, 0x02, 0x01, 0x01,
-                                                       0x10, 0x04, 0x01, 0x01,
-                                                       0x10, 0x06, 0x01,
-                                                       0x01);
-    vector unsigned char vredalpha2 =
-        (vector unsigned
-         char) (vec_add((vector unsigned int) vredalpha1, vec_sl(v8, v16))
-        );
-    /*
-       0x00 - 0x0f is ARxx ARxx ARxx ARxx
-       0x11 - 0x0f odds are blue
-     */
-    vector unsigned char vblue1 = VECUINT8_LITERAL(0x00, 0x01, 0x02, 0x11,
-                                                   0x04, 0x05, 0x06, 0x13,
-                                                   0x08, 0x09, 0x0a, 0x15,
-                                                   0x0c, 0x0d, 0x0e, 0x17);
-    vector unsigned char vblue2 =
-        (vector unsigned char) (vec_add((vector unsigned int) vblue1, v8)
-        );
-    /*
-       0x00 - 0x0f is ARxB ARxB ARxB ARxB
-       0x10 - 0x0e evens are green
-     */
-    vector unsigned char vgreen1 = VECUINT8_LITERAL(0x00, 0x01, 0x10, 0x03,
-                                                    0x04, 0x05, 0x12, 0x07,
-                                                    0x08, 0x09, 0x14, 0x0b,
-                                                    0x0c, 0x0d, 0x16, 0x0f);
-    vector unsigned char vgreen2 =
-        (vector unsigned
-         char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
-        );
-
-
-    assert(srcfmt->BytesPerPixel == 2);
-    assert(dstfmt->BytesPerPixel == 4);
-
-    vf800 = (vector unsigned short) vec_splat_u8(-7);
-    vf800 = vec_sl(vf800, vec_splat_u16(8));
-
-    if (dstfmt->Amask && info->a) {
-        ((unsigned char *) &valpha)[0] = alpha = info->a;
-        valpha = vec_splat(valpha, 0);
-    } else {
-        alpha = 0;
-        valpha = vec_splat_u8(0);
-    }
-
-    vpermute = calc_swizzle32(NULL, dstfmt);
-    while (height--) {
-        vector unsigned char valigner;
-        vector unsigned char voverflow;
-        vector unsigned char vsrc;
-
-        int width = info->dst_w;
-        int extrawidth;
-
-        /* do scalar until we can align... */
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while (condition) { \
-            unsigned sR, sG, sB; \
-            unsigned short Pixel = *((unsigned short *)src); \
-            sR = (Pixel >> 8) & 0xf8; \
-            sG = (Pixel >> 3) & 0xfc; \
-            sB = (Pixel << 3) & 0xf8; \
-            ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
-            src += 2; \
-            dst += 4; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
-
-        /* After all that work, here's the vector part! */
-        extrawidth = (width % 8);       /* trailing unaligned stores */
-        width -= extrawidth;
-        vsrc = vec_ld(0, src);
-        valigner = VEC_ALIGNER(src);
-
-        while (width) {
-            vector unsigned short vR, vG, vB;
-            vector unsigned char vdst1, vdst2;
-
-            voverflow = vec_ld(15, src);
-            vsrc = vec_perm(vsrc, voverflow, valigner);
-
-            vR = vec_and((vector unsigned short) vsrc, vf800);
-            vB = vec_sl((vector unsigned short) vsrc, v3);
-            vG = vec_sl(vB, v2);
-
-            vdst1 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                valpha, vredalpha1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vB, vblue1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vG, vgreen1);
-            vdst1 = vec_perm(vdst1, valpha, vpermute);
-            vec_st(vdst1, 0, dst);
-
-            vdst2 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                valpha, vredalpha2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vB, vblue2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vG, vgreen2);
-            vdst2 = vec_perm(vdst2, valpha, vpermute);
-            vec_st(vdst2, 16, dst);
-
-            width -= 8;
-            dst += 32;
-            src += 16;
-            vsrc = voverflow;
-        }
-
-        assert(width == 0);
-
-
-        /* do scalar until we can align... */
-        ONE_PIXEL_BLEND((extrawidth), extrawidth);
-#undef ONE_PIXEL_BLEND
-
-        src += srcskip;         /* move to next row, accounting for pitch. */
-        dst += dstskip;
-    }
-
-}
-
-
-static void
-Blit_RGB555_32Altivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint8 *src = (Uint8 *) info->src;
-    int srcskip = info->src_skip;
-    Uint8 *dst = (Uint8 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    unsigned alpha;
-    vector unsigned char valpha;
-    vector unsigned char vpermute;
-    vector unsigned short vf800;
-    vector unsigned int v8 = vec_splat_u32(8);
-    vector unsigned int v16 = vec_add(v8, v8);
-    vector unsigned short v1 = vec_splat_u16(1);
-    vector unsigned short v3 = vec_splat_u16(3);
-    /* 
-       0x10 - 0x1f is the alpha
-       0x00 - 0x0e evens are the red
-       0x01 - 0x0f odds are zero
-     */
-    vector unsigned char vredalpha1 = VECUINT8_LITERAL(0x10, 0x00, 0x01, 0x01,
-                                                       0x10, 0x02, 0x01, 0x01,
-                                                       0x10, 0x04, 0x01, 0x01,
-                                                       0x10, 0x06, 0x01,
-                                                       0x01);
-    vector unsigned char vredalpha2 =
-        (vector unsigned
-         char) (vec_add((vector unsigned int) vredalpha1, vec_sl(v8, v16))
-        );
-    /*
-       0x00 - 0x0f is ARxx ARxx ARxx ARxx
-       0x11 - 0x0f odds are blue
-     */
-    vector unsigned char vblue1 = VECUINT8_LITERAL(0x00, 0x01, 0x02, 0x11,
-                                                   0x04, 0x05, 0x06, 0x13,
-                                                   0x08, 0x09, 0x0a, 0x15,
-                                                   0x0c, 0x0d, 0x0e, 0x17);
-    vector unsigned char vblue2 =
-        (vector unsigned char) (vec_add((vector unsigned int) vblue1, v8)
-        );
-    /*
-       0x00 - 0x0f is ARxB ARxB ARxB ARxB
-       0x10 - 0x0e evens are green
-     */
-    vector unsigned char vgreen1 = VECUINT8_LITERAL(0x00, 0x01, 0x10, 0x03,
-                                                    0x04, 0x05, 0x12, 0x07,
-                                                    0x08, 0x09, 0x14, 0x0b,
-                                                    0x0c, 0x0d, 0x16, 0x0f);
-    vector unsigned char vgreen2 =
-        (vector unsigned
-         char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
-        );
-
-
-    assert(srcfmt->BytesPerPixel == 2);
-    assert(dstfmt->BytesPerPixel == 4);
-
-    vf800 = (vector unsigned short) vec_splat_u8(-7);
-    vf800 = vec_sl(vf800, vec_splat_u16(8));
-
-    if (dstfmt->Amask && info->a) {
-        ((unsigned char *) &valpha)[0] = alpha = info->a;
-        valpha = vec_splat(valpha, 0);
-    } else {
-        alpha = 0;
-        valpha = vec_splat_u8(0);
-    }
-
-    vpermute = calc_swizzle32(NULL, dstfmt);
-    while (height--) {
-        vector unsigned char valigner;
-        vector unsigned char voverflow;
-        vector unsigned char vsrc;
-
-        int width = info->dst_w;
-        int extrawidth;
-
-        /* do scalar until we can align... */
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        while (condition) { \
-            unsigned sR, sG, sB; \
-            unsigned short Pixel = *((unsigned short *)src); \
-            sR = (Pixel >> 7) & 0xf8; \
-            sG = (Pixel >> 2) & 0xf8; \
-            sB = (Pixel << 3) & 0xf8; \
-            ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
-            src += 2; \
-            dst += 4; \
-            widthvar--; \
-        }
-        ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
-
-        /* After all that work, here's the vector part! */
-        extrawidth = (width % 8);       /* trailing unaligned stores */
-        width -= extrawidth;
-        vsrc = vec_ld(0, src);
-        valigner = VEC_ALIGNER(src);
-
-        while (width) {
-            vector unsigned short vR, vG, vB;
-            vector unsigned char vdst1, vdst2;
-
-            voverflow = vec_ld(15, src);
-            vsrc = vec_perm(vsrc, voverflow, valigner);
-
-            vR = vec_and(vec_sl((vector unsigned short) vsrc, v1), vf800);
-            vB = vec_sl((vector unsigned short) vsrc, v3);
-            vG = vec_sl(vB, v3);
-
-            vdst1 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                valpha, vredalpha1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vB, vblue1);
-            vdst1 = vec_perm(vdst1, (vector unsigned char) vG, vgreen1);
-            vdst1 = vec_perm(vdst1, valpha, vpermute);
-            vec_st(vdst1, 0, dst);
-
-            vdst2 =
-                (vector unsigned char) vec_perm((vector unsigned char) vR,
-                                                valpha, vredalpha2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vB, vblue2);
-            vdst2 = vec_perm(vdst2, (vector unsigned char) vG, vgreen2);
-            vdst2 = vec_perm(vdst2, valpha, vpermute);
-            vec_st(vdst2, 16, dst);
-
-            width -= 8;
-            dst += 32;
-            src += 16;
-            vsrc = voverflow;
-        }
-
-        assert(width == 0);
-
-
-        /* do scalar until we can align... */
-        ONE_PIXEL_BLEND((extrawidth), extrawidth);
-#undef ONE_PIXEL_BLEND
-
-        src += srcskip;         /* move to next row, accounting for pitch. */
-        dst += dstskip;
-    }
-
-}
-
-static void BlitNtoNKey(SDL_BlitInfo * info);
-static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info);
-static void
-Blit32to32KeyAltivec(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip / 4;
-    Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip / 4;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    int srcbpp = srcfmt->BytesPerPixel;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    int dstbpp = dstfmt->BytesPerPixel;
-    int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
-    unsigned alpha = dstfmt->Amask ? info->a : 0;
-    Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
-    Uint32 ckey = info->colorkey;
-    vector unsigned int valpha;
-    vector unsigned char vpermute;
-    vector unsigned char vzero;
-    vector unsigned int vckey;
-    vector unsigned int vrgbmask;
-    vpermute = calc_swizzle32(srcfmt, dstfmt);
-    if (info->dst_w < 16) {
-        if (copy_alpha) {
-            BlitNtoNKeyCopyAlpha(info);
-        } else {
-            BlitNtoNKey(info);
-        }
-        return;
-    }
-    vzero = vec_splat_u8(0);
-    if (alpha) {
-        ((unsigned char *) &valpha)[0] = (unsigned char) alpha;
-        valpha =
-            (vector unsigned int) vec_splat((vector unsigned char) valpha, 0);
-    } else {
-        valpha = (vector unsigned int) vzero;
-    }
-    ckey &= rgbmask;
-    ((unsigned int *) (char *) &vckey)[0] = ckey;
-    vckey = vec_splat(vckey, 0);
-    ((unsigned int *) (char *) &vrgbmask)[0] = rgbmask;
-    vrgbmask = vec_splat(vrgbmask, 0);
-
-    while (height--) {
-#define ONE_PIXEL_BLEND(condition, widthvar) \
-        if (copy_alpha) { \
-            while (condition) { \
-                Uint32 Pixel; \
-                unsigned sR, sG, sB, sA; \
-                DISEMBLE_RGBA((Uint8 *)srcp, srcbpp, srcfmt, Pixel, \
-                          sR, sG, sB, sA); \
-                if ( (Pixel & rgbmask) != ckey ) { \
-                      ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
-                            sR, sG, sB, sA); \
-                } \
-                dstp = (Uint32 *) (((Uint8 *) dstp) + dstbpp); \
-                srcp = (Uint32 *) (((Uint8 *) srcp) + srcbpp); \
-                widthvar--; \
-            } \
-        } else { \
-            while (condition) { \
-                Uint32 Pixel; \
-                unsigned sR, sG, sB; \
-                RETRIEVE_RGB_PIXEL((Uint8 *)srcp, srcbpp, Pixel); \
-                if ( Pixel != ckey ) { \
-                    RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \
-                    ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
-                              sR, sG, sB, alpha); \
-                } \
-                dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \
-                srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \
-                widthvar--; \
-            } \
-        }
-        int width = info->dst_w;
-        ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
-        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);
-            while (width) {
-                vector unsigned char vsel;
-                vector unsigned int vd;
-                vector unsigned int voverflow = vec_ld(15, srcp);
-                /* load the source vec */
-                vs = vec_perm(vs, voverflow, valigner);
-                /* vsel is set for items that match the key */
-                vsel = (vector unsigned char) vec_and(vs, vrgbmask);
-                vsel = (vector unsigned char) vec_cmpeq(vs, vckey);
-                /* permute the src vec to the dest format */
-                vs = vec_perm(vs, valpha, vpermute);
-                /* load the destination vec */
-                vd = vec_ld(0, dstp);
-                /* select the source and dest into vs */
-                vd = (vector unsigned int) vec_sel((vector unsigned char) vs,
-                                                   (vector unsigned char) vd,
-                                                   vsel);
-
-                vec_st(vd, 0, dstp);
-                srcp += 4;
-                width -= 4;
-                dstp += 4;
-                vs = voverflow;
-            }
-            ONE_PIXEL_BLEND((extrawidth), extrawidth);
-#undef ONE_PIXEL_BLEND
-            srcp += srcskip;
-            dstp += dstskip;
-        }
-    }
-}
-
-/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
-/* Use this on a G5 */
-static void
-ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
-{
-    int height = info->dst_h;
-    Uint32 *src = (Uint32 *) info->src;
-    int srcskip = info->src_skip / 4;
-    Uint32 *dst = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip / 4;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    vector unsigned int vzero = vec_splat_u32(0);
-    vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
-    if (dstfmt->Amask && !srcfmt->Amask) {
-        if (info->a) {
-            vector unsigned char valpha;
-            ((unsigned char *) &valpha)[0] = info->a;
-            vzero = (vector unsigned int) vec_splat(valpha, 0);
-        }
-    }
-
-    assert(srcfmt->BytesPerPixel == 4);
-    assert(dstfmt->BytesPerPixel == 4);
-
-    while (height--) {
-        vector unsigned char valigner;
-        vector unsigned int vbits;
-        vector unsigned int voverflow;
-        Uint32 bits;
-        Uint8 r, g, b, a;
-
-        int width = info->dst_w;
-        int extrawidth;
-
-        /* do scalar until we can align... */
-        while ((UNALIGNED_PTR(dst)) && (width)) {
-            bits = *(src++);
-            RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
-            *(dst++) = MAKE8888(dstfmt, r, g, b, a);
-            width--;
-        }
-
-        /* After all that work, here's the vector part! */
-        extrawidth = (width % 4);
-        width -= extrawidth;
-        valigner = VEC_ALIGNER(src);
-        vbits = vec_ld(0, src);
-
-        while (width) {
-            voverflow = vec_ld(15, src);
-            src += 4;
-            width -= 4;
-            vbits = vec_perm(vbits, voverflow, valigner);       /* src is ready. */
-            vbits = vec_perm(vbits, vzero, vpermute);   /* swizzle it. */
-            vec_st(vbits, 0, dst);      /* store it back out. */
-            dst += 4;
-            vbits = voverflow;
-        }
-
-        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);
-            *(dst++) = MAKE8888(dstfmt, r, g, b, a);
-            extrawidth--;
-        }
-
-        src += srcskip;
-        dst += dstskip;
-    }
-
-}
-
-/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
-/* Use this on a G4 */
-static void
-ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
-{
-    const int scalar_dst_lead = sizeof(Uint32) * 4;
-    const int vector_dst_lead = sizeof(Uint32) * 16;
-
-    int height = info->dst_h;
-    Uint32 *src = (Uint32 *) info->src;
-    int srcskip = info->src_skip / 4;
-    Uint32 *dst = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip / 4;
-    SDL_PixelFormat *srcfmt = info->src_fmt;
-    SDL_PixelFormat *dstfmt = info->dst_fmt;
-    vector unsigned int vzero = vec_splat_u32(0);
-    vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
-    if (dstfmt->Amask && !srcfmt->Amask) {
-        if (info->a) {
-            vector unsigned char valpha;
-            ((unsigned char *) &valpha)[0] = info->a;
-            vzero = (vector unsigned int) vec_splat(valpha, 0);
-        }
-    }
-
-    assert(srcfmt->BytesPerPixel == 4);
-    assert(dstfmt->BytesPerPixel == 4);
-
-    while (height--) {
-        vector unsigned char valigner;
-        vector unsigned int vbits;
-        vector unsigned int voverflow;
-        Uint32 bits;
-        Uint8 r, g, b, a;
-
-        int width = info->dst_w;
-        int extrawidth;
-
-        /* do scalar until we can align... */
-        while ((UNALIGNED_PTR(dst)) && (width)) {
-            vec_dstt(src + scalar_dst_lead, DST_CTRL(2, 32, 1024),
-                     DST_CHAN_SRC);
-            vec_dstst(dst + scalar_dst_lead, DST_CTRL(2, 32, 1024),
-                      DST_CHAN_DEST);
-            bits = *(src++);
-            RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
-            *(dst++) = MAKE8888(dstfmt, r, g, b, a);
-            width--;
-        }
-
-        /* After all that work, here's the vector part! */
-        extrawidth = (width % 4);
-        width -= extrawidth;
-        valigner = VEC_ALIGNER(src);
-        vbits = vec_ld(0, src);
-
-        while (width) {
-            vec_dstt(src + vector_dst_lead, DST_CTRL(2, 32, 1024),
-                     DST_CHAN_SRC);
-            vec_dstst(dst + vector_dst_lead, DST_CTRL(2, 32, 1024),
-                      DST_CHAN_DEST);
-            voverflow = vec_ld(15, src);
-            src += 4;
-            width -= 4;
-            vbits = vec_perm(vbits, voverflow, valigner);       /* src is ready. */
-            vbits = vec_perm(vbits, vzero, vpermute);   /* swizzle it. */
-            vec_st(vbits, 0, dst);      /* store it back out. */
-            dst += 4;
-            vbits = voverflow;
-        }
-
-        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);
-            *(dst++) = MAKE8888(dstfmt, r, g, b, a);
-            extrawidth--;
-        }
-
-        src += srcskip;
-        dst += dstskip;
-    }
-
-    vec_dss(DST_CHAN_SRC);
-    vec_dss(DST_CHAN_DEST);
-}
-
-static Uint32
-GetBlitFeatures(void)
-{
-    static Uint32 features = 0xffffffff;
-    if (features == 0xffffffff) {
-        /* Provide an override for testing .. */
-        char *override = SDL_getenv("SDL_ALTIVEC_BLIT_FEATURES");
-        if (override) {
-            features = 0;
-            SDL_sscanf(override, "%u", &features);
-        } else {
-            features = (0
-                        /* Feature 1 is has-MMX */
-                        | ((SDL_HasMMX())? 1 : 0)
-                        /* Feature 2 is has-AltiVec */
-                        | ((SDL_HasAltiVec())? 2 : 0)
-                        /* Feature 4 is dont-use-prefetch */
-                        /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */
-                        | ((GetL3CacheSize() == 0) ? 4 : 0)
-                );
-        }
-    }
-    return features;
-}
-
-#if __MWERKS__
-#pragma altivec_model off
-#endif
-#else
 /* Feature 1 is has-MMX */
 #define GetBlitFeatures() ((Uint32)(SDL_HasMMX() ? 1 : 0))
-#endif
 
 /* This is now endian dependent */
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
@@ -2346,15 +1508,6 @@
 };
 
 static const struct blit_table normal_blit_2[] = {
-#if SDL_ALTIVEC_BLITTERS
-    /* has-altivec */
-    {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000,
-     0x00000000,
-     2, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
-    {0x00007C00, 0x000003E0, 0x0000001F, 4, 0x00000000, 0x00000000,
-     0x00000000,
-     2, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
-#endif
     {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00FF0000, 0x0000FF00,
      0x000000FF,
      0, Blit_RGB565_ARGB8888, SET_ALPHA},
@@ -2378,22 +1531,6 @@
 };
 
 static const struct blit_table normal_blit_4[] = {
-#if SDL_ALTIVEC_BLITTERS
-    /* has-altivec | dont-use-prefetch */
-    {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000,
-     0x00000000,
-     6, ConvertAltivec32to32_noprefetch,
-     NO_ALPHA | COPY_ALPHA | SET_ALPHA},
-    /* has-altivec */
-    {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000,
-     0x00000000,
-     2, ConvertAltivec32to32_prefetch,
-     NO_ALPHA | COPY_ALPHA | SET_ALPHA},
-    /* has-altivec */
-    {0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0,
-     0x0000001F,
-     2, Blit_RGB888_RGB565Altivec, NO_ALPHA},
-#endif
     {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x0000F800, 0x000007E0,
      0x0000001F,
      0, Blit_RGB888_RGB565, NO_ALPHA},
@@ -2491,12 +1628,6 @@
         else if (dstfmt->BytesPerPixel == 1)
             return BlitNto1Key;
         else {
-#if SDL_ALTIVEC_BLITTERS
-            if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
-                && SDL_HasAltiVec()) {
-                return Blit32to32KeyAltivec;
-            } else
-#endif
             if (srcfmt->Amask && dstfmt->Amask) {
                 return BlitNtoNKeyCopyAlpha;
             } else {
--- a/src/video/SDL_blit_copy.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_copy.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit_copy.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_copy.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit_slow.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_slow.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_blit_slow.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_blit_slow.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_bmp.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_bmp.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_clipboard.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_clipboard.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_fillrect.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_fillrect.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_gamma.c	Sun Feb 06 23:48:31 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +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
-*/
-#include "SDL_config.h"
-
-/* Gamma correction support */
-
-#include "SDL_sysvideo.h"
-
-
-static void
-CalculateGammaRamp(float gamma, Uint16 * ramp)
-{
-    int i;
-
-    /* 0.0 gamma is all black */
-    if (gamma <= 0.0f) {
-        for (i = 0; i < 256; ++i) {
-            ramp[i] = 0;
-        }
-        return;
-    } else
-        /* 1.0 gamma is identity */
-    if (gamma == 1.0f) {
-        for (i = 0; i < 256; ++i) {
-            ramp[i] = (i << 8) | i;
-        }
-        return;
-    } else
-        /* Calculate a real gamma ramp */
-    {
-        int value;
-        gamma = 1.0f / gamma;
-        for (i = 0; i < 256; ++i) {
-            value =
-                (int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
-            if (value > 65535) {
-                value = 65535;
-            }
-            ramp[i] = (Uint16) value;
-        }
-    }
-}
-
-static void
-CalculateGammaFromRamp(float *gamma, Uint16 * ramp)
-{
-    /* The following is adapted from a post by Garrett Bass on OpenGL
-       Gamedev list, March 4, 2000.
-     */
-    float sum = 0.0f;
-    int i, count = 0;
-
-    *gamma = 1.0;
-    for (i = 1; i < 256; ++i) {
-        if ((ramp[i] != 0) && (ramp[i] != 65535)) {
-            double B = (double) i / 256.0;
-            double A = ramp[i] / 65535.0;
-            sum += (float) (SDL_log(A) / SDL_log(B));
-            count++;
-        }
-    }
-    if (count && sum > 0.0f) {
-        *gamma = 1.0f / (sum / count);
-    }
-}
-
-int
-SDL_SetGamma(float red, float green, float blue)
-{
-    Uint16 ramp[3][256];
-
-    CalculateGammaRamp(red, ramp[0]);
-    CalculateGammaRamp(green, ramp[1]);
-    CalculateGammaRamp(blue, ramp[2]);
-
-    return SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]);
-}
-
-/* Calculating the gamma by integrating the gamma ramps isn't exact,
-   so this function isn't officially supported.
-*/
-int
-SDL_GetGamma(float *red, float *green, float *blue)
-{
-    int succeeded;
-    Uint16 ramp[3][256];
-
-    succeeded = SDL_GetGammaRamp(ramp[0], ramp[1], ramp[2]);
-    if (succeeded >= 0) {
-        CalculateGammaFromRamp(red, ramp[0]);
-        CalculateGammaFromRamp(green, ramp[1]);
-        CalculateGammaFromRamp(blue, ramp[2]);
-    }
-    return succeeded;
-}
-
-static void
-SDL_UninitializedVideo()
-{
-    SDL_SetError("Video subsystem has not been initialized");
-}
-
-int
-SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue)
-{
-    SDL_VideoDevice *_this = SDL_GetVideoDevice();
-    int succeeded;
-
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-
-    /* Lazily allocate the gamma tables */
-    if (!display->gamma) {
-        if (SDL_GetGammaRampForDisplay(display, NULL, NULL, NULL) < 0) {
-            return -1;
-        }
-    }
-
-    /* Fill the gamma table with the new values */
-    if (red) {
-        SDL_memcpy(&display->gamma[0 * 256], red, 256 * sizeof(*display->gamma));
-    }
-    if (green) {
-        SDL_memcpy(&display->gamma[1 * 256], green, 256 * sizeof(*display->gamma));
-    }
-    if (blue) {
-        SDL_memcpy(&display->gamma[2 * 256], blue, 256 * sizeof(*display->gamma));
-    }
-
-    /* Try to set the gamma ramp in the driver */
-    succeeded = -1;
-    if (_this && _this->SetDisplayGammaRamp) {
-        if (SDL_GetFocusWindow()) {
-            succeeded =
-                _this->SetDisplayGammaRamp(_this, display, display->gamma);
-        } else {
-            succeeded = 0;
-        }
-    } else {
-        SDL_SetError("Gamma ramp manipulation not supported");
-    }
-    return succeeded;
-}
-
-int
-SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
-{
-    SDL_VideoDevice *_this = SDL_GetVideoDevice();
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-    return SDL_SetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue);
-}
-
-int
-SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue)
-{
-    SDL_VideoDevice *_this = SDL_GetVideoDevice();
-
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-
-    /* Lazily allocate the gamma table */
-    if (!display->gamma) {
-        size_t rampsize = (3 * 256 * sizeof(*display->gamma));
-
-        display->gamma = SDL_malloc(rampsize * 2);
-        if (!display->gamma) {
-            SDL_OutOfMemory();
-            return -1;
-        }
-        if (_this && _this->GetDisplayGammaRamp) {
-            /* Get the real hardware gamma */
-            _this->GetDisplayGammaRamp(_this, display, display->gamma);
-        } else {
-            /* Assume an identity gamma */
-            int i;
-            for (i = 0; i < 256; ++i) {
-                display->gamma[0 * 256 + i] = (i << 8) | i;
-                display->gamma[1 * 256 + i] = (i << 8) | i;
-                display->gamma[2 * 256 + i] = (i << 8) | i;
-            }
-        }
-        display->saved_gamma = display->gamma + (3 * 256);
-        SDL_memcpy(display->saved_gamma, display->gamma, rampsize);
-    }
-
-    /* Just copy from our internal table */
-    if (red) {
-        SDL_memcpy(red, &display->gamma[0 * 256], 256 * sizeof(*red));
-    }
-    if (green) {
-        SDL_memcpy(green, &display->gamma[1 * 256], 256 * sizeof(*green));
-    }
-    if (blue) {
-        SDL_memcpy(blue, &display->gamma[2 * 256], 256 * sizeof(*blue));
-    }
-    return 0;
-}
-
-int
-SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
-{
-    SDL_VideoDevice *_this = SDL_GetVideoDevice();
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-    return SDL_GetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue);
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_leaks.h	Sun Feb 06 23:48:31 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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
-*/
-#include "SDL_config.h"
-
-/* Define this if you want surface leak detection code enabled */
-/*#define CHECK_LEAKS*/
-
-/* Global variables used to check leaks in code using SDL */
-
-#ifdef CHECK_LEAKS
-extern int surfaces_allocated;
-#endif
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_pixels.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_pixels.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -764,20 +764,6 @@
     }
 }
 
-/* Apply gamma to a set of colors - this is easy. :) */
-void
-SDL_ApplyGamma(Uint16 * gamma, SDL_Color * colors, SDL_Color * output,
-               int ncolors)
-{
-    int i;
-
-    for (i = 0; i < ncolors; ++i) {
-        output[i].r = gamma[0 * 256 + colors[i].r] >> 8;
-        output[i].g = gamma[1 * 256 + colors[i].g] >> 8;
-        output[i].b = gamma[2 * 256 + colors[i].b] >> 8;
-    }
-}
-
 /* Map from Palette to Palette */
 static Uint8 *
 Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
--- a/src/video/SDL_pixels_c.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_pixels_c.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -45,7 +45,5 @@
 extern int SDL_CalculatePitch(SDL_Surface * surface);
 extern void SDL_DitherColors(SDL_Color * colors, int bpp);
 extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b);
-extern void SDL_ApplyGamma(Uint16 * gamma, SDL_Color * colors,
-                           SDL_Color * output, int ncolors);
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_rect.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_rect.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_shape.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_shape.c	Sat Feb 12 19:16:09 2011 -0800
@@ -35,7 +35,7 @@
     SDL_Window *result = NULL;
     result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /*& (~SDL_WINDOW_SHOWN)*/);
     if(result != NULL) {
-        result->shaper = result->display->device->shape_driver.CreateShaper(result);
+        result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
         if(result->shaper != NULL) {
             result->shaper->userx = x;
             result->shaper->usery = y;
@@ -240,7 +240,7 @@
     
     if(shape_mode != NULL)
         window->shaper->mode = *shape_mode;
-    result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
+    result = SDL_GetVideoDevice()->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
     window->shaper->hasshape = SDL_TRUE;
     if(window->shaper->userx != 0 && window->shaper->usery != 0) {
         SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
--- a/src/video/SDL_stretch.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_stretch.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
--- a/src/video/SDL_surface.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_surface.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -27,7 +27,6 @@
 #include "SDL_blit.h"
 #include "SDL_RLEaccel_c.h"
 #include "SDL_pixels_c.h"
-#include "SDL_leaks.h"
 
 
 /* Public routines */
@@ -145,9 +144,6 @@
 
     /* The surface is ready to go */
     surface->refcount = 1;
-#ifdef CHECK_LEAKS
-    ++surfaces_allocated;
-#endif
     return surface;
 }
 
@@ -931,9 +927,6 @@
         SDL_free(surface->pixels);
     }
     SDL_free(surface);
-#ifdef CHECK_LEAKS
-    --surfaces_allocated;
-#endif
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_sysvideo.h	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_sysvideo.h	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -76,8 +76,6 @@
     int w, h;
     Uint32 flags;
 
-    SDL_VideoDisplay *display;
-
     SDL_DisplayMode fullscreen_mode;
     
     SDL_Surface *surface;
@@ -108,12 +106,7 @@
     SDL_DisplayMode *display_modes;
     SDL_DisplayMode desktop_mode;
     SDL_DisplayMode current_mode;
-    SDL_bool updating_fullscreen;
 
-    Uint16 *gamma;
-    Uint16 *saved_gamma;        /* (just offset into gamma) */
-
-    SDL_Window *windows;
     SDL_Window *fullscreen_window;
 
     SDL_VideoDevice *device;
@@ -121,6 +114,9 @@
     void *driverdata;
 };
 
+/* Forward declaration */
+struct SDL_SysWMinfo;
+
 /* Define the SDL video driver structure */
 #define _THIS	SDL_VideoDevice *_this
 
@@ -156,8 +152,7 @@
     int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
 
     /*
-     * Get a list of the available display modes. e.g.
-     * SDL_AddDisplayMode(_this->current_display, mode)
+     * Get a list of the available display modes for a display.
      */
     void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
 
@@ -169,12 +164,6 @@
      */
     int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
 
-    /* Set the gamma ramp */
-    int (*SetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
-
-    /* Get the gamma ramp */
-    int (*GetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
-
     /* * * */
     /*
      * Window functions
@@ -191,6 +180,8 @@
     void (*MaximizeWindow) (_THIS, SDL_Window * window);
     void (*MinimizeWindow) (_THIS, SDL_Window * window);
     void (*RestoreWindow) (_THIS, SDL_Window * window);
+    void (*PrepWindowFullscreen) (_THIS, SDL_Window * window);
+    void (*SetWindowFullscreen) (_THIS, SDL_Window * window);
     void (*SetWindowGrab) (_THIS, SDL_Window * window);
     void (*DestroyWindow) (_THIS, SDL_Window * window);
     int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
@@ -245,7 +236,7 @@
     SDL_bool suspend_screensaver;
     int num_displays;
     SDL_VideoDisplay *displays;
-    int current_display;
+    SDL_Window *windows;
     Uint8 window_magic;
     Uint32 next_object_id;
     char * clipboard_text;
@@ -331,20 +322,11 @@
 extern VideoBootStrap DUMMY_bootstrap;
 #endif
 
-#define SDL_CurrentDisplay	(&_this->displays[_this->current_display])
-
 extern SDL_VideoDevice *SDL_GetVideoDevice(void);
 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
 extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
-extern int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display);
-extern int SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode);
-extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
-extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
-extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
-extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
-extern int SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
-extern int SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue);
+extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window);
 
 extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
 
--- a/src/video/SDL_video.c	Sun Feb 06 23:48:31 2011 -0800
+++ b/src/video/SDL_video.c	Sat Feb 12 19:16:09 2011 -0800
@@ -1,6 +1,6 @@
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2010 Sam Lantinga
+    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
@@ -96,6 +96,17 @@
         return retval; \
     }
 
+#define CHECK_DISPLAY_INDEX(displayIndex, retval) \
+    if (!_this) { \
+        SDL_UninitializedVideo(); \
+        return retval; \
+    } \
+    if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
+        SDL_SetError("displayIndex must be in the range 0 - %d", \
+                     _this->num_displays - 1); \
+        return retval; \
+    }
+
 /* Various local functions */
 static void SDL_UpdateWindowGrab(SDL_Window * window);
 
@@ -203,16 +214,6 @@
 
     data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
     if (!data) {
-        data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
-        if (!data) {
-            SDL_OutOfMemory();
-            return -1;
-        }
-        SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data);
-    }
-
-    renderer = data->renderer;
-    if (!renderer) {
         SDL_RendererInfo info;
         int i;
         const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);
@@ -243,6 +244,16 @@
         if (!renderer) {
             return -1;
         }
+
+        /* Create the data after we successfully create the renderer (bug #1116) */
+        data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
+        if (!data) {
+            SDL_DestroyRenderer(renderer);
+            SDL_OutOfMemory();
+            return -1;
+        }
+        SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data);
+
         data->renderer = renderer;
     }
 
@@ -263,7 +274,8 @@
     /* Find the first format without an alpha channel */
     *format = info.texture_formats[0];
     for (i = 0; i < info.num_texture_formats; ++i) {
-        if (!SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) {
+        if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) &&
+            !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) {
             *format = info.texture_formats[i];
             break;
         }
@@ -488,12 +500,12 @@
 #if SDL_VIDEO_OPENGL
     _this->gl_config.major_version = 2;
     _this->gl_config.minor_version = 1;
+#elif SDL_VIDEO_OPENGL_ES
+    _this->gl_config.major_version = 1;
+    _this->gl_config.minor_version = 1;
 #elif SDL_VIDEO_OPENGL_ES2
     _this->gl_config.major_version = 2;
     _this->gl_config.minor_version = 0;
-#elif SDL_VIDEO_OPENGL_ES
-    _this->gl_config.major_version = 1;
-    _this->gl_config.minor_version = 1;
 #endif
 
     /* Initialize the video subsystem */
@@ -581,66 +593,33 @@
 }
 
 int
-SDL_GetDisplayBounds(int index, SDL_Rect * rect)
+SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
 {
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-    if (index < 0 || index >= _this->num_displays) {
-        SDL_SetError("index must be in the range 0 - %d",
-                     _this->num_displays - 1);
-        return -1;
-    }
+    CHECK_DISPLAY_INDEX(displayIndex, -1);
+
     if (rect) {
-        SDL_VideoDisplay *display = &_this->displays[index];
+        SDL_VideoDisplay *display = &_this->displays[displayIndex];
 
         if (_this->GetDisplayBounds) {
-            if (_this->GetDisplayBounds(_this, display, rect) < 0) {
-                return -1;
+            if (_this->GetDisplayBounds(_this, display, rect) == 0) {
+                return 0;
             }
+        }
+
+        /* Assume that the displays are left to right */
+        if (displayIndex == 0) {
+            rect->x = 0;
+            rect->y = 0;
         } else {
-            /* Assume that the displays are left to right */
-            if (index == 0) {
-                rect->x = 0;
-                rect->y = 0;
-            } else {
-                SDL_GetDisplayBounds(index-1, rect);
-                rect->x += rect->w;
-            }
-            rect->w = display->desktop_mode.w;
-            rect->h = display->desktop_mode.h;
+            SDL_GetDisplayBounds(displayIndex-1, rect);
+            rect->x += rect->w;
         }
+        rect->w = display->desktop_mode.w;
+        rect->h = display->desktop_mode.h;
     }
     return 0;
 }
 
-int
-SDL_SelectVideoDisplay(int index)
-{
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return (-1);
-    }
-    if (index < 0 || index >= _this->num_displays) {
-        SDL_SetError("ind