Mercurial > sdl-ios-xcode
changeset 5281:15a71bec4a55
merged
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Sat, 12 Feb 2011 19:16:09 -0800 |
parents | adfcdd311ae0 (current diff) bad04e4710f6 (diff) |
children | a3bfe8657cde |
files | 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 |
diffstat | 458 files changed, 4346 insertions(+), 5188 deletions(-) [+] |
line wrap: on
line diff
--- 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("index must be in the range 0 - %d", - _this->num_displays - 1); - return -1; - } - _this->current_display = index; - return 0; -} - -int -SDL_GetCurrentVideoDisplay(void) -{ - if (!_this) { - SDL_UninitializedVideo(); - return (-1); - } - return _this->current_display; -} - SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay * display, const SDL_DisplayMode * mode) { @@ -677,7 +656,13 @@ return SDL_TRUE; } -int +SDL_VideoDisplay * +SDL_GetFirstDisplay(void) +{ + return &_this->displays[0]; +} + +static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display) { if (!display->num_display_modes && _this->GetDisplayModes) { @@ -689,17 +674,21 @@ } int -SDL_GetNumDisplayModes() +SDL_GetNumDisplayModes(int displayIndex) { - if (_this) { - return SDL_GetNumDisplayModesForDisplay(SDL_CurrentDisplay); - } - return 0; + CHECK_DISPLAY_INDEX(displayIndex, -1); + + return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]); } int -SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode) +SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode) { + SDL_VideoDisplay *display; + + CHECK_DISPLAY_INDEX(displayIndex, -1); + + display = &_this->displays[displayIndex]; if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) { SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumDisplayModesForDisplay(display) - 1); @@ -712,14 +701,13 @@ } int -SDL_GetDisplayMode(int index, SDL_DisplayMode * mode) +SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode) { - return SDL_GetDisplayModeForDisplay(SDL_CurrentDisplay, index, mode); -} + SDL_VideoDisplay *display; -int -SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode) -{ + CHECK_DISPLAY_INDEX(displayIndex, -1); + + display = &_this->displays[displayIndex]; if (mode) { *mode = display->desktop_mode; } @@ -727,35 +715,20 @@ } int -SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode) +SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode) { - if (!_this) { - SDL_UninitializedVideo(); - return -1; - } - return SDL_GetDesktopDisplayModeForDisplay(SDL_CurrentDisplay, mode); -} + SDL_VideoDisplay *display; -int -SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode) -{ + CHECK_DISPLAY_INDEX(displayIndex, -1); + + display = &_this->displays[displayIndex]; if (mode) { *mode = display->current_mode; } return 0; } -int -SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode) -{ - if (!_this) { - SDL_UninitializedVideo(); - return -1; - } - return SDL_GetCurrentDisplayModeForDisplay(SDL_CurrentDisplay, mode); -} - -SDL_DisplayMode * +static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest) @@ -863,14 +836,16 @@ } SDL_DisplayMode * -SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode, +SDL_GetClosestDisplayMode(int displayIndex, + const SDL_DisplayMode * mode, SDL_DisplayMode * closest) { - if (!_this) { - SDL_UninitializedVideo(); - return NULL; - } - return SDL_GetClosestDisplayModeForDisplay(SDL_CurrentDisplay, mode, closest); + SDL_VideoDisplay *display; + + CHECK_DISPLAY_INDEX(displayIndex, NULL); + + display = &_this->displays[displayIndex]; + return SDL_GetClosestDisplayModeForDisplay(display, mode, closest); } int @@ -907,7 +882,7 @@ } /* See if there's anything left to do */ - SDL_GetCurrentDisplayModeForDisplay(display, ¤t_mode); + current_mode = display->current_mode; if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) { return 0; } @@ -925,6 +900,67 @@ } int +SDLCALL SDL_GetWindowDisplay(SDL_Window * window) +{ + int displayIndex; + int i, dist; + int closest = -1; + int closest_dist = 0x7FFFFFFF; + SDL_Point center; + SDL_Point delta; + SDL_Rect rect; + + CHECK_WINDOW_MAGIC(window, -1); + + if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || + SDL_WINDOWPOS_ISCENTERED(window->x)) { + displayIndex = (window->x & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || + SDL_WINDOWPOS_ISCENTERED(window->y)) { + displayIndex = (window->y & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + + /* Find the display containing the window */ + center.x = window->x + window->w / 2; + center.y = window->y + window->h / 2; + for (i = 0; i < _this->num_displays; ++i) { + SDL_VideoDisplay *display = &_this->displays[i]; + + SDL_GetDisplayBounds(i, &rect); + if (display->fullscreen_window == window || SDL_EnclosePoints(¢er, 1, &rect, NULL)) { + return i; + } + + delta.x = center.x - (rect.x + rect.w / 2); + delta.y = center.y - (rect.y + rect.h / 2); + dist = (delta.x*delta.x + delta.y*delta.y); + if (dist < closest_dist) { + closest = i; + closest_dist = dist; + } + } + if (closest < 0) { + SDL_SetError("Couldn't find any displays"); + } + return closest; +} + +SDL_VideoDisplay * +SDL_GetDisplayForWindow(SDL_Window *window) +{ + return &_this->displays[SDL_GetWindowDisplay(window)]; +} + +int SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode) { CHECK_WINDOW_MAGIC(window, -1); @@ -952,7 +988,7 @@ fullscreen_mode.h = window->h; } - if (!SDL_GetClosestDisplayModeForDisplay(window->display, + if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode, &fullscreen_mode)) { SDL_SetError("Couldn't find display mode match"); @@ -968,23 +1004,25 @@ Uint32 SDL_GetWindowPixelFormat(SDL_Window * window) { - SDL_VideoDisplay *display = window->display; - SDL_DisplayMode *displayMode = &display->current_mode; - return displayMode->format; + SDL_VideoDisplay *display; + + CHECK_WINDOW_MAGIC(window, SDL_PIXELFORMAT_UNKNOWN); + + display = SDL_GetDisplayForWindow(window); + return display->current_mode.format; } static void SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_Window *other; - /* See if we're already processing a window */ - if (display->updating_fullscreen) { + /* See if anything changed */ + if ((display->fullscreen_window == window) == attempt) { return; } - display->updating_fullscreen = SDL_TRUE; - /* See if we even want to do anything here */ if ((window->flags & SDL_WINDOW_FULLSCREEN) && (window->flags & SDL_WINDOW_SHOWN)) { @@ -1003,30 +1041,47 @@ if (FULLSCREEN_VISIBLE(window)) { /* Hide any other fullscreen windows */ - SDL_Window *other; - for (other = display->windows; other; other = other->next) { - if (other != window && FULLSCREEN_VISIBLE(other)) { - SDL_MinimizeWindow(other); - } + if (display->fullscreen_window && + display->fullscreen_window != window) { + SDL_MinimizeWindow(display->fullscreen_window); } } - display->updating_fullscreen = SDL_FALSE; + /* See if there are any fullscreen windows */ + for (other = _this->windows; other; other = other->next) { + if (FULLSCREEN_VISIBLE(other) && + SDL_GetDisplayForWindow(other) == display) { + SDL_DisplayMode fullscreen_mode; + if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) { + if (_this->PrepWindowFullscreen) { + _this->PrepWindowFullscreen(_this, other); + } - /* See if there are any fullscreen windows */ - for (window = display->windows; window; window = window->next) { - if (FULLSCREEN_VISIBLE(window)) { - SDL_DisplayMode fullscreen_mode; - if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { SDL_SetDisplayModeForDisplay(display, &fullscreen_mode); - display->fullscreen_window = window; + + if (_this->SetWindowFullscreen) { + _this->SetWindowFullscreen(_this, other); + } + display->fullscreen_window = other; + + /* Generate a mode change events here */ + SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, + fullscreen_mode.w, fullscreen_mode.h); return; } } } /* Nope, restore the desktop mode */ + if (_this->PrepWindowFullscreen) { + _this->PrepWindowFullscreen(_this, window); + } + SDL_SetDisplayModeForDisplay(display, NULL); + + if (_this->SetWindowFullscreen) { + _this->SetWindowFullscreen(_this, window); + } display->fullscreen_window = NULL; } @@ -1038,7 +1093,6 @@ SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_INPUT_GRABBED); - SDL_VideoDisplay *display; SDL_Window *window; if (!_this) { @@ -1047,6 +1101,11 @@ return NULL; } } + + /* Some platforms have OpenGL enabled by default */ +#if (SDL_VIDEO_OPENGL && __MACOSX__) || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + flags |= SDL_WINDOW_OPENGL; +#endif if (flags & SDL_WINDOW_OPENGL) { if (!_this->GL_CreateContext) { SDL_SetError("No OpenGL support in video driver"); @@ -1054,7 +1113,6 @@ } SDL_GL_LoadLibrary(NULL); } - display = SDL_CurrentDisplay; window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); window->magic = &_this->window_magic; window->id = _this->next_object_id++; @@ -1063,12 +1121,11 @@ window->w = w; window->h = h; window->flags = (flags & allowed_flags); - window->display = display; - window->next = display->windows; - if (display->windows) { - display->windows->prev = window; + window->next = _this->windows; + if (_this->windows) { + _this->windows->prev = window; } - display->windows = window; + _this->windows = window; if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { SDL_DestroyWindow(window); @@ -1095,24 +1152,21 @@ SDL_Window * SDL_CreateWindowFrom(const void *data) { - SDL_VideoDisplay *display; SDL_Window *window; if (!_this) { SDL_UninitializedVideo(); return NULL; } - display = SDL_CurrentDisplay; window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); window->magic = &_this->window_magic; window->id = _this->next_object_id++; window->flags = SDL_WINDOW_FOREIGN; - window->display = display; - window->next = display->windows; - if (display->windows) { - display->windows->prev = window; + window->next = _this->windows; + if (_this->windows) { + _this->windows->prev = window; } - display->windows = window; + _this->windows = window; if (!_this->CreateWindowFrom || _this->CreateWindowFrom(_this, window, data) < 0) { @@ -1137,13 +1191,6 @@ SDL_SetError("No OpenGL support in video driver"); return -1; } - if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) { - if (flags & SDL_WINDOW_OPENGL) { - SDL_GL_LoadLibrary(NULL); - } else { - SDL_GL_UnloadLibrary(); - } - } if (window->flags & SDL_WINDOW_FOREIGN) { /* Can't destroy and re-create foreign windows, hrm */ @@ -1152,10 +1199,29 @@ flags &= ~SDL_WINDOW_FOREIGN; } + /* Restore video mode, etc. */ + SDL_UpdateFullscreenMode(window, SDL_FALSE); + + /* Tear down the old native window */ + if (window->surface) { + window->surface->refcount = 0; + SDL_FreeSurface(window->surface); + } + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); + } if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) { _this->DestroyWindow(_this, window); } + if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) { + if (flags & SDL_WINDOW_OPENGL) { + SDL_GL_LoadLibrary(NULL); + } else { + SDL_GL_UnloadLibrary(); + } + } + window->title = NULL; window->flags = (flags & allowed_flags); @@ -1198,18 +1264,13 @@ SDL_GetWindowFromID(Uint32 id) { SDL_Window *window; - int i; if (!_this) { return NULL; } - /* FIXME: Should we keep a separate hash table for these? */ - for (i = _this->num_displays; i--;) { - SDL_VideoDisplay *display = &_this->displays[i]; - for (window = display->windows; window; window = window->next) { - if (window->id == id) { - return window; - } + for (window = _this->windows; window; window = window->next) { + if (window->id == id) { + return window; } } return NULL; @@ -1330,22 +1391,36 @@ if (y != SDL_WINDOWPOS_UNDEFINED) { window->y = y; } - if (_this->SetWindowPosition) { - _this->SetWindowPosition(_this, window); + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if (_this->SetWindowPosition) { + _this->SetWindowPosition(_this, window); + } + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); } - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); } void SDL_GetWindowPosition(SDL_Window * window, int *x, int *y) { + /* Clear the values */ + if (x) { + *x = 0; + } + if (y) { + *y = 0; + } + CHECK_WINDOW_MAGIC(window, ); - if (x) { - *x = window->x; - } - if (y) { - *y = window->y; + /* Fullscreen windows are always at their display's origin */ + if (window->flags & SDL_WINDOW_FULLSCREEN) { + } else { + if (x) { + *x = window->x; + } + if (y) { + *y = window->y; + } } } @@ -1354,19 +1429,33 @@ { CHECK_WINDOW_MAGIC(window, ); - window->w = w; - window->h = h; - - if (_this->SetWindowSize) { - _this->SetWindowSize(_this, window); + /* FIXME: Should this change fullscreen modes? */ + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if (_this->SetWindowSize) { + _this->SetWindowSize(_this, window); + } + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); } - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); } void SDL_GetWindowSize(SDL_Window * window, int *w, int *h) { - if (window) { + int dummy; + + if (!w) { + w = &dummy; + } + if (!h) { + h = &dummy; + } + + *w = 0; + *h = 0; + + CHECK_WINDOW_MAGIC(window, ); + + if (_this && window && window->magic == &_this->window_magic) { if (w) { *w = window->w; } @@ -1475,7 +1564,7 @@ } int -SDL_SetWindowFullscreen(SDL_Window * window, int fullscreen) +SDL_SetWindowFullscreen(SDL_Window * window, SDL_bool fullscreen) { CHECK_WINDOW_MAGIC(window, -1); @@ -1635,11 +1724,6 @@ void SDL_OnWindowFocusGained(SDL_Window * window) { - SDL_VideoDisplay *display = window->display; - - if (display->gamma && _this->SetDisplayGammaRamp) { - _this->SetDisplayGammaRamp(_this, display, display->gamma); - } if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) && _this->SetWindowGrab) { _this->SetWindowGrab(_this, window); @@ -1649,17 +1733,12 @@ void SDL_OnWindowFocusLost(SDL_Window * window) { - SDL_VideoDisplay *display = window->display; - /* If we're fullscreen on a single-head system and lose focus, minimize */ if ((window->flags & SDL_WINDOW_FULLSCREEN) && _this->num_displays == 1) { SDL_MinimizeWindow(window); } - if (display->gamma && _this->SetDisplayGammaRamp) { - _this->SetDisplayGammaRamp(_this, display, display->saved_gamma); - } if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) && _this->SetWindowGrab) { _this->SetWindowGrab(_this, window); @@ -1669,14 +1748,12 @@ SDL_Window * SDL_GetFocusWindow(void) { - SDL_VideoDisplay *display; SDL_Window *window; if (!_this) { return NULL; } - display = SDL_CurrentDisplay; - for (window = display->windows; window; window = window->next) { + for (window = _this->windows; window; window = window->next) { if (window->flags & SDL_WINDOW_INPUT_FOCUS) { return window; } @@ -1708,6 +1785,11 @@ SDL_GL_UnloadLibrary(); } + display = SDL_GetDisplayForWindow(window); + if (display->fullscreen_window == window) { + display->fullscreen_window = NULL; + } + /* Now invalidate magic */ window->magic = NULL; @@ -1724,14 +1806,13 @@ } /* Unlink the window from the list */ - display = window->display; if (window->next) { window->next->prev = window->prev; } if (window->prev) { window->prev->next = window->next; } else { - display->windows = window->next; + _this->windows = window->next; } SDL_free(window); @@ -1794,11 +1875,8 @@ SDL_EnableScreenSaver(); /* Clean up the system video */ - for (i = _this->num_displays; i--;) { - SDL_VideoDisplay *display = &_this->displays[i]; - while (display->windows) { - SDL_DestroyWindow(display->windows); - } + while (_this->windows) { + SDL_DestroyWindow(_this->windows); } _this->VideoQuit(_this); @@ -1818,10 +1896,6 @@ SDL_free(display->desktop_mode.driverdata); display->desktop_mode.driverdata = NULL; } - if (display->gamma) { - SDL_free(display->gamma); - display->gamma = NULL; - } if (display->driverdata) { SDL_free(display->driverdata); display->driverdata = NULL;
--- a/src/video/android/SDL_androidevents.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidevents.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/android/SDL_androidevents.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidevents.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/android/SDL_androidgl.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidgl.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 @@ -55,7 +55,11 @@ SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window) { - Android_JNI_CreateContext(); + if (!Android_JNI_CreateContext(_this->gl_config.major_version, + _this->gl_config.minor_version)) { + SDL_SetError("Couldn't create OpenGL context - see Android log for details"); + return NULL; + } return (SDL_GLContext)1; } @@ -91,3 +95,5 @@ { __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n"); } + +/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidkeyboard.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidkeyboard.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 @@ -30,14 +30,14 @@ void Android_InitKeyboard() { - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; /* Add default scancode to key mapping */ SDL_GetDefaultKeymap(keymap); SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); } -static SDL_ScanCode Android_Keycodes[] = { +static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_UNKNOWN, /* AKEYCODE_UNKNOWN */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_LEFT */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_RIGHT */ @@ -151,10 +151,10 @@ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_MODE */ }; -static SDL_ScanCode +static SDL_Scancode TranslateKeycode(int keycode) { - SDL_ScanCode scancode = SDL_SCANCODE_UNKNOWN; + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; if (keycode < SDL_arraysize(Android_Keycodes)) { scancode = Android_Keycodes[keycode];
--- a/src/video/android/SDL_androidkeyboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidkeyboard.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/android/SDL_androidtouch.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidtouch.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/android/SDL_androidtouch.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidtouch.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/android/SDL_androidvideo.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidvideo.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/android/SDL_androidvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidvideo.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/android/SDL_androidwindow.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidwindow.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 @@ -41,6 +41,11 @@ window->w = Android_ScreenWidth; window->h = Android_ScreenHeight; + window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ + window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ + window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ + window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ + return 0; }
--- a/src/video/android/SDL_androidwindow.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/android/SDL_androidwindow.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/bwindow/SDL_BView.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_BView.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/bwindow/SDL_BWin.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_BWin.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 @@ -509,7 +509,7 @@ if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { - SDL_KeySym keysym; + SDL_Keysym keysym; keysym.scancode = key; if ((key > 0) && (key < 128)) { keysym.sym = keymap[key]; @@ -543,7 +543,7 @@ int32 modifiers; if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { - SDL_KeySym keysym; + SDL_Keysym keysym; keysym.scancode = key; if ((key > 0) && (key < 128)) { keysym.sym = keymap[key]; @@ -586,7 +586,7 @@ bool inhibit_resize; int32 last_buttons; - SDLKey keymap[128]; + SDL_Keycode keymap[128]; }; #endif /* _SDL_BWin_h */
--- a/src/video/bwindow/SDL_lowvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_lowvideo.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/bwindow/SDL_sysevents.cc Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysevents.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/video/bwindow/SDL_sysevents_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysevents_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/bwindow/SDL_sysmouse.cc Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysmouse.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/video/bwindow/SDL_sysmouse_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysmouse_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/bwindow/SDL_sysvideo.cc Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysvideo.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 @@ -129,7 +129,6 @@ device->UnlockHWSurface = BE_UnlockHWSurface; device->FlipHWSurface = NULL; device->FreeHWSurface = BE_FreeHWSurface; - /* Gamma support */ #if SDL_VIDEO_OPENGL /* OpenGL support */ device->GL_LoadLibrary = BE_GL_LoadLibrary;
--- a/src/video/bwindow/SDL_syswm.cc Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_syswm.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/video/bwindow/SDL_syswm_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_syswm_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/bwindow/SDL_sysyuv.cc Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysyuv.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/video/bwindow/SDL_sysyuv.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/bwindow/SDL_sysyuv.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/cocoa/SDL_cocoaclipboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaclipboard.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/cocoa/SDL_cocoaclipboard.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaclipboard.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/video/cocoa/SDL_cocoaevents.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaevents.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/cocoa/SDL_cocoaevents.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaevents.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 @@ -40,13 +40,6 @@ - (void)setAppleMenu:(NSMenu *)menu; @end -@implementation NSApplication(SDL) -- (void)setRunning -{ - _running = 1; -} -@end - @interface SDLAppDelegate : NSObject - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; @end @@ -164,7 +157,6 @@ if ([NSApp delegate] == nil) { [NSApp setDelegate:[[SDLAppDelegate alloc] init]]; } - [NSApp setRunning]; [pool release]; } @@ -185,7 +177,7 @@ } pool = [[NSAutoreleasePool alloc] init]; - while ([NSApp isRunning]) { + for ( ; ; ) { NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { break;
--- a/src/video/cocoa/SDL_cocoakeyboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoakeyboard.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/cocoa/SDL_cocoakeyboard.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoakeyboard.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 @@ -246,7 +246,7 @@ HandleNonDeviceModifier(unsigned int device_independent_mask, unsigned int oldMods, unsigned int newMods, - SDL_ScanCode scancode) + SDL_Scancode scancode) { unsigned int oldMask, newMask; @@ -268,7 +268,7 @@ */ static void HandleModifierOneSide(unsigned int oldMods, unsigned int newMods, - SDL_ScanCode scancode, + SDL_Scancode scancode, unsigned int sided_device_dependent_mask) { unsigned int old_dep_mask, new_dep_mask; @@ -297,8 +297,8 @@ static void HandleModifierSide(int device_independent_mask, unsigned int oldMods, unsigned int newMods, - SDL_ScanCode left_scancode, - SDL_ScanCode right_scancode, + SDL_Scancode left_scancode, + SDL_Scancode right_scancode, unsigned int left_device_dependent_mask, unsigned int right_device_dependent_mask) { @@ -341,8 +341,8 @@ static void ReleaseModifierSide(unsigned int device_independent_mask, unsigned int oldMods, unsigned int newMods, - SDL_ScanCode left_scancode, - SDL_ScanCode right_scancode, + SDL_Scancode left_scancode, + SDL_Scancode right_scancode, unsigned int left_device_dependent_mask, unsigned int right_device_dependent_mask) { @@ -409,13 +409,13 @@ unsigned int oldMods, unsigned int newMods) { /* Set up arrays for the key syms for the left and right side. */ - const SDL_ScanCode left_mapping[] = { + const SDL_Scancode left_mapping[] = { SDL_SCANCODE_LSHIFT, SDL_SCANCODE_LCTRL, SDL_SCANCODE_LALT, SDL_SCANCODE_LGUI }; - const SDL_ScanCode right_mapping[] = { + const SDL_Scancode right_mapping[] = { SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RCTRL, SDL_SCANCODE_RALT, @@ -489,8 +489,8 @@ #endif const void *chr_data; int i; - SDL_ScanCode scancode; - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Scancode scancode; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; /* See if the keymap needs to be updated */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @@ -675,7 +675,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; unsigned short scancode = [event keyCode]; - SDL_ScanCode code; + SDL_Scancode code; #if 0 const char *text; #endif
--- a/src/video/cocoa/SDL_cocoamodes.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoamodes.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/cocoa/SDL_cocoamodes.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoamodes.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 @@ -258,14 +258,23 @@ /* Restoring desktop mode */ CGDisplaySwitchToMode(displaydata->display, data->moderef); - CGDisplayRelease(displaydata->display); + if (CGDisplayIsMain(displaydata->display)) { + CGReleaseAllDisplays(); + } else { + CGDisplayRelease(displaydata->display); + } if (CGDisplayIsMain(displaydata->display)) { ShowMenuBar(); } } else { /* Put up the blanking window (a window above all other windows) */ - result = CGDisplayCapture(displaydata->display); + if (CGDisplayIsMain(displaydata->display)) { + /* If we don't capture all displays, Cocoa tries to rearrange windows... *sigh* */ + result = CGCaptureAllDisplays(); + } else { + result = CGDisplayCapture(displaydata->display); + } if (result != kCGErrorSuccess) { CG_SetError("CGDisplayCapture()", result); goto ERR_NO_CAPTURE; @@ -290,19 +299,6 @@ CGReleaseDisplayFadeReservation(fade_token); } - [[NSApp mainWindow] makeKeyAndOrderFront: nil]; - -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 - /* - There is a bug in Cocoa where NSScreen doesn't synchronize - with CGDirectDisplay, so the main screen's frame is wrong. - As a result, coordinate translation produces incorrect results. - We can hack around this bug by setting the screen rect - ourselves. This hack should be removed if/when the bug is fixed. - */ - [[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)]; -#endif - return 0; /* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */
--- a/src/video/cocoa/SDL_cocoamouse.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoamouse.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/cocoa/SDL_cocoamouse.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoamouse.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/video/cocoa/SDL_cocoaopengl.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaopengl.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,6 +26,9 @@ #if SDL_VIDEO_OPENGL_CGL +/* Define this if you want to be able to toggle fullscreen mode seamlessly */ +#define FULLSCREEN_TOGGLEABLE + struct SDL_GLDriverData { int initialized;
--- a/src/video/cocoa/SDL_cocoaopengl.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoaopengl.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 @@ -72,7 +72,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) { NSAutoreleasePool *pool; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; @@ -81,9 +81,11 @@ pool = [[NSAutoreleasePool alloc] init]; +#ifndef FULLSCREEN_TOGGLEABLE if (window->flags & SDL_WINDOW_FULLSCREEN) { attr[i++] = NSOpenGLPFAFullScreen; } +#endif attr[i++] = NSOpenGLPFAColorSize; attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; @@ -199,9 +201,12 @@ SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata; NSOpenGLContext *nscontext = (NSOpenGLContext *)context; +#ifndef FULLSCREEN_TOGGLEABLE if (window->flags & SDL_WINDOW_FULLSCREEN) { [nscontext setFullScreen]; - } else { + } else +#endif + { [nscontext setView:[windowdata->nswindow contentView]]; [nscontext update]; }
--- a/src/video/cocoa/SDL_cocoavideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoavideo.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/cocoa/SDL_cocoavideo.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoavideo.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 @@ -90,6 +90,7 @@ device->MaximizeWindow = Cocoa_MaximizeWindow; device->MinimizeWindow = Cocoa_MinimizeWindow; device->RestoreWindow = Cocoa_RestoreWindow; + device->SetWindowFullscreen = Cocoa_SetWindowFullscreen; device->SetWindowGrab = Cocoa_SetWindowGrab; device->DestroyWindow = Cocoa_DestroyWindow; device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
--- a/src/video/cocoa/SDL_cocoawindow.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoawindow.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 @@ -86,7 +86,6 @@ SDL_Window *window; NSWindow *nswindow; SDL_bool created; - CGDirectDisplayID display; Cocoa_WindowListener *listener; struct SDL_VideoData *videodata; }; @@ -103,6 +102,7 @@ extern void Cocoa_MaximizeWindow(_THIS, SDL_Window * window); extern void Cocoa_MinimizeWindow(_THIS, SDL_Window * window); extern void Cocoa_RestoreWindow(_THIS, SDL_Window * window); +extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window); extern void Cocoa_SetWindowGrab(_THIS, SDL_Window * window); extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window,
--- a/src/video/cocoa/SDL_cocoawindow.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/cocoa/SDL_cocoawindow.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 @@ -333,8 +333,8 @@ SDL_FingerID fingerId = (SDL_FingerID)[touch identity]; float x = [touch normalizedPosition].x; float y = [touch normalizedPosition].y; - /* Make the origin the upper left instead of the lower left */ - y = 1.0f - y; + /* Make the origin the upper left instead of the lower left */ + y = 1.0f - y; switch (type) { case COCOA_TOUCH_DOWN: @@ -398,17 +398,31 @@ @end +static unsigned int +GetStyleMask(SDL_Window * window) +{ + unsigned int style; + + if (window->flags & SDL_WINDOW_BORDERLESS) { + style = NSBorderlessWindowMask; + } else { + style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); + } + if (window->flags & SDL_WINDOW_RESIZABLE) { + style |= NSResizableWindowMask; + } + return style; +} + static int SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) { NSAutoreleasePool *pool; SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = window->display; - SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *data; /* Allocate the window data */ - data = (SDL_WindowData *) SDL_malloc(sizeof(*data)); + data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); if (!data) { SDL_OutOfMemory(); return -1; @@ -416,7 +430,6 @@ data->window = window; data->nswindow = nswindow; data->created = created; - data->display = displaydata->display; data->videodata = videodata; pool = [[NSAutoreleasePool alloc] init]; @@ -427,7 +440,6 @@ /* Fill in the SDL window with the window data */ { - SDL_Rect bounds; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; NSView *contentView = [[SDLView alloc] initWithFrame: rect listener: data->listener]; @@ -438,9 +450,8 @@ [contentView release]; ConvertNSRect(&rect); - Cocoa_GetDisplayBounds(_this, display, &bounds); - window->x = (int)rect.origin.x - bounds.x; - window->y = (int)rect.origin.y - bounds.y; + window->x = (int)rect.origin.x; + window->y = (int)rect.origin.y; window->w = (int)rect.size.width; window->h = (int)rect.size.height; } @@ -493,40 +504,31 @@ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *nswindow; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); NSRect rect; SDL_Rect bounds; unsigned int style; Cocoa_GetDisplayBounds(_this, display, &bounds); - if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->x == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->x)) { rect.origin.x = bounds.x + (bounds.w - window->w) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { rect.origin.x = bounds.x; } else { - rect.origin.x = bounds.x + window->x; + rect.origin.x = window->x; } - if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->y == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->y)) { rect.origin.y = bounds.y + (bounds.h - window->h) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { rect.origin.y = bounds.y; } else { - rect.origin.y = bounds.y + window->y; + rect.origin.y = window->y; } rect.size.width = window->w; rect.size.height = window->h; ConvertNSRect(&rect); - if (window->flags & SDL_WINDOW_BORDERLESS) { - style = NSBorderlessWindowMask; - } else { - style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); - } - if (window->flags & SDL_WINDOW_RESIZABLE) { - style |= NSResizableWindowMask; - } + style = GetStyleMask(window); /* Figure out which screen to place this window */ NSArray *screens = [NSScreen screens]; @@ -599,22 +601,20 @@ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); NSRect rect; SDL_Rect bounds; Cocoa_GetDisplayBounds(_this, display, &bounds); - if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->x == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->x)) { rect.origin.x = bounds.x + (bounds.w - window->w) / 2; } else { - rect.origin.x = bounds.x + window->x; + rect.origin.x = window->x; } - if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->y == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->y)) { rect.origin.y = bounds.y + (bounds.h - window->h) / 2; } else { - rect.origin.y = bounds.y + window->y; + rect.origin.y = window->y; } rect.size.width = window->w; rect.size.height = window->h; @@ -704,6 +704,48 @@ } void +Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; + NSRect rect; + + if (FULLSCREEN_VISIBLE(window)) { + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_Rect bounds; + + Cocoa_GetDisplayBounds(_this, display, &bounds); + rect.origin.x = bounds.x; + rect.origin.y = bounds.y; + rect.size.width = bounds.w; + rect.size.height = bounds.h; + ConvertNSRect(&rect); + + [nswindow setStyleMask:NSBorderlessWindowMask]; + [nswindow setContentSize:rect.size]; + [nswindow setFrameOrigin:rect.origin]; + } else { + [nswindow setStyleMask:GetStyleMask(window)]; + + // This doesn't seem to do anything... + //[nswindow setFrameOrigin:origin]; + } + +#ifdef FULLSCREEN_TOGGLEABLE + if (FULLSCREEN_VISIBLE(window)) { + /* OpenGL is rendering to the window, so make it visible! */ + [nswindow setLevel:CGShieldingWindowLevel()]; + } else { + [nswindow setLevel:kCGNormalWindowLevel]; + } +#endif + [nswindow makeKeyAndOrderFront:nil]; + + [pool release]; +} + +void Cocoa_SetWindowGrab(_THIS, SDL_Window * window) { if ((window->flags & SDL_WINDOW_INPUT_GRABBED) &&
--- a/src/video/directfb/SDL_DirectFB_WM.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_WM.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/directfb/SDL_DirectFB_WM.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_WM.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/directfb/SDL_DirectFB_dyn.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_dyn.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/directfb/SDL_DirectFB_dyn.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_dyn.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/directfb/SDL_DirectFB_events.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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 @@ -61,15 +61,15 @@ }; /* The translation tables from a DirectFB keycode to a SDL keysym */ -static SDL_ScanCode oskeymap[256]; +static SDL_Scancode oskeymap[256]; -static SDL_KeySym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, - SDL_KeySym * keysym); -static SDL_KeySym *DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt, - SDL_KeySym * keysym); +static SDL_Keysym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, + SDL_Keysym * keysym); +static SDL_Keysym *DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt, + SDL_Keysym * keysym); -static void DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keypmap, int numkeys); +static void DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keypmap, int numkeys); static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button); static void UnicodeToUtf8( Uint16 w , char *utf8buf) @@ -176,7 +176,7 @@ { SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(sdlwin); - SDL_KeySym keysym; + SDL_Keysym keysym; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; if (evt->clazz == DFEC_WINDOW) { @@ -308,7 +308,7 @@ ProcessInputEvent(_THIS, DFBInputEvent * ievt) { SDL_DFB_DEVICEDATA(_this); - SDL_KeySym keysym; + SDL_Keysym keysym; int kbd_idx; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; @@ -448,7 +448,7 @@ } void -DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keymap, int numkeys) +DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keymap, int numkeys) { int i; @@ -575,8 +575,8 @@ } -static SDL_KeySym * -DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_KeySym * keysym) +static SDL_Keysym * +DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_Keysym * keysym) { SDL_DFB_DEVICEDATA(_this); int kbd_idx = 0; /* Window events lag the device source KbdIndex(_this, evt->device_id); */ @@ -605,9 +605,9 @@ return keysym; } -static SDL_KeySym * +static SDL_Keysym * DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt, - SDL_KeySym * keysym) + SDL_Keysym * keysym) { SDL_DFB_DEVICEDATA(_this); int kbd_idx = KbdIndex(_this, evt->device_id); @@ -659,7 +659,7 @@ #if USE_MULTI_API SDL_Keyboard keyboard; #endif - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; if (!cb->sys_kbd) { if (cb->sys_ids) {
--- a/src/video/directfb/SDL_DirectFB_events.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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
--- a/src/video/directfb/SDL_DirectFB_modes.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_modes.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 @@ -135,7 +135,7 @@ * This has simply no effect. */ - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; /* FIXME: should we handle the error */
--- a/src/video/directfb/SDL_DirectFB_modes.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_modes.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/directfb/SDL_DirectFB_mouse.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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 @@ -170,7 +170,7 @@ if (!window) return -1; else { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); if (display) { DFB_DisplayData *dispdata = @@ -222,7 +222,7 @@ static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; DFBResult ret;
--- a/src/video/directfb/SDL_DirectFB_mouse.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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/src/video/directfb/SDL_DirectFB_opengl.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_opengl.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/directfb/SDL_DirectFB_opengl.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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/src/video/directfb/SDL_DirectFB_render.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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 @@ -301,7 +301,7 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) { SDL_DFB_WINDOWDATA(window); - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_Renderer *renderer = NULL; DirectFB_RenderData *data = NULL; DFBSurfaceCapabilities scaps; @@ -409,7 +409,7 @@ { //SDL_DFB_RENDERERDATA(renderer); SDL_Window *window = renderer->window; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DFB_DEVICEDATA(display->device); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DirectFB_TextureData *data = texture->driverdata; @@ -465,7 +465,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { SDL_Window *window = renderer->window; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DFB_DEVICEDATA(display->device); DirectFB_TextureData *data; DFBSurfaceDescription dsc; @@ -1129,7 +1129,7 @@ DirectFB_DestroyRenderer(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - SDL_VideoDisplay *display = renderer->window->display; + SDL_VideoDisplay *display = renderer->SDL_GetDisplayForWindow(window); #if 0 if (display->palette) {
--- a/src/video/directfb/SDL_DirectFB_render.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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
--- a/src/video/directfb/SDL_DirectFB_video.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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 @@ -27,7 +27,6 @@ #include "SDL_DirectFB_events.h" /* - * #include "SDL_DirectFB_gamma.h" * #include "SDL_DirectFB_keyboard.h" */ #include "SDL_DirectFB_modes.h"
--- a/src/video/directfb/SDL_DirectFB_video.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_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 @@ -142,7 +142,7 @@ typedef struct _DFB_KeyboardData DFB_KeyboardData; struct _DFB_KeyboardData { - const SDL_ScanCode *map; /* keyboard scancode map */ + const SDL_Scancode *map; /* keyboard scancode map */ int map_size; /* size of map */ int map_adjust; /* index adjust */ int is_generic; /* generic keyboard */
--- a/src/video/directfb/SDL_DirectFB_window.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_window.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 @@ -62,17 +62,17 @@ bshaped = 1; /* Fill the window description. */ - if (window->x == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->x)) { x = (dispdata->cw - window->w) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { x = 0; } else { x = window->x; } - if (window->y == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->y)) { y = (dispdata->ch - window->h) / 2; - } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { y = 0; } else { y = window->y; @@ -264,17 +264,17 @@ SDL_DFB_DISPLAYDATA(window); int x, y; - if (window->x == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->x)) { x = (dispdata->cw - window->w) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { x = 0; } else { x = window->x; } - if (window->y == SDL_WINDOWPOS_CENTERED) { + if (SDL_WINDOWPOS_ISCENTERED(window->y)) { y = (dispdata->ch - window->h) / 2; - } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { y = 0; } else { y = window->y; @@ -358,7 +358,7 @@ DirectFB_MaximizeWindow(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFBWindowOptions wopts; SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, @@ -526,7 +526,7 @@ if (adjust) { #if SDL_DIRECTFB_OPENGL - DirectFB_GL_FreeWindowContexts(window->display->device, window); + DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window); #endif #if (DFB_VERSION_ATLEAST(1,2,1)) @@ -552,10 +552,10 @@ GetSubSurface(windata->window_surface, &windata->client, &windata->surface)); #endif - DirectFB_WM_RedrawLayout(window->display->device, window); + DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window); #if SDL_DIRECTFB_OPENGL - DirectFB_GL_ReAllocWindowContexts(window->display->device, window); + DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); #endif } error:
--- a/src/video/directfb/SDL_DirectFB_window.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_window.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/dummy/SDL_nullevents.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullevents.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/dummy/SDL_nullevents_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullevents_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/dummy/SDL_nullframebuffer.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullframebuffer.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/dummy/SDL_nullframebuffer_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullframebuffer_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/dummy/SDL_nullvideo.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullvideo.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/dummy/SDL_nullvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/dummy/SDL_nullvideo.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/nds/SDL_ndsevents.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsevents.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 @@ -45,8 +45,7 @@ } if (keysHeld() & KEY_TOUCH) { touchPosition t = touchReadXY(); - SDL_SendMouseMotion(0, 0, t.px, t.py, 1); /* last arg is pressure, - hardcoded 1 for now */ + SDL_SendMouseMotion(0, 0, t.px, t.py); } }
--- a/src/video/nds/SDL_ndsevents_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsevents_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/nds/SDL_ndsrender.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsrender.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 @@ -31,8 +31,8 @@ #include "SDL_video.h" #include "../SDL_sysvideo.h" -#include "../SDL_yuv_sw_c.h" -#include "../SDL_renderer_sw.h" +#include "SDL_render.h" +#include "../../render/SDL_sysrender.h" /* SDL NDS renderer implementation */ @@ -40,9 +40,11 @@ static int NDS_ActivateRenderer(SDL_Renderer * renderer); static int NDS_DisplayModeChanged(SDL_Renderer * renderer); static int NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +#if 0 static int NDS_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch); +#endif static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -50,8 +52,8 @@ const SDL_Rect * rect, int markDirty, void **pixels, int *pitch); static void NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); -static int NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, - Uint8 b, Uint8 a, const SDL_Rect * rect); +static int NDS_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, + int count); static int NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect); @@ -107,7 +109,7 @@ SDL_Renderer * NDS_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayMode *displayMode = &display->current_mode; SDL_Renderer *renderer; NDS_RenderData *data; @@ -149,7 +151,7 @@ } SDL_zerop(data); - renderer->RenderFill = NDS_RenderFill; + renderer->RenderFillRects = NDS_RenderFillRects; renderer->RenderCopy = NDS_RenderCopy; renderer->RenderPresent = NDS_RenderPresent; renderer->DestroyRenderer = NDS_DestroyRenderer; @@ -158,7 +160,7 @@ renderer->window = window; renderer->driverdata = data; renderer->CreateTexture = NDS_CreateTexture; - renderer->QueryTexturePixels = NDS_QueryTexturePixels; +// renderer->QueryTexturePixels = NDS_QueryTexturePixels; renderer->UpdateTexture = NDS_UpdateTexture; renderer->LockTexture = NDS_LockTexture; renderer->UnlockTexture = NDS_UnlockTexture; @@ -341,7 +343,7 @@ bgUpdate(bg3); */ txdat->type = NDSTX_BG; - txdat->pitch = (texture->w) * (bpp / 8); + txdat->pitch = (texture->w) * ((bpp+1) / 8); txdat->bpp = bpp; txdat->rotate = 0; txdat->scale.x = 0x100; @@ -354,7 +356,7 @@ bgSetRotateScale(txdat->hw_index, txdat->rotate, txdat->scale.x, txdat->scale.y); bgSetScroll(txdat->hw_index, txdat->scroll.x, txdat->scroll.y); - bgUpdate(txdat->hw_index); + bgUpdate(); data->bg_taken[whichbg] = 1; /*txdat->size = txdat->dim.pitch * texture->h; */ @@ -372,6 +374,7 @@ return 0; } +#if 0 static int NDS_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch) @@ -381,6 +384,7 @@ *pitch = txdat->pitch; return 0; } +#endif static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, @@ -433,16 +437,13 @@ } static int -NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, - Uint8 a, const SDL_Rect * rect) +NDS_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, + int count) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - SDL_Rect real_rect = *rect; - u16 color; - int i, j; printf("NDS_RenderFill: stub\n"); - color = RGB8(r, g, b); /* macro in libnds that makes an ARGB1555 pixel */ + /* TODO: make a single-color sprite and stretch it. calculate the "HDX" width modifier of the sprite by: let S be the actual sprite's width (like, 32 pixels for example) @@ -462,7 +463,7 @@ NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; SDL_Window *window = renderer->window; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); int Bpp = SDL_BYTESPERPIXEL(texture->format); if (txdat->type == NDSTX_BG) { @@ -487,7 +488,7 @@ { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; SDL_Window *window = renderer->window; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); /* update sprites */ // NDS_OAM_Update(&(data->oam_copy), data->sub);
--- a/src/video/nds/SDL_ndsrender_c.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsrender_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/nds/SDL_ndsvideo.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsvideo.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 @@ -38,6 +38,8 @@ #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_events_c.h" +#include "SDL_render.h" +#include "../../render/SDL_sysrender.h" #include "SDL_ndsvideo.h" #include "SDL_ndsevents_c.h" @@ -47,7 +49,8 @@ /* Initialization/Query functions */ static int NDS_VideoInit(_THIS); -static int NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode); +static int NDS_SetDisplayMode(_THIS, SDL_VideoDisplay *display, + SDL_DisplayMode *mode); static void NDS_VideoQuit(_THIS); @@ -73,10 +76,7 @@ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) { SDL_OutOfMemory(); - if (device) { - SDL_free(device); - } - return (0); + return NULL; } /* Set the function pointers */ @@ -101,7 +101,6 @@ NDS_VideoInit(_THIS) { SDL_DisplayMode mode; - int i; /* simple 256x192x16x60 for now */ mode.w = 256; @@ -113,21 +112,19 @@ if (SDL_AddBasicVideoDisplay(&mode) < 0) { return -1; } - SDL_AddRenderDriver(&_this->displays[0], &NDS_RenderDriver); SDL_zero(mode); - SDL_AddDisplayMode(0, &mode); + SDL_AddDisplayMode(&_this->displays[0], &mode); - powerON(POWER_ALL_2D); - irqInit(); + powerOn(POWER_ALL_2D); irqEnable(IRQ_VBLANK); - NDS_SetDisplayMode(_this, &mode); + NDS_SetDisplayMode(_this, &_this->displays[0], &mode); return 0; } static int -NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) +NDS_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { /* right now this function is just hard-coded for 256x192 ABGR1555 */ videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_BG_EXT_PALETTE | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_1D_BMP | DISPLAY_SPR_1D_BMP_SIZE_256 | /* (try 128 if 256 is trouble.) */ @@ -141,7 +138,7 @@ vramSetBankC(VRAM_C_SUB_BG_0x06200000); vramSetBankD(VRAM_D_MAIN_BG_0x06040000); /* not a typo. vram d can't sub */ vramSetBankE(VRAM_E_MAIN_SPRITE); - vramSetBankF(VRAM_F_OBJ_EXT_PALETTE); + vramSetBankF(VRAM_F_SPRITE_EXT_PALETTE); vramSetBankG(VRAM_G_BG_EXT_PALETTE); vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); vramSetBankI(VRAM_I_SUB_SPRITE);
--- a/src/video/nds/SDL_ndsvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/nds/SDL_ndsvideo.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/pandora/SDL_pandora.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/pandora/SDL_pandora.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 @@ -417,7 +417,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; EGLBoolean status; int32_t gfstatus; EGLint configs; @@ -816,7 +816,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; if (phdata->egl_initialized != SDL_TRUE) {
--- a/src/video/pandora/SDL_pandora.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/pandora/SDL_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 @@ -70,8 +70,6 @@ void PND_videoquit(_THIS); void PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display); int PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); -int PND_setdisplaygammaramp(_THIS, Uint16 * ramp); -int PND_getdisplaygammaramp(_THIS, Uint16 * ramp); int PND_createwindow(_THIS, SDL_Window * window); int PND_createwindowfrom(_THIS, SDL_Window * window, const void *data); void PND_setwindowtitle(_THIS, SDL_Window * window);
--- a/src/video/pandora/SDL_pandora_events.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/pandora/SDL_pandora_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/video/pandora/SDL_pandora_events.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/pandora/SDL_pandora_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
--- a/src/video/uikit/SDL_uikitappdelegate.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitappdelegate.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/uikit/SDL_uikitappdelegate.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitappdelegate.m Sat Feb 12 19:16:09 2011 -0800 @@ -1,23 +1,23 @@ /* - 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 "../SDL_sysvideo.h" @@ -110,14 +110,10 @@ if (!_this) { return; } - - int i; - for (i = 0; i < _this->num_displays; i++) { - const SDL_VideoDisplay *display = &_this->displays[i]; - SDL_Window *window; - for (window = display->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } + + SDL_Window *window; + for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } } @@ -130,14 +126,10 @@ if (!_this) { return; } - - int i; - for (i = 0; i < _this->num_displays; i++) { - const SDL_VideoDisplay *display = &_this->displays[i]; - SDL_Window *window; - for (window = display->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } + + SDL_Window *window; + for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } }
--- a/src/video/uikit/SDL_uikitevents.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitevents.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/uikit/SDL_uikitevents.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitevents.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/video/uikit/SDL_uikitkeyboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitkeyboard.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/uikit/SDL_uikitopengles.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitopengles.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/uikit/SDL_uikitopengles.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitopengles.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 +*/ #include "SDL_uikitopengles.h" #include "SDL_uikitopenglview.h" @@ -103,7 +103,7 @@ { SDL_uikitopenglview *view; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - UIScreen *uiscreen = (UIScreen *) window->display->driverdata; + UIScreen *uiscreen = (UIScreen *) SDL_GetDisplayForWindow(window)->driverdata; UIWindow *uiwindow = data->uiwindow; /* construct our view, passing in SDL's OpenGL configuration data */
--- a/src/video/uikit/SDL_uikitopenglview.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitopenglview.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/uikit/SDL_uikitopenglview.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitopenglview.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 <QuartzCore/QuartzCore.h> #import <OpenGLES/EAGLDrawable.h>
--- a/src/video/uikit/SDL_uikitvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitvideo.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/uikit/SDL_uikitvideo.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitvideo.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/video/uikit/SDL_uikitview.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitview.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/uikit/SDL_uikitview.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitview.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 "SDL_uikitview.h" @@ -267,10 +267,10 @@ unichar c = [string characterAtIndex: i]; Uint16 mod = 0; - SDL_ScanCode code; + SDL_Scancode code; if (c < 127) { - /* figure out the SDL_ScanCode and SDL_keymod for this unichar */ + /* figure out the SDL_Scancode and SDL_keymod for this unichar */ code = unicharToUIKeyInfoTable[c].code; mod = unicharToUIKeyInfoTable[c].mod; }
--- a/src/video/uikit/SDL_uikitwindow.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitwindow.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/uikit/SDL_uikitwindow.m Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/SDL_uikitwindow.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 @@ -40,7 +40,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); UIScreen *uiscreen = (UIScreen *) display->driverdata; SDL_WindowData *data; @@ -64,7 +64,6 @@ window->driverdata = data; window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ - window->flags |= SDL_WINDOW_OPENGL; /* window is always OpenGL */ window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ window->flags |= SDL_WINDOW_SHOWN; /* only one window on iPod touch, always shown */ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ @@ -85,13 +84,13 @@ } int -UIKit_CreateWindow(_THIS, SDL_Window *window) { - - SDL_VideoDisplay *display = window->display; +UIKit_CreateWindow(_THIS, SDL_Window *window) +{ + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); UIScreen *uiscreen = (UIScreen *) display->driverdata; // SDL currently puts this window at the start of display's linked list. We rely on this. - SDL_assert(display->windows == window); + SDL_assert(_this->windows == window); /* We currently only handle a single window per display on iPhone */ if (window->next != NULL) {
--- a/src/video/uikit/keyinfotable.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/uikit/keyinfotable.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,14 +27,14 @@ /* This file is used by the keyboard code in SDL_uikitview.m to convert between characters - passed in from the iPhone's virtual keyboard, and tuples of SDL_ScanCodes and SDL_keymods. + passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower case a. */ typedef struct { - SDL_ScanCode code; + SDL_Scancode code; Uint16 mod; } UIKitKeyInfo;
--- a/src/video/windows/SDL_msctf.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_msctf.h Sat Feb 12 19:16:09 2011 -0800 @@ -1,221 +1,221 @@ -#ifndef _SDL_msctf_h -#define _SDL_msctf_h - -#include <unknwn.h> - -#define TF_INVALID_COOKIE (0xffffffff) -#define TF_IPSINK_FLAG_ACTIVE 0x0001 -#define TF_TMAE_UIELEMENTENABLEDONLY 0x00000004 - -typedef struct ITfThreadMgr ITfThreadMgr; -typedef struct ITfDocumentMgr ITfDocumentMgr; -typedef struct ITfClientId ITfClientId; - -typedef struct IEnumTfDocumentMgrs IEnumTfDocumentMgrs; -typedef struct IEnumTfFunctionProviders IEnumTfFunctionProviders; -typedef struct ITfFunctionProvider ITfFunctionProvider; -typedef struct ITfCompartmentMgr ITfCompartmentMgr; -typedef struct ITfContext ITfContext; -typedef struct IEnumTfContexts IEnumTfContexts; -typedef struct ITfUIElementSink ITfUIElementSink; -typedef struct ITfUIElement ITfUIElement; -typedef struct ITfUIElementMgr ITfUIElementMgr; -typedef struct IEnumTfUIElements IEnumTfUIElements; -typedef struct ITfThreadMgrEx ITfThreadMgrEx; -typedef struct ITfCandidateListUIElement ITfCandidateListUIElement; -typedef struct ITfReadingInformationUIElement ITfReadingInformationUIElement; -typedef struct ITfInputProcessorProfileActivationSink ITfInputProcessorProfileActivationSink; -typedef struct ITfSource ITfSource; - -typedef DWORD TfClientId; -typedef DWORD TfEditCookie; - -typedef struct ITfThreadMgrVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgr *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgr *); - ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgr *); - HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgr *, TfClientId *); - HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgr *); - HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgr *); - HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgr *, IEnumTfDocumentMgrs **); - HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgr *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgr *, ITfDocumentMgr *); - HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgr *, HWND, ITfDocumentMgr *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgr *, BOOL *); - HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgr *, REFCLSID, ITfFunctionProvider **); - HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgr *, IEnumTfFunctionProviders **); - HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgr *, ITfCompartmentMgr **); -} ITfThreadMgrVtbl; - -struct ITfThreadMgr -{ - const struct ITfThreadMgrVtbl *lpVtbl; -}; - -typedef struct ITfThreadMgrExVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgrEx *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgrEx *); - ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgrEx *); - HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgrEx *, TfClientId *); - HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgrEx *); - HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgrEx *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgrEx *, IEnumTfDocumentMgrs **); - HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgrEx *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgrEx *, ITfDocumentMgr *); - HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgrEx *, ITfDocumentMgr *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgrEx *, BOOL *); - HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgrEx *, REFCLSID, ITfFunctionProvider **); - HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgrEx *, IEnumTfFunctionProviders **); - HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgrEx *, ITfCompartmentMgr **); - HRESULT (STDMETHODCALLTYPE *ActivateEx)(ITfThreadMgrEx *, TfClientId *, DWORD); - HRESULT (STDMETHODCALLTYPE *GetActiveFlags)(ITfThreadMgrEx *, DWORD *); -} ITfThreadMgrExVtbl; - -struct ITfThreadMgrEx -{ - const struct ITfThreadMgrExVtbl *lpVtbl; -}; - -typedef struct ITfDocumentMgrVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfDocumentMgr *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfDocumentMgr *); - ULONG (STDMETHODCALLTYPE *Release)(ITfDocumentMgr *); - HRESULT (STDMETHODCALLTYPE *CreateContext)(ITfDocumentMgr *, TfClientId, DWORD, IUnknown *, ITfContext **, TfEditCookie *); - HRESULT (STDMETHODCALLTYPE *Push)(ITfDocumentMgr *, ITfContext *); - HRESULT (STDMETHODCALLTYPE *Pop)(ITfDocumentMgr *); - HRESULT (STDMETHODCALLTYPE *GetTop)(ITfDocumentMgr *, ITfContext **); - HRESULT (STDMETHODCALLTYPE *GetBase)(ITfDocumentMgr *, ITfContext **); - HRESULT (STDMETHODCALLTYPE *EnumContexts)(ITfDocumentMgr *, IEnumTfContexts **); -} ITfDocumentMgrVtbl; - -struct ITfDocumentMgr -{ - const struct ITfDocumentMgrVtbl *lpVtbl; -}; - -typedef struct ITfUIElementSinkVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementSink *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementSink *); - ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementSink *); - HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementSink *, DWORD, BOOL *); - HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementSink *, DWORD); - HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementSink *, DWORD); -} ITfUIElementSinkVtbl; - -struct ITfUIElementSink -{ - const struct ITfUIElementSinkVtbl *lpVtbl; -}; - -typedef struct ITfUIElementMgrVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementMgr *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementMgr *); - ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementMgr *); - HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementMgr *, ITfUIElement *, BOOL *, DWORD *); - HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementMgr *, DWORD); - HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementMgr *, DWORD); - HRESULT (STDMETHODCALLTYPE *GetUIElement)(ITfUIElementMgr *, DWORD, ITfUIElement **); - HRESULT (STDMETHODCALLTYPE *EnumUIElements)(ITfUIElementMgr *, IEnumTfUIElements **); -} ITfUIElementMgrVtbl; - -struct ITfUIElementMgr -{ - const struct ITfUIElementMgrVtbl *lpVtbl; -}; - -typedef struct ITfCandidateListUIElementVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfCandidateListUIElement *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfCandidateListUIElement *); - ULONG (STDMETHODCALLTYPE *Release)(ITfCandidateListUIElement *); - HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfCandidateListUIElement *, BSTR *); - HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfCandidateListUIElement *, GUID *); - HRESULT (STDMETHODCALLTYPE *Show)(ITfCandidateListUIElement *, BOOL); - HRESULT (STDMETHODCALLTYPE *IsShown)(ITfCandidateListUIElement *, BOOL *); - HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfCandidateListUIElement *, DWORD *); - HRESULT (STDMETHODCALLTYPE *GetDocumentMgr)(ITfCandidateListUIElement *, ITfDocumentMgr **); - HRESULT (STDMETHODCALLTYPE *GetCount)(ITfCandidateListUIElement *, UINT *); - HRESULT (STDMETHODCALLTYPE *GetSelection)(ITfCandidateListUIElement *, UINT *); - HRESULT (STDMETHODCALLTYPE *GetString)(ITfCandidateListUIElement *, UINT, BSTR *); - HRESULT (STDMETHODCALLTYPE *GetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT, UINT *); - HRESULT (STDMETHODCALLTYPE *SetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT); - HRESULT (STDMETHODCALLTYPE *GetCurrentPage)(ITfCandidateListUIElement *, UINT *); -} ITfCandidateListUIElementVtbl; - -struct ITfCandidateListUIElement -{ - const struct ITfCandidateListUIElementVtbl *lpVtbl; -}; - -typedef struct ITfReadingInformationUIElementVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfReadingInformationUIElement *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfReadingInformationUIElement *); - ULONG (STDMETHODCALLTYPE *Release)(ITfReadingInformationUIElement *); - HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfReadingInformationUIElement *, BSTR *); - HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfReadingInformationUIElement *, GUID *); - HRESULT (STDMETHODCALLTYPE *Show)(ITfReadingInformationUIElement *, BOOL); - HRESULT (STDMETHODCALLTYPE *IsShown)(ITfReadingInformationUIElement *, BOOL *); - HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfReadingInformationUIElement *, DWORD *); - HRESULT (STDMETHODCALLTYPE *GetContext)(ITfReadingInformationUIElement *, ITfContext **); - HRESULT (STDMETHODCALLTYPE *GetString)(ITfReadingInformationUIElement *, BSTR *); - HRESULT (STDMETHODCALLTYPE *GetMaxReadingStringLength)(ITfReadingInformationUIElement *, UINT *); - HRESULT (STDMETHODCALLTYPE *GetErrorIndex)(ITfReadingInformationUIElement *, UINT *); - HRESULT (STDMETHODCALLTYPE *IsVerticalOrderPreferred)(ITfReadingInformationUIElement *, BOOL *); -} ITfReadingInformationUIElementVtbl; - -struct ITfReadingInformationUIElement -{ - const struct ITfReadingInformationUIElementVtbl *lpVtbl; -}; - -typedef struct ITfUIElementVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElement *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElement *); - ULONG (STDMETHODCALLTYPE *Release)(ITfUIElement *); - HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfUIElement *, BSTR *); - HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfUIElement *, GUID *); - HRESULT (STDMETHODCALLTYPE *Show)(ITfUIElement *, BOOL); - HRESULT (STDMETHODCALLTYPE *IsShown)(ITfUIElement *, BOOL *); -} ITfUIElementVtbl; - -struct ITfUIElement -{ - const struct ITfUIElementVtbl *lpVtbl; -}; - -typedef struct ITfInputProcessorProfileActivationSinkVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfInputProcessorProfileActivationSink *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfInputProcessorProfileActivationSink *); - ULONG (STDMETHODCALLTYPE *Release)(ITfInputProcessorProfileActivationSink *); - HRESULT (STDMETHODCALLTYPE *OnActivated)(ITfInputProcessorProfileActivationSink *, DWORD, LANGID, REFCLSID, REFGUID, REFGUID, HKL, DWORD); - -} ITfInputProcessorProfileActivationSinkVtbl; - -struct ITfInputProcessorProfileActivationSink -{ - const struct ITfInputProcessorProfileActivationSinkVtbl *lpVtbl; -}; - -typedef struct ITfSourceVtbl -{ - HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfSource *, REFIID, void **); - ULONG (STDMETHODCALLTYPE *AddRef)(ITfSource *); - ULONG (STDMETHODCALLTYPE *Release)(ITfSource *); - HRESULT (STDMETHODCALLTYPE *AdviseSink)(ITfSource *, REFIID, IUnknown *, DWORD *); - HRESULT (STDMETHODCALLTYPE *UnadviseSink)(ITfSource *, DWORD); -} ITfSourceVtbl; - -struct ITfSource -{ - const struct ITfSourceVtbl *lpVtbl; -}; - -#endif /* _SDL_msctf_h */ +#ifndef _SDL_msctf_h +#define _SDL_msctf_h + +#include <unknwn.h> + +#define TF_INVALID_COOKIE (0xffffffff) +#define TF_IPSINK_FLAG_ACTIVE 0x0001 +#define TF_TMAE_UIELEMENTENABLEDONLY 0x00000004 + +typedef struct ITfThreadMgr ITfThreadMgr; +typedef struct ITfDocumentMgr ITfDocumentMgr; +typedef struct ITfClientId ITfClientId; + +typedef struct IEnumTfDocumentMgrs IEnumTfDocumentMgrs; +typedef struct IEnumTfFunctionProviders IEnumTfFunctionProviders; +typedef struct ITfFunctionProvider ITfFunctionProvider; +typedef struct ITfCompartmentMgr ITfCompartmentMgr; +typedef struct ITfContext ITfContext; +typedef struct IEnumTfContexts IEnumTfContexts; +typedef struct ITfUIElementSink ITfUIElementSink; +typedef struct ITfUIElement ITfUIElement; +typedef struct ITfUIElementMgr ITfUIElementMgr; +typedef struct IEnumTfUIElements IEnumTfUIElements; +typedef struct ITfThreadMgrEx ITfThreadMgrEx; +typedef struct ITfCandidateListUIElement ITfCandidateListUIElement; +typedef struct ITfReadingInformationUIElement ITfReadingInformationUIElement; +typedef struct ITfInputProcessorProfileActivationSink ITfInputProcessorProfileActivationSink; +typedef struct ITfSource ITfSource; + +typedef DWORD TfClientId; +typedef DWORD TfEditCookie; + +typedef struct ITfThreadMgrVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgr *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgr *); + ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgr *); + HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgr *, TfClientId *); + HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgr *); + HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgr *); + HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgr *, IEnumTfDocumentMgrs **); + HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgr *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgr *, ITfDocumentMgr *); + HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgr *, HWND, ITfDocumentMgr *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgr *, BOOL *); + HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgr *, REFCLSID, ITfFunctionProvider **); + HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgr *, IEnumTfFunctionProviders **); + HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgr *, ITfCompartmentMgr **); +} ITfThreadMgrVtbl; + +struct ITfThreadMgr +{ + const struct ITfThreadMgrVtbl *lpVtbl; +}; + +typedef struct ITfThreadMgrExVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgrEx *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgrEx *); + ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgrEx *); + HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgrEx *, TfClientId *); + HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgrEx *); + HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgrEx *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgrEx *, IEnumTfDocumentMgrs **); + HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgrEx *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgrEx *, ITfDocumentMgr *); + HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgrEx *, ITfDocumentMgr *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgrEx *, BOOL *); + HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgrEx *, REFCLSID, ITfFunctionProvider **); + HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgrEx *, IEnumTfFunctionProviders **); + HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgrEx *, ITfCompartmentMgr **); + HRESULT (STDMETHODCALLTYPE *ActivateEx)(ITfThreadMgrEx *, TfClientId *, DWORD); + HRESULT (STDMETHODCALLTYPE *GetActiveFlags)(ITfThreadMgrEx *, DWORD *); +} ITfThreadMgrExVtbl; + +struct ITfThreadMgrEx +{ + const struct ITfThreadMgrExVtbl *lpVtbl; +}; + +typedef struct ITfDocumentMgrVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfDocumentMgr *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfDocumentMgr *); + ULONG (STDMETHODCALLTYPE *Release)(ITfDocumentMgr *); + HRESULT (STDMETHODCALLTYPE *CreateContext)(ITfDocumentMgr *, TfClientId, DWORD, IUnknown *, ITfContext **, TfEditCookie *); + HRESULT (STDMETHODCALLTYPE *Push)(ITfDocumentMgr *, ITfContext *); + HRESULT (STDMETHODCALLTYPE *Pop)(ITfDocumentMgr *); + HRESULT (STDMETHODCALLTYPE *GetTop)(ITfDocumentMgr *, ITfContext **); + HRESULT (STDMETHODCALLTYPE *GetBase)(ITfDocumentMgr *, ITfContext **); + HRESULT (STDMETHODCALLTYPE *EnumContexts)(ITfDocumentMgr *, IEnumTfContexts **); +} ITfDocumentMgrVtbl; + +struct ITfDocumentMgr +{ + const struct ITfDocumentMgrVtbl *lpVtbl; +}; + +typedef struct ITfUIElementSinkVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementSink *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementSink *); + ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementSink *); + HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementSink *, DWORD, BOOL *); + HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementSink *, DWORD); + HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementSink *, DWORD); +} ITfUIElementSinkVtbl; + +struct ITfUIElementSink +{ + const struct ITfUIElementSinkVtbl *lpVtbl; +}; + +typedef struct ITfUIElementMgrVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementMgr *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementMgr *); + ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementMgr *); + HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementMgr *, ITfUIElement *, BOOL *, DWORD *); + HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementMgr *, DWORD); + HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementMgr *, DWORD); + HRESULT (STDMETHODCALLTYPE *GetUIElement)(ITfUIElementMgr *, DWORD, ITfUIElement **); + HRESULT (STDMETHODCALLTYPE *EnumUIElements)(ITfUIElementMgr *, IEnumTfUIElements **); +} ITfUIElementMgrVtbl; + +struct ITfUIElementMgr +{ + const struct ITfUIElementMgrVtbl *lpVtbl; +}; + +typedef struct ITfCandidateListUIElementVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfCandidateListUIElement *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfCandidateListUIElement *); + ULONG (STDMETHODCALLTYPE *Release)(ITfCandidateListUIElement *); + HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfCandidateListUIElement *, BSTR *); + HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfCandidateListUIElement *, GUID *); + HRESULT (STDMETHODCALLTYPE *Show)(ITfCandidateListUIElement *, BOOL); + HRESULT (STDMETHODCALLTYPE *IsShown)(ITfCandidateListUIElement *, BOOL *); + HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfCandidateListUIElement *, DWORD *); + HRESULT (STDMETHODCALLTYPE *GetDocumentMgr)(ITfCandidateListUIElement *, ITfDocumentMgr **); + HRESULT (STDMETHODCALLTYPE *GetCount)(ITfCandidateListUIElement *, UINT *); + HRESULT (STDMETHODCALLTYPE *GetSelection)(ITfCandidateListUIElement *, UINT *); + HRESULT (STDMETHODCALLTYPE *GetString)(ITfCandidateListUIElement *, UINT, BSTR *); + HRESULT (STDMETHODCALLTYPE *GetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT, UINT *); + HRESULT (STDMETHODCALLTYPE *SetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT); + HRESULT (STDMETHODCALLTYPE *GetCurrentPage)(ITfCandidateListUIElement *, UINT *); +} ITfCandidateListUIElementVtbl; + +struct ITfCandidateListUIElement +{ + const struct ITfCandidateListUIElementVtbl *lpVtbl; +}; + +typedef struct ITfReadingInformationUIElementVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfReadingInformationUIElement *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfReadingInformationUIElement *); + ULONG (STDMETHODCALLTYPE *Release)(ITfReadingInformationUIElement *); + HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfReadingInformationUIElement *, BSTR *); + HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfReadingInformationUIElement *, GUID *); + HRESULT (STDMETHODCALLTYPE *Show)(ITfReadingInformationUIElement *, BOOL); + HRESULT (STDMETHODCALLTYPE *IsShown)(ITfReadingInformationUIElement *, BOOL *); + HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfReadingInformationUIElement *, DWORD *); + HRESULT (STDMETHODCALLTYPE *GetContext)(ITfReadingInformationUIElement *, ITfContext **); + HRESULT (STDMETHODCALLTYPE *GetString)(ITfReadingInformationUIElement *, BSTR *); + HRESULT (STDMETHODCALLTYPE *GetMaxReadingStringLength)(ITfReadingInformationUIElement *, UINT *); + HRESULT (STDMETHODCALLTYPE *GetErrorIndex)(ITfReadingInformationUIElement *, UINT *); + HRESULT (STDMETHODCALLTYPE *IsVerticalOrderPreferred)(ITfReadingInformationUIElement *, BOOL *); +} ITfReadingInformationUIElementVtbl; + +struct ITfReadingInformationUIElement +{ + const struct ITfReadingInformationUIElementVtbl *lpVtbl; +}; + +typedef struct ITfUIElementVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElement *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElement *); + ULONG (STDMETHODCALLTYPE *Release)(ITfUIElement *); + HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfUIElement *, BSTR *); + HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfUIElement *, GUID *); + HRESULT (STDMETHODCALLTYPE *Show)(ITfUIElement *, BOOL); + HRESULT (STDMETHODCALLTYPE *IsShown)(ITfUIElement *, BOOL *); +} ITfUIElementVtbl; + +struct ITfUIElement +{ + const struct ITfUIElementVtbl *lpVtbl; +}; + +typedef struct ITfInputProcessorProfileActivationSinkVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfInputProcessorProfileActivationSink *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfInputProcessorProfileActivationSink *); + ULONG (STDMETHODCALLTYPE *Release)(ITfInputProcessorProfileActivationSink *); + HRESULT (STDMETHODCALLTYPE *OnActivated)(ITfInputProcessorProfileActivationSink *, DWORD, LANGID, REFCLSID, REFGUID, REFGUID, HKL, DWORD); + +} ITfInputProcessorProfileActivationSinkVtbl; + +struct ITfInputProcessorProfileActivationSink +{ + const struct ITfInputProcessorProfileActivationSinkVtbl *lpVtbl; +}; + +typedef struct ITfSourceVtbl +{ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfSource *, REFIID, void **); + ULONG (STDMETHODCALLTYPE *AddRef)(ITfSource *); + ULONG (STDMETHODCALLTYPE *Release)(ITfSource *); + HRESULT (STDMETHODCALLTYPE *AdviseSink)(ITfSource *, REFIID, IUnknown *, DWORD *); + HRESULT (STDMETHODCALLTYPE *UnadviseSink)(ITfSource *, DWORD); +} ITfSourceVtbl; + +struct ITfSource +{ + const struct ITfSourceVtbl *lpVtbl; +}; + +#endif /* _SDL_msctf_h */
--- a/src/video/windows/SDL_vkeys.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_vkeys.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/windows/SDL_windowsclipboard.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsclipboard.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 @@ -37,15 +37,11 @@ static HWND GetWindowHandle(_THIS) { - SDL_VideoDisplay *display; SDL_Window *window; - display = _this->displays; - if (display) { - window = display->windows; - if (window) { - return ((SDL_WindowData *) window->driverdata)->hwnd; - } + window = _this->windows; + if (window) { + return ((SDL_WindowData *) window->driverdata)->hwnd; } return NULL; }
--- a/src/video/windows/SDL_windowsclipboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsclipboard.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/windows/SDL_windowsevents.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsevents.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/windows/SDL_windowsevents.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsevents.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/windows/SDL_windowsframebuffer.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsframebuffer.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/windows/SDL_windowsframebuffer.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsframebuffer.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/windows/SDL_windowsgamma.c Sun Feb 06 23:48:31 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +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" - -#include "SDL_windowsvideo.h" - - -int -WIN_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp) -{ -#ifdef _WIN32_WCE - return -1; -#else - SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; - HDC hdc; - BOOL succeeded = FALSE; - - hdc = CreateDC(data->DeviceName, NULL, NULL, NULL); - if (hdc) { - succeeded = SetDeviceGammaRamp(hdc, ramp); - if (!succeeded) { - WIN_SetError("SetDeviceGammaRamp()"); - } - DeleteDC(hdc); - } - return succeeded ? 0 : -1; -#endif -} - -int -WIN_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp) -{ -#ifdef _WIN32_WCE - return -1; -#else - SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; - HDC hdc; - BOOL succeeded = FALSE; - - hdc = CreateDC(data->DeviceName, NULL, NULL, NULL); - if (hdc) { - succeeded = GetDeviceGammaRamp(hdc, ramp); - if (!succeeded) { - WIN_SetError("GetDeviceGammaRamp()"); - } - DeleteDC(hdc); - } - return succeeded ? 0 : -1; -#endif -} - -/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowsgamma.h Sun Feb 06 23:48:31 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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" - -#ifndef _SDL_windowsgamma_h -#define _SDL_windowsgamma_h - -extern int WIN_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp); -extern int WIN_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp); - -#endif /* _SDL_windowsgamma_h */ - -/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_windowskeyboard.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowskeyboard.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 @@ -150,8 +150,8 @@ WIN_UpdateKeymap() { int i; - SDL_ScanCode scancode; - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Scancode scancode; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; SDL_GetDefaultKeymap(keymap);
--- a/src/video/windows/SDL_windowskeyboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowskeyboard.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/windows/SDL_windowsmodes.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsmodes.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 @@ -217,8 +217,8 @@ // WINCE: DEVMODE.dmPosition not found, or may be mingw32ce bug rect->x = 0; rect->y = 0; - rect->w = display->windows->w; - rect->h = display->windows->h; + rect->w = _this->windows->w; + rect->h = _this->windows->h; #else rect->x = (int)data->DeviceMode.dmPosition.x; rect->y = (int)data->DeviceMode.dmPosition.y;
--- a/src/video/windows/SDL_windowsmodes.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsmodes.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/windows/SDL_windowsmouse.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsmouse.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/windows/SDL_windowsmouse.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsmouse.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/windows/SDL_windowsopengl.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsopengl.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/windows/SDL_windowsopengl.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsopengl.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/windows/SDL_windowsvideo.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsvideo.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 @@ -109,8 +109,6 @@ device->GetDisplayBounds = WIN_GetDisplayBounds; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; - device->SetDisplayGammaRamp = WIN_SetDisplayGammaRamp; - device->GetDisplayGammaRamp = WIN_GetDisplayGammaRamp; device->PumpEvents = WIN_PumpEvents; #undef CreateWindow
--- a/src/video/windows/SDL_windowsvideo.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowsvideo.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 @@ -41,7 +41,6 @@ #include "SDL_windowsclipboard.h" #include "SDL_windowsevents.h" -#include "SDL_windowsgamma.h" #include "SDL_windowskeyboard.h" #include "SDL_windowsmodes.h" #include "SDL_windowsmouse.h" @@ -123,7 +122,7 @@ PFCoordTransform CoordTransform; #endif - const SDL_ScanCode *key_layout; + const SDL_Scancode *key_layout; DWORD clipboard_count; /* Touch input functions */
--- a/src/video/windows/SDL_windowswindow.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowswindow.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 @@ -46,7 +46,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_WindowData *data; /* Allocate the window data */ @@ -93,10 +93,8 @@ point.x = 0; point.y = 0; if (ClientToScreen(hwnd, &point)) { - SDL_Rect bounds; - WIN_GetDisplayBounds(_this, display, &bounds); - window->x = point.x - bounds.x; - window->y = point.y - bounds.y; + window->x = point.x; + window->y = point.y; } } { @@ -166,7 +164,7 @@ int WIN_CreateWindow(_THIS, SDL_Window * window) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); HWND hwnd; RECT rect; SDL_Rect bounds; @@ -203,28 +201,28 @@ } } if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->x == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->x)) { x = bounds.x + (bounds.w - w) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { if (bounds.x == 0) { x = CW_USEDEFAULT; } else { x = bounds.x; } } else { - x = bounds.x + window->x + rect.left; + x = window->x + rect.left; } if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->y == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->y)) { y = bounds.y + (bounds.h - h) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { if (bounds.x == 0) { y = CW_USEDEFAULT; } else { y = bounds.y; } } else { - y = bounds.y + window->y + rect.top; + y = window->y + rect.top; } hwnd = @@ -366,7 +364,7 @@ void WIN_SetWindowPosition(_THIS, SDL_Window * window) { - SDL_VideoDisplay *display = window->display; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; RECT rect; SDL_Rect bounds; @@ -406,16 +404,16 @@ } } if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->x == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->x)) { x = bounds.x + (bounds.w - w) / 2; } else { - x = bounds.x + window->x + rect.left; + x = window->x + rect.left; } if ((window->flags & SDL_WINDOW_FULLSCREEN) - || window->y == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->y)) { y = bounds.y + (bounds.h - h) / 2; } else { - y = bounds.y + window->y + rect.top; + y = window->y + rect.top; } SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE)); @@ -452,35 +450,35 @@ h = (rect.bottom - rect.top); SetWindowPos(hwnd, top, 0, 0, w, h, (SWP_NOCOPYBITS | SWP_NOMOVE)); -} +} + +#ifdef _WIN32_WCE +void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible) +{ + SDL_WindowData* windowdata = (SDL_WindowData*) window->driverdata; + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + + if(visible) { + if(window->flags & SDL_WINDOW_FULLSCREEN) { + if(videodata->SHFullScreen) + videodata->SHFullScreen(windowdata->hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); -#ifdef _WIN32_WCE -void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible) -{ - SDL_WindowData* windowdata = (SDL_WindowData*) window->driverdata; - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - - if(visible) { - if(window->flags & SDL_WINDOW_FULLSCREEN) { - if(videodata->SHFullScreen) - videodata->SHFullScreen(windowdata->hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); - - ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_HIDE); - } - - ShowWindow(windowdata->hwnd, SW_SHOW); - SetForegroundWindow(windowdata->hwnd); - } else { - ShowWindow(windowdata->hwnd, SW_HIDE); - - if(window->flags & SDL_WINDOW_FULLSCREEN) { - if(videodata->SHFullScreen) - videodata->SHFullScreen(windowdata->hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); - - ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_SHOW); - - } - } + ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_HIDE); + } + + ShowWindow(windowdata->hwnd, SW_SHOW); + SetForegroundWindow(windowdata->hwnd); + } else { + ShowWindow(windowdata->hwnd, SW_HIDE); + + if(window->flags & SDL_WINDOW_FULLSCREEN) { + if(videodata->SHFullScreen) + videodata->SHFullScreen(windowdata->hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); + + ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_SHOW); + + } + } } #endif /* _WIN32_WCE */
--- a/src/video/windows/SDL_windowswindow.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/windows/SDL_windowswindow.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/x11/SDL_x11clipboard.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11clipboard.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 @@ -38,15 +38,11 @@ static Window GetWindow(_THIS) { - SDL_VideoDisplay *display; SDL_Window *window; - display = _this->displays; - if (display) { - window = display->windows; - if (window) { - return ((SDL_WindowData *) window->driverdata)->xwindow; - } + window = _this->windows; + if (window) { + return ((SDL_WindowData *) window->driverdata)->xwindow; } return None; }
--- a/src/video/x11/SDL_x11clipboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11clipboard.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/x11/SDL_x11dyn.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11dyn.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/x11/SDL_x11dyn.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11dyn.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/x11/SDL_x11events.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11events.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 @@ -202,7 +202,7 @@ case KeyPress:{ KeyCode keycode = xevent.xkey.keycode; KeySym keysym = NoSymbol; - SDL_ScanCode scancode; + SDL_Scancode scancode; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; Status status = 0;
--- a/src/video/x11/SDL_x11events.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11events.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/x11/SDL_x11framebuffer.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11framebuffer.c 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/video/x11/SDL_x11framebuffer.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11framebuffer.h 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/video/x11/SDL_x11gamma.c Sun Feb 06 23:48:31 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +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" -#include "../SDL_sysvideo.h" -#include "SDL_x11video.h" - - /* The size of *all* SDL gamma ramps */ -#define SDL_GammaRampSize (3 * 256 * sizeof(Uint16)) - -static int numCmaps = 0; - -typedef struct -{ - Display *display; - int scrNum; - Colormap colormap; - Visual visual; - Uint16 *ramp; -} cmapTableEntry; - -cmapTableEntry *cmapTable = NULL; - -/* To reduce the overhead as much as possible lets do as little as - possible. When we do have to create a colormap keep track of it and - reuse it. We're going to do this for both DirectColor and - PseudoColor colormaps. */ - -Colormap -X11_LookupColormap(Display * display, int scrNum, VisualID vid) -{ - int i; - - for (i = 0; i < numCmaps; i++) { - if (cmapTable[i].display == display && - cmapTable[i].scrNum == scrNum && - cmapTable[i].visual.visualid == vid) { - return cmapTable[i].colormap; - } - } - - return 0; -} - - -void -X11_TrackColormap(Display * display, int scrNum, Colormap colormap, - Visual * visual, XColor * ramp) -{ - int i; - Uint16 *newramp; - int ncolors; - - /* search the table to find out if we already have this one. We - only want one entry for each display, screen number, visualid, - and colormap combination */ - for (i = 0; i < numCmaps; i++) { - if (cmapTable[i].display == display && - cmapTable[i].scrNum == scrNum && - cmapTable[i].visual.visualid == visual->visualid && - cmapTable[i].colormap == colormap) { - return; - } - } - - /* increase the table by one entry. If the table is NULL create the - first entrty */ - cmapTable = - SDL_realloc(cmapTable, (numCmaps + 1) * sizeof(cmapTableEntry)); - if (NULL == cmapTable) { - SDL_SetError("Out of memory in X11_TrackColormap()"); - return; - } - - cmapTable[numCmaps].display = display; - cmapTable[numCmaps].scrNum = scrNum; - cmapTable[numCmaps].colormap = colormap; - SDL_memcpy(&cmapTable[numCmaps].visual, visual, sizeof(Visual)); - cmapTable[numCmaps].ramp = NULL; - - if (ramp != NULL) { - newramp = SDL_malloc(SDL_GammaRampSize); - if (NULL == newramp) { - SDL_SetError("Out of memory in X11_TrackColormap()"); - return; - } - SDL_memset(newramp, 0, SDL_GammaRampSize); - cmapTable[numCmaps].ramp = newramp; - - ncolors = cmapTable[numCmaps].visual.map_entries; - - for (i = 0; i < ncolors; i++) { - newramp[(0 * 256) + i] = ramp[i].red; - newramp[(1 * 256) + i] = ramp[i].green; - newramp[(2 * 256) + i] = ramp[i].blue; - } - } - - numCmaps++; -} - -/* The problem is that you have to have at least one DirectColor - colormap before you can set the gamma ramps or read the gamma - ramps. If the application has created a DirectColor window then the - cmapTable will have at least one colormap in it and everything is - cool. If not, then we just fail */ - -int -X11_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * sdl_display, Uint16 * ramp) -{ - Visual *visual; - Display *display; - Colormap colormap; - XColor *colorcells; - int ncolors; - int rmask, gmask, bmask; - int rshift, gshift, bshift; - int i; - int j; - - for (j = 0; j < numCmaps; j++) { - if (cmapTable[j].visual.class == DirectColor) { - display = cmapTable[j].display; - colormap = cmapTable[j].colormap; - ncolors = cmapTable[j].visual.map_entries; - visual = &cmapTable[j].visual; - - colorcells = SDL_malloc(ncolors * sizeof(XColor)); - if (NULL == colorcells) { - SDL_SetError("out of memory in X11_SetDisplayGammaRamp"); - return -1; - } - /* remember the new ramp */ - if (cmapTable[j].ramp == NULL) { - Uint16 *newramp = SDL_malloc(SDL_GammaRampSize); - if (NULL == newramp) { - SDL_SetError("Out of memory in X11_TrackColormap()"); - return -1; - } - cmapTable[j].ramp = newramp; - } - SDL_memcpy(cmapTable[j].ramp, ramp, SDL_GammaRampSize); - - rshift = 0; - rmask = visual->red_mask; - while (0 == (rmask & 1)) { - rshift++; - rmask >>= 1; - } - -/* printf("rmask = %4x rshift = %4d\n", rmask, rshift); */ - - gshift = 0; - gmask = visual->green_mask; - while (0 == (gmask & 1)) { - gshift++; - gmask >>= 1; - } - -/* printf("gmask = %4x gshift = %4d\n", gmask, gshift); */ - - bshift = 0; - bmask = visual->blue_mask; - while (0 == (bmask & 1)) { - bshift++; - bmask >>= 1; - } - -/* printf("bmask = %4x bshift = %4d\n", bmask, bshift); */ - - /* build the color table pixel values */ - for (i = 0; i < ncolors; i++) { - Uint32 rbits = (rmask * i) / (ncolors - 1); - Uint32 gbits = (gmask * i) / (ncolors - 1); - Uint32 bbits = (bmask * i) / (ncolors - 1); - - Uint32 pix = - (rbits << rshift) | (gbits << gshift) | (bbits << bshift); - - colorcells[i].pixel = pix; - - colorcells[i].flags = DoRed | DoGreen | DoBlue; - - colorcells[i].red = ramp[(0 * 256) + i]; - colorcells[i].green = ramp[(1 * 256) + i]; - colorcells[i].blue = ramp[(2 * 256) + i]; - } - - XStoreColors(display, colormap, colorcells, ncolors); - XFlush(display); - SDL_free(colorcells); - } - } - - return 0; -} - -int -X11_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp) -{ - int i; - - /* find the first DirectColor colormap and use it to get the gamma - ramp */ - - for (i = 0; i < numCmaps; i++) { - if (cmapTable[i].visual.class == DirectColor) { - SDL_memcpy(ramp, cmapTable[i].ramp, SDL_GammaRampSize); - return 0; - } - } - - return -1; -}
--- a/src/video/x11/SDL_x11gamma.h Sun Feb 06 23:48:31 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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" - -#ifndef _SDL_x11gamma_h -#define _SDL_x11gamma_h - -extern Colormap X11_LookupColormap(Display * display, int scrNum, - VisualID vid); -extern void X11_TrackColormap(Display * display, int scrNum, - Colormap colormap, - Visual * visual, XColor * ramp); - -extern int X11_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp); -extern int X11_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp); - -#endif
--- a/src/video/x11/SDL_x11keyboard.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11keyboard.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 @@ -34,7 +34,7 @@ /* *INDENT-OFF* */ static const struct { KeySym keysym; - SDLKey sdlkey; + SDL_Keycode sdlkey; } KeySymToSDLKey[] = { { XK_Return, SDLK_RETURN }, { XK_Escape, SDLK_ESCAPE }, @@ -134,7 +134,7 @@ static const struct { - const SDL_ScanCode const *table; + const SDL_Scancode const *table; int table_size; } scancode_set[] = { { darwin_scancode_table, SDL_arraysize(darwin_scancode_table) }, @@ -143,7 +143,7 @@ }; /* *INDENT-OFF* */ -static SDLKey +static SDL_Keycode X11_KeyCodeToSDLKey(Display *display, KeyCode keycode) { KeySym keysym; @@ -157,7 +157,7 @@ ucs4 = X11_KeySymToUcs4(keysym); if (ucs4) { - return (SDLKey) ucs4; + return (SDL_Keycode) ucs4; } for (i = 0; i < SDL_arraysize(KeySymToSDLKey); ++i) { @@ -175,7 +175,7 @@ int i, j; int min_keycode, max_keycode; struct { - SDL_ScanCode scancode; + SDL_Scancode scancode; KeySym keysym; int value; } fingerprint[] = { @@ -215,14 +215,14 @@ printf("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", i, min_keycode, max_keycode, scancode_set[i].table_size); #endif SDL_memcpy(&data->key_layout[min_keycode], scancode_set[i].table, - sizeof(SDL_ScanCode) * scancode_set[i].table_size); + sizeof(SDL_Scancode) * scancode_set[i].table_size); fingerprint_detected = SDL_TRUE; break; } } if (!fingerprint_detected) { - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; printf ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n"); @@ -233,13 +233,13 @@ KeySym sym; sym = XKeycodeToKeysym(data->display, i, 0); if (sym != NoSymbol) { - SDLKey key; + SDL_Keycode key; printf("code = %d, sym = 0x%X (%s) ", i - min_keycode, (unsigned int) sym, XKeysymToString(sym)); key = X11_KeyCodeToSDLKey(data->display, i); for (j = 0; j < SDL_arraysize(keymap); ++j) { if (keymap[j] == key) { - data->key_layout[i] = (SDL_ScanCode) j; + data->key_layout[i] = (SDL_Scancode) j; break; } } @@ -264,8 +264,8 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; int i; - SDL_ScanCode scancode; - SDLKey keymap[SDL_NUM_SCANCODES]; + SDL_Scancode scancode; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; SDL_zero(keymap);
--- a/src/video/x11/SDL_x11keyboard.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11keyboard.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/x11/SDL_x11modes.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11modes.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 @@ -47,9 +47,7 @@ } depth = DefaultDepth(display, screen); - if ((X11_UseDirectColorVisuals() && - XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) || - XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) || + if (XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) || XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) || XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) { return 0;
--- a/src/video/x11/SDL_x11modes.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11modes.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/x11/SDL_x11mouse.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11mouse.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/x11/SDL_x11mouse.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11mouse.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/x11/SDL_x11opengl.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11opengl.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 @@ -220,7 +220,7 @@ X11_GL_InitExtensions(_THIS) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; - int screen = ((SDL_DisplayData *) SDL_CurrentDisplay->driverdata)->screen; + int screen = DefaultScreen(display); XVisualInfo *vinfo; XSetWindowAttributes xattr; Window w; @@ -365,22 +365,9 @@ GLX_SLOW_VISUAL_EXT; } -#ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */ - if (X11_UseDirectColorVisuals()) { - attribs[i++] = GLX_X_VISUAL_TYPE; - attribs[i++] = GLX_DIRECT_COLOR; - } -#endif - attribs[i++] = None; vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); -#ifdef GLX_DIRECT_COLOR - if (!vinfo && X11_UseDirectColorVisuals()) { /* No DirectColor visual? Try again.. */ - attribs[i - 3] = None; - vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); - } -#endif if (!vinfo) { SDL_SetError("Couldn't find matching GLX visual"); } @@ -393,7 +380,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; int screen = - ((SDL_DisplayData *) window->display->driverdata)->screen; + ((SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata)->screen; XWindowAttributes xattr; XVisualInfo v, *vinfo; int n;
--- a/src/video/x11/SDL_x11opengl.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11opengl.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/x11/SDL_x11opengles.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11opengles.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/x11/SDL_x11opengles.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11opengles.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/x11/SDL_x11sym.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11sym.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/x11/SDL_x11touch.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11touch.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/x11/SDL_x11touch.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11touch.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/x11/SDL_x11video.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11video.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 @@ -186,8 +186,6 @@ device->VideoQuit = X11_VideoQuit; device->GetDisplayModes = X11_GetDisplayModes; device->SetDisplayMode = X11_SetDisplayMode; - device->SetDisplayGammaRamp = X11_SetDisplayGammaRamp; - device->GetDisplayGammaRamp = X11_GetDisplayGammaRamp; device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; @@ -384,13 +382,4 @@ X11_QuitTouch(_this); } -SDL_bool -X11_UseDirectColorVisuals(void) -{ - /* Once we implement DirectColor colormaps and gamma ramp support... - return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE; - */ - return SDL_FALSE; -} - /* vim: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/SDL_x11video.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11video.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 @@ -55,7 +55,6 @@ #include "SDL_x11clipboard.h" #include "SDL_x11events.h" -#include "SDL_x11gamma.h" #include "SDL_x11keyboard.h" #include "SDL_x11modes.h" #include "SDL_x11mouse.h" @@ -89,12 +88,10 @@ Atom _NET_WM_ICON; Atom UTF8_STRING; - SDL_ScanCode key_layout[256]; + SDL_Scancode key_layout[256]; SDL_bool selection_waiting; } SDL_VideoData; -extern SDL_bool X11_UseDirectColorVisuals(void); - #endif /* _SDL_x11video_h */ /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/SDL_x11window.c Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11window.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,6 @@ #include "SDL_x11video.h" #include "SDL_x11mouse.h" -#include "SDL_x11gamma.h" #include "SDL_x11shape.h" #ifdef SDL_VIDEO_DRIVER_PANDORA @@ -91,7 +90,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; XWindowAttributes attr; XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr); @@ -260,7 +259,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; Display *display = data->display; int screen = displaydata->screen; Visual *visual; @@ -326,232 +325,22 @@ } xattr.background_pixel = 0; xattr.border_pixel = 0; - - if (visual->class == PseudoColor) { - printf("asking for PseudoColor\n"); - -/* Status status; */ - XColor *colorcells; - Colormap colormap; - Sint32 pix; - Sint32 ncolors; - Sint32 nbits; - Sint32 rmax, gmax, bmax; - Sint32 rwidth, gwidth, bwidth; - Sint32 rmask, gmask, bmask; - Sint32 rshift, gshift, bshift; - Sint32 r, g, b; - - /* Is the colormap we need already registered in SDL? */ - if ((colormap = - X11_LookupColormap(display, screen, visual->visualid))) { - xattr.colormap = colormap; -/* printf("found existing colormap\n"); */ - } else { - /* The colormap is not known to SDL so we will create it */ - colormap = XCreateColormap(display, RootWindow(display, screen), - visual, AllocAll); -/* printf("colormap = %x\n", colormap); */ - - /* If we can't create a colormap, then we must die */ - if (!colormap) { - SDL_SetError - ("Couldn't create window: Could not create writable colormap"); - return -1; - } - - /* OK, we got a colormap, now fill it in as best as we can */ - - colorcells = SDL_malloc(visual->map_entries * sizeof(XColor)); - if (NULL == colorcells) { - SDL_SetError("out of memory in X11_CreateWindow"); - return -1; - } - - ncolors = visual->map_entries; - nbits = visual->bits_per_rgb; - -/* printf("ncolors = %d nbits = %d\n", ncolors, nbits); */ - - /* what if ncolors != (1 << nbits)? That can happen on a - true PseudoColor display. I'm assuming that we will - always have ncolors == (1 << nbits) */ - - /* I'm making a lot of assumptions here. */ - - /* Compute the width of each field. If there is one extra - bit, give it to green. If there are two extra bits give - them to red and greed. We can get extra bits when the - number of bits per pixel is not a multiple of 3. For - example when we have 16 bits per pixel and need a 5/6/5 - layout for the RGB fields */ - - rwidth = (nbits / 3) + (((nbits % 3) == 2) ? 1 : 0); - gwidth = (nbits / 3) + (((nbits % 3) >= 1) ? 1 : 0); - bwidth = (nbits / 3); - - rshift = gwidth + bwidth; - gshift = bwidth; - bshift = 0; - - rmax = 1 << rwidth; - gmax = 1 << gwidth; - bmax = 1 << bwidth; - - rmask = rmax - 1; - gmask = gmax - 1; - bmask = bmax - 1; - -/* printf("red mask = %4x shift = %4d width = %d\n", rmask, rshift, rwidth); */ -/* printf("green mask = %4x shift = %4d width = %d\n", gmask, gshift, gwidth); */ -/* printf("blue mask = %4x shift = %4d width = %d\n", bmask, bshift, bwidth); */ - - /* build the color table pixel values */ - pix = 0; - for (r = 0; r < rmax; r++) { - for (g = 0; g < gmax; g++) { - for (b = 0; b < bmax; b++) { - colorcells[pix].pixel = - (r << rshift) | (g << gshift) | (b << bshift); - colorcells[pix].red = (0xffff * r) / rmask; - colorcells[pix].green = (0xffff * g) / gmask; - colorcells[pix].blue = (0xffff * b) / bmask; -/* printf("%4x:%4x [%4x %4x %4x]\n", */ -/* pix, */ -/* colorcells[pix].pixel, */ -/* colorcells[pix].red, */ -/* colorcells[pix].green, */ -/* colorcells[pix].blue); */ - pix++; - } - } - } - -/* status = */ -/* XStoreColors(display, colormap, colorcells, ncolors); */ - - xattr.colormap = colormap; - X11_TrackColormap(display, screen, colormap, visual, NULL); - - SDL_free(colorcells); - } - } else if (visual->class == DirectColor) { - Status status; - XColor *colorcells; - Colormap colormap; - int i; - int ncolors; - int rmax, gmax, bmax; - int rmask, gmask, bmask; - int rshift, gshift, bshift; - - /* Is the colormap we need already registered in SDL? */ - if ((colormap = - X11_LookupColormap(display, screen, visual->visualid))) { - xattr.colormap = colormap; -/* printf("found existing colormap\n"); */ - } else { - /* The colormap is not known to SDL so we will create it */ - colormap = XCreateColormap(display, RootWindow(display, screen), - visual, AllocAll); -/* printf("colormap = %x\n", colormap); */ - - /* If we can't create a colormap, then we must die */ - if (!colormap) { - SDL_SetError - ("Couldn't create window: Could not create writable colormap"); - return -1; - } - - /* OK, we got a colormap, now fill it in as best as we can */ - colorcells = SDL_malloc(visual->map_entries * sizeof(XColor)); - if (NULL == colorcells) { - SDL_SetError("out of memory in X11_CreateWindow"); - return -1; - } - ncolors = visual->map_entries; - rmax = 0xffff; - gmax = 0xffff; - bmax = 0xffff; - - rshift = 0; - rmask = visual->red_mask; - while (0 == (rmask & 1)) { - rshift++; - rmask >>= 1; - } - -/* printf("rmask = %4x rshift = %4d\n", rmask, rshift); */ - - gshift = 0; - gmask = visual->green_mask; - while (0 == (gmask & 1)) { - gshift++; - gmask >>= 1; - } - -/* printf("gmask = %4x gshift = %4d\n", gmask, gshift); */ - - bshift = 0; - bmask = visual->blue_mask; - while (0 == (bmask & 1)) { - bshift++; - bmask >>= 1; - } - -/* printf("bmask = %4x bshift = %4d\n", bmask, bshift); */ - - /* build the color table pixel values */ - for (i = 0; i < ncolors; i++) { - Uint32 red = (rmax * i) / (ncolors - 1); - Uint32 green = (gmax * i) / (ncolors - 1); - Uint32 blue = (bmax * i) / (ncolors - 1); - - Uint32 rbits = (rmask * i) / (ncolors - 1); - Uint32 gbits = (gmask * i) / (ncolors - 1); - Uint32 bbits = (bmask * i) / (ncolors - 1); - - Uint32 pix = - (rbits << rshift) | (gbits << gshift) | (bbits << bshift); - - colorcells[i].pixel = pix; - - colorcells[i].red = red; - colorcells[i].green = green; - colorcells[i].blue = blue; - - colorcells[i].flags = DoRed | DoGreen | DoBlue; -/* printf("%2d:%4x [%4x %4x %4x]\n", i, pix, red, green, blue); */ - } - - status = - XStoreColors(display, colormap, colorcells, ncolors); - - xattr.colormap = colormap; - X11_TrackColormap(display, screen, colormap, visual, colorcells); - - SDL_free(colorcells); - } - } else { - xattr.colormap = - XCreateColormap(display, RootWindow(display, screen), - visual, AllocNone); - } + xattr.colormap = XCreateColormap(display, RootWindow(display, screen), visual, AllocNone); if (oldstyle_fullscreen - || window->x == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->x)) { X11_GetDisplaySize(_this, window, &x, NULL); x = (x - window->w) / 2; - } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { x = 0; } else { x = window->x; } if (oldstyle_fullscreen - || window->y == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->y)) { X11_GetDisplaySize(_this, window, NULL, &y); y = (y - window->h) / 2; - } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { + } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { y = 0; } else { y = window->y; @@ -588,8 +377,8 @@ sizehints->flags = PMaxSize | PMinSize; } if (!oldstyle_fullscreen - && window->x != SDL_WINDOWPOS_UNDEFINED - && window->y != SDL_WINDOWPOS_UNDEFINED) { + && !SDL_WINDOWPOS_ISUNDEFINED(window->x) + && !SDL_WINDOWPOS_ISUNDEFINED(window->y)) { sizehints->x = x; sizehints->y = y; sizehints->flags |= USPosition; @@ -924,14 +713,14 @@ oldstyle_fullscreen = X11_IsWindowOldFullscreen(_this, window); if (oldstyle_fullscreen - || window->x == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->x)) { X11_GetDisplaySize(_this, window, &x, NULL); x = (x - window->w) / 2; } else { x = window->x; } if (oldstyle_fullscreen - || window->y == SDL_WINDOWPOS_CENTERED) { + || SDL_WINDOWPOS_ISCENTERED(window->y)) { X11_GetDisplaySize(_this, window, NULL, &y); y = (y - window->h) / 2; } else { @@ -988,7 +777,7 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; Display *display = data->videodata->display; Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE; Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT; @@ -1043,7 +832,7 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) window->display->driverdata; + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; Display *display = data->videodata->display; XIconifyWindow(display, data->xwindow, displaydata->screen);
--- a/src/video/x11/SDL_x11window.h Sun Feb 06 23:48:31 2011 -0800 +++ b/src/video/x11/SDL_x11window.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/test/Makefile.in Sun Feb 06 23:48:31 2011 -0800 +++ b/test/Makefile.in Sat Feb 12 19:16:09 2011 -0800 @@ -7,7 +7,57 @@ CFLAGS = @CFLAGS@ LIBS = @LIBS@ -TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testatomic$(EXE) testaudioinfo$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcursor$(EXE) testdraw2$(EXE) testdyngles$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testfill$(EXE) testgamma$(EXE) testgl2$(EXE) testgles$(EXE) testgl$(EXE) testhaptic$(EXE) testhread$(EXE) testiconv$(EXE) testime$(EXE) testintersections$(EXE) testjoystick$(EXE) testkeys$(EXE) testloadso$(EXE) testlock$(EXE) testmultiaudio$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testplatform$(EXE) testpower$(EXE) testresample$(EXE) testsem$(EXE) testshape$(EXE) testsprite2$(EXE) testsprite$(EXE) testspriteminimal$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm2$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE) testgesture$(EXE) +TARGETS = \ + checkkeys$(EXE) \ + graywin$(EXE) \ + loopwave$(EXE) \ + testalpha$(EXE) \ + testatomic$(EXE) \ + testaudioinfo$(EXE) \ + testbitmap$(EXE) \ + testblitspeed$(EXE) \ + testcursor$(EXE) \ + testdraw2$(EXE) \ + testdyngl$(EXE) \ + testdyngles$(EXE) \ + testerror$(EXE) \ + testfile$(EXE) \ + testfill$(EXE) \ + testgesture$(EXE) \ + testgl$(EXE) \ + testgl2$(EXE) \ + testgles$(EXE) \ + testhaptic$(EXE) \ + testhread$(EXE) \ + testiconv$(EXE) \ + testime$(EXE) \ + testintersections$(EXE) \ + testjoystick$(EXE) \ + testkeys$(EXE) \ + testloadso$(EXE) \ + testlock$(EXE) \ + testmultiaudio$(EXE) \ + testoverlay$(EXE) \ + testoverlay2$(EXE) \ + testplatform$(EXE) \ + testpower$(EXE) \ + testresample$(EXE) \ + testscale$(EXE) \ + testsem$(EXE) \ + testshader$(EXE) \ + testshape$(EXE) \ + testsprite$(EXE) \ + testsprite2$(EXE) \ + testspriteminimal$(EXE) \ + teststreaming$(EXE) \ + testtimer$(EXE) \ + testver$(EXE) \ + testvidinfo$(EXE) \ + testwin$(EXE) \ + testwm$(EXE) \ + testwm2$(EXE) \ + threadwin$(EXE) \ + torturethread$(EXE) \ all: Makefile $(TARGETS) @@ -32,12 +82,12 @@ testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) -testpower$(EXE): $(srcdir)/testpower.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - testalpha$(EXE): $(srcdir)/testalpha.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ +testatomic$(EXE): $(srcdir)/testatomic.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) + testbitmap$(EXE): $(srcdir)/testbitmap.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @@ -68,9 +118,9 @@ testfill$(EXE): $(srcdir)/testfill.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) -testgamma$(EXE): $(srcdir)/testgamma.c +testgesture$(EXE): $(srcdir)/testgesture.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ - + testgl$(EXE): $(srcdir)/testgl.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@ @@ -80,18 +130,27 @@ testgles$(EXE): $(srcdir)/testgles.c $(srcdir)/common.c $(CC) -o $@ $(srcdir)/testgles.c $(srcdir)/common.c $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@ +testhaptic$(EXE): $(srcdir)/testhaptic.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) + testhread$(EXE): $(srcdir)/testhread.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) testiconv$(EXE): $(srcdir)/testiconv.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) +testime$(EXE): $(srcdir)/testime.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) @SDL_TTF_LIB@ + testjoystick$(EXE): $(srcdir)/testjoystick.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) testkeys$(EXE): $(srcdir)/testkeys.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) +testloadso$(EXE): $(srcdir)/testloadso.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) + testlock$(EXE): $(srcdir)/testlock.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @@ -104,21 +163,33 @@ testplatform$(EXE): $(srcdir)/testplatform.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) +testpower$(EXE): $(srcdir)/testpower.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) + +testscale$(EXE): $(srcdir)/testscale.c $(srcdir)/common.c + $(CC) -o $@ $(srcdir)/testscale.c $(srcdir)/common.c $(CFLAGS) $(LIBS) + testsem$(EXE): $(srcdir)/testsem.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) +testshader$(EXE): $(srcdir)/testshader.c + $(CC) -o $@ $(srcdir)/testshader.c $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@ + testshape$(EXE): $(srcdir)/testshape.c $(CC) -o $@ $? -std=c99 $(CFLAGS) $(LIBS) -testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ - testsprite$(EXE): $(srcdir)/testsprite.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ testsprite2$(EXE): $(srcdir)/testsprite2.c $(srcdir)/common.c $(CC) -o $@ $(srcdir)/testsprite2.c $(srcdir)/common.c $(CFLAGS) $(LIBS) @MATHLIB@ +testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ + +teststreaming$(EXE): $(srcdir)/teststreaming.c + $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ + testtimer$(EXE): $(srcdir)/testtimer.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) @@ -143,21 +214,6 @@ torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) -testloadso$(EXE): $(srcdir)/testloadso.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - -testhaptic$(EXE): $(srcdir)/testhaptic.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - -testatomic$(EXE): $(srcdir)/testatomic.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - -testgesture$(EXE): $(srcdir)/testgesture.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@ - -testime$(EXE): $(srcdir)/testime.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) @SDL_TTF_LIB@ - clean: rm -f $(TARGETS)
--- a/test/checkkeys.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/checkkeys.c Sat Feb 12 19:16:09 2011 -0800 @@ -53,7 +53,7 @@ } static void -PrintKey(SDL_KeySym * sym, SDL_bool pressed, SDL_bool repeat) +PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat) { /* Print the keycode, name and state */ if (sym->sym) {
--- a/test/common.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/common.c Sat Feb 12 19:16:09 2011 -0800 @@ -6,7 +6,7 @@ #include "common.h" #define VIDEO_USAGE \ -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" +"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" @@ -109,12 +109,51 @@ } return -1; } + if (SDL_strcasecmp(argv[index], "--log") == 0) { + ++index; + if (!argv[index]) { + return -1; + } + if (SDL_strcasecmp(argv[index], "all") == 0) { + SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "error") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "system") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "audio") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "video") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "render") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "input") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + return -1; + } if (SDL_strcasecmp(argv[index], "--display") == 0) { ++index; if (!argv[index]) { return -1; } state->display = SDL_atoi(argv[index]); + if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) { + state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display); + state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display); + } return 2; } if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) { @@ -559,9 +598,8 @@ fprintf(stderr, "Number of displays: %d\n", n); for (i = 0; i < n; ++i) { fprintf(stderr, "Display %d:\n", i); - SDL_SelectVideoDisplay(i); - SDL_GetDesktopDisplayMode(&mode); + SDL_GetDesktopDisplayMode(i, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); fprintf(stderr, @@ -577,13 +615,13 @@ } /* Print available fullscreen video modes */ - m = SDL_GetNumDisplayModes(); + m = SDL_GetNumDisplayModes(i); if (m == 0) { fprintf(stderr, "No available fullscreen video modes\n"); } else { fprintf(stderr, " Fullscreen video modes:\n"); for (j = 0; j < m; ++j) { - SDL_GetDisplayMode(j, &mode); + SDL_GetDisplayMode(i, j, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); fprintf(stderr, @@ -607,7 +645,6 @@ } } - SDL_SelectVideoDisplay(state->display); if (state->verbose & VERBOSE_RENDER) { SDL_RendererInfo info; @@ -982,12 +1019,14 @@ case SDLK_m: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-M maximize */ - /* FIXME: Which window has focus for this keyboard? */ for (i = 0; i < state->num_windows; ++i) { - if (SDL_GetWindowFlags(state->windows[i]) & SDL_WINDOW_MAXIMIZED) { - SDL_RestoreWindow(state->windows[i]); - } else { - SDL_MaximizeWindow(state->windows[i]); + Uint32 flags = SDL_GetWindowFlags(state->windows[i]); + if (flags & SDL_WINDOW_INPUT_FOCUS) { + if (flags & SDL_WINDOW_MAXIMIZED) { + SDL_RestoreWindow(state->windows[i]); + } else { + SDL_MaximizeWindow(state->windows[i]); + } } } } @@ -995,9 +1034,26 @@ case SDLK_z: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Z minimize */ - /* FIXME: Which window has focus for this keyboard? */ for (i = 0; i < state->num_windows; ++i) { - SDL_MinimizeWindow(state->windows[i]); + Uint32 flags = SDL_GetWindowFlags(state->windows[i]); + if (flags & SDL_WINDOW_INPUT_FOCUS) { + SDL_MinimizeWindow(state->windows[i]); + } + } + } + break; + case SDLK_RETURN: + if (event->key.keysym.mod & KMOD_CTRL) { + /* Ctrl-Enter toggle fullscreen */ + for (i = 0; i < state->num_windows; ++i) { + Uint32 flags = SDL_GetWindowFlags(state->windows[i]); + if (flags & SDL_WINDOW_INPUT_FOCUS) { + if (flags & SDL_WINDOW_FULLSCREEN) { + SDL_SetWindowFullscreen(state->windows[i], SDL_FALSE); + } else { + SDL_SetWindowFullscreen(state->windows[i], SDL_TRUE); + } + } } } break;
--- a/test/nds-test-progs/general/source/main.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/nds-test-progs/general/source/main.c Sat Feb 12 19:16:09 2011 -0800 @@ -82,7 +82,7 @@ rect.h -= 6; } printf("button %d pressed at %d ticks\n", - event.jbutton.which, SDL_GetTicks()); + event.jbutton.button, SDL_GetTicks()); break; case SDL_QUIT: SDL_Quit();
--- a/test/testgamma.c Sun Feb 06 23:48:31 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ - -/* Bring up a window and manipulate the gamma on it */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> - -#include "SDL.h" - -/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ -static void -quit(int rc) -{ - SDL_Quit(); - exit(rc); -} - -/* Turn a normal gamma value into an appropriate gamma ramp */ -void -CalculateGamma(double gamma, Uint16 * ramp) -{ - int i, value; - - gamma = 1.0 / gamma; - for (i = 0; i < 256; ++i) { - value = (int) (pow((double) i / 256.0, gamma) * 65535.0 + 0.5); - if (value > 65535) { - value = 65535; - } - ramp[i] = (Uint16) value; - } -} - -/* This can be used as a general routine for all of the test programs */ -int -get_video_args(char *argv[], int *w, int *h, int *bpp, Uint32 * flags) -{ - int i; - - *w = 640; - *h = 480; - *bpp = 0; - *flags = SDL_SWSURFACE; - - for (i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-width") == 0) { - if (argv[i + 1]) { - *w = atoi(argv[++i]); - } - } else if (strcmp(argv[i], "-height") == 0) { - if (argv[i + 1]) { - *h = atoi(argv[++i]); - } - } else if (strcmp(argv[i], "-bpp") == 0) { - if (argv[i + 1]) { - *bpp = atoi(argv[++i]); - } - } else if (strcmp(argv[i], "-fullscreen") == 0) { - *flags |= SDL_FULLSCREEN; - } else if (strcmp(argv[i], "-hw") == 0) { - *flags |= SDL_HWSURFACE; - } else if (strcmp(argv[i], "-hwpalette") == 0) { - *flags |= SDL_HWPALETTE; - } else - break; - } - return i; -} - -int -main(int argc, char *argv[]) -{ - SDL_Surface *screen; - SDL_Surface *image; - float gamma; - int i; - int w, h, bpp; - Uint32 flags; - Uint16 ramp[256]; - Uint16 red_ramp[256]; - Uint32 then, timeout; - - /* Check command line arguments */ - argv += get_video_args(argv, &w, &h, &bpp, &flags); - - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); - return (1); - } - - /* Initialize the display, always use hardware palette */ - screen = SDL_SetVideoMode(w, h, bpp, flags | SDL_HWPALETTE); - if (screen == NULL) { - fprintf(stderr, "Couldn't set %dx%d video mode: %s\n", - w, h, SDL_GetError()); - quit(1); - } - - /* Set the window manager title bar */ - SDL_WM_SetCaption("SDL gamma test", "testgamma"); - - /* Set the desired gamma, if any */ - gamma = 1.0f; - if (*argv) { - gamma = (float) atof(*argv); - } - if (SDL_SetGamma(gamma, gamma, gamma) < 0) { - fprintf(stderr, "Unable to set gamma: %s\n", SDL_GetError()); - quit(1); - } -#if 0 /* This isn't supported. Integrating the gamma ramps isn't exact */ - /* See what gamma was actually set */ - float real[3]; - if (SDL_GetGamma(&real[0], &real[1], &real[2]) < 0) { - printf("Couldn't get gamma: %s\n", SDL_GetError()); - } else { - printf("Set gamma values: R=%2.2f, G=%2.2f, B=%2.2f\n", - real[0], real[1], real[2]); - } -#endif - - /* Do all the drawing work */ - image = SDL_LoadBMP("sample.bmp"); - if (image) { - SDL_Rect dst; - - dst.x = (screen->w - image->w) / 2; - dst.y = (screen->h - image->h) / 2; - dst.w = image->w; - dst.h = image->h; - SDL_BlitSurface(image, NULL, screen, &dst); - SDL_UpdateRects(screen, 1, &dst); - } - - /* Wait a bit, handling events */ - then = SDL_GetTicks(); - timeout = (5 * 1000); - while ((SDL_GetTicks() - then) < timeout) { - SDL_Event event; - - while (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_QUIT: /* Quit now */ - timeout = 0; - break; - case SDL_KEYDOWN: - switch (event.key.keysym.sym) { - case SDLK_SPACE: /* Go longer.. */ - timeout += (5 * 1000); - break; - case SDLK_UP: - gamma += 0.2f; - SDL_SetGamma(gamma, gamma, gamma); - break; - case SDLK_DOWN: - gamma -= 0.2f; - SDL_SetGamma(gamma, gamma, gamma); - break; - case SDLK_ESCAPE: - timeout = 0; - break; - default: - break; - } - break; - } - } - } - - /* Perform a gamma flash to red using color ramps */ - while (gamma < 10.0) { - /* Increase the red gamma and decrease everything else... */ - gamma += 0.1f; - CalculateGamma(gamma, red_ramp); - CalculateGamma(1.0 / gamma, ramp); - SDL_SetGammaRamp(red_ramp, ramp, ramp); - } - /* Finish completely red */ - memset(red_ramp, 255, sizeof(red_ramp)); - memset(ramp, 0, sizeof(ramp)); - SDL_SetGammaRamp(red_ramp, ramp, ramp); - - /* Now fade out to black */ - for (i = (red_ramp[0] >> 8); i >= 0; --i) { - memset(red_ramp, i, sizeof(red_ramp)); - SDL_SetGammaRamp(red_ramp, NULL, NULL); - } - SDL_Delay(1 * 1000); - - SDL_Quit(); - return (0); -}
--- a/test/testgl2.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testgl2.c Sat Feb 12 19:16:09 2011 -0800 @@ -234,7 +234,7 @@ SDL_GL_SetSwapInterval(0); } - SDL_GetCurrentDisplayMode(&mode); + SDL_GetCurrentDisplayMode(0, &mode); printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format)); printf("\n"); printf("Vendor : %s\n", glGetString(GL_VENDOR));
--- a/test/testime.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testime.c Sat Feb 12 19:16:09 2011 -0800 @@ -122,12 +122,9 @@ if (fullscreen) { - SDL_DisplayMode mode; - SDL_GetDesktopDisplayMode(&mode); - - width = mode.w; - height = mode.h; - fprintf(stderr, "%dx%d\n", width, height); + /* Use the desktop mode */ + width = 0; + height = 0; flags |= SDL_FULLSCREEN; } @@ -375,3 +372,5 @@ CleanupVideo(); return 0; } + +/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testkeys.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testkeys.c Sat Feb 12 19:16:09 2011 -0800 @@ -11,7 +11,7 @@ int main(int argc, char *argv[]) { - SDL_ScanCode scancode; + SDL_Scancode scancode; if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
--- a/test/testoverlay2.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testoverlay2.c Sat Feb 12 19:16:09 2011 -0800 @@ -172,35 +172,27 @@ } void -ConvertRGBtoYV12(SDL_Surface * s, SDL_Overlay * o, int monochrome, - int luminance) +ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h, + int monochrome, int luminance) { int x, y; int yuv[3]; - Uint8 *p, *op[3]; - - SDL_LockSurface(s); - SDL_LockYUVOverlay(o); + Uint8 *op[3]; - /* Convert */ - for (y = 0; y < s->h && y < o->h; y++) { - p = ((Uint8 *) s->pixels) + s->pitch * y; - op[0] = o->pixels[0] + o->pitches[0] * y; - op[1] = o->pixels[1] + o->pitches[1] * (y / 2); - op[2] = o->pixels[2] + o->pitches[2] * (y / 2); - for (x = 0; x < s->w && x < o->w; x++) { - RGBtoYUV(p, yuv, monochrome, luminance); + op[0] = out; + op[1] = op[0] + w*h; + op[2] = op[1] + w*h/4; + for (y = 0; y < h; ++y) { + for (x = 0; x < w; ++x) { + RGBtoYUV(rgb, yuv, monochrome, luminance); *(op[0]++) = yuv[0]; if (x % 2 == 0 && y % 2 == 0) { *(op[1]++) = yuv[2]; *(op[2]++) = yuv[1]; } - p += s->format->BytesPerPixel; + rgb += 3; } } - - SDL_UnlockYUVOverlay(o); - SDL_UnlockSurface(s); } void @@ -339,12 +331,11 @@ fprintf(stderr, "\n"); fprintf(stderr, "Where 'arg' is any of the following options:\n"); fprintf(stderr, "\n"); - fprintf(stderr, " -fps <frames per second>\n"); - fprintf(stderr, - " -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n"); - fprintf(stderr, - " -scale <scale factor> (initial scale of the overlay)\n"); - fprintf(stderr, " -help (shows this help)\n"); + fprintf(stderr, " -fps <frames per second>\n"); + fprintf(stderr, " -nodelay\n"); + fprintf(stderr, " -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n"); + fprintf(stderr, " -scale <scale factor> (initial scale of the overlay)\n"); + fprintf(stderr, " -help (shows this help)\n"); fprintf(stderr, "\n"); fprintf(stderr, "Press ESC to exit, or SPACE to freeze the movie while application running.\n"); @@ -356,19 +347,22 @@ { Uint8 *RawMooseData; SDL_RWops *handle; - SDL_Surface *screen; - SDL_Surface *MooseFrame[MOOSEFRAMES_COUNT]; - SDL_Overlay *overlay; - SDL_Rect overlayrect; + int window_w; + int window_h; + SDL_Window *window; + SDL_Renderer *renderer; + Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE*2]; + SDL_Texture *MooseTexture; + SDL_Rect displayrect; SDL_Event event; - Uint32 lastftick; int paused = 0; - int resized = 0; - int i; + int i, j; int fps = 12; int fpsdelay; - int overlay_format = SDL_YUY2_OVERLAY; + int nodelay = 0; + Uint32 pixel_format = SDL_PIXELFORMAT_YV12; int scale = 5; + SDL_bool done = SDL_FALSE; if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); @@ -396,18 +390,22 @@ "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); quit(10); } + } else if (strcmp(argv[1], "-nodelay") == 0) { + nodelay = 1; + argv += 1; + argc -= 1; } else if (strcmp(argv[1], "-format") == 0) { if (argv[2]) { if (!strcmp(argv[2], "YV12")) - overlay_format = SDL_YV12_OVERLAY; + pixel_format = SDL_PIXELFORMAT_YV12; else if (!strcmp(argv[2], "IYUV")) - overlay_format = SDL_IYUV_OVERLAY; + pixel_format = SDL_PIXELFORMAT_IYUV; else if (!strcmp(argv[2], "YUY2")) - overlay_format = SDL_YUY2_OVERLAY; + pixel_format = SDL_PIXELFORMAT_YUY2; else if (!strcmp(argv[2], "UYVY")) - overlay_format = SDL_UYVY_OVERLAY; + pixel_format = SDL_PIXELFORMAT_UYVY; else if (!strcmp(argv[2], "YVYU")) - overlay_format = SDL_YVYU_OVERLAY; + pixel_format = SDL_PIXELFORMAT_YVYU; else { fprintf(stderr, "The -format option %s is not recognized, see help for info.\n", @@ -471,122 +469,87 @@ SDL_RWclose(handle); - /* Set video mode */ - if ((screen = - SDL_SetVideoMode(MOOSEPIC_W * scale, MOOSEPIC_H * scale, 0, - SDL_RESIZABLE | SDL_SWSURFACE)) == NULL) { - fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError()); + /* Create the window and renderer */ + window_w = MOOSEPIC_W * scale; + window_h = MOOSEPIC_H * scale; + window = SDL_CreateWindow("Happy Moose", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + window_w, window_h, + SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE); + if (!window) { + fprintf(stderr, "Couldn't set create window: %s\n", SDL_GetError()); + free(RawMooseData); + quit(4); + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + fprintf(stderr, "Couldn't set create renderer: %s\n", SDL_GetError()); free(RawMooseData); quit(4); } - /* Set the window manager title bar */ - SDL_WM_SetCaption("SDL test overlay: running moose", "testoverlay2"); + MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + if (!MooseTexture) { + fprintf(stderr, "Couldn't set create texture: %s\n", SDL_GetError()); + free(RawMooseData); + quit(5); + } for (i = 0; i < MOOSEFRAMES_COUNT; i++) { - MooseFrame[i] = - SDL_CreateRGBSurfaceFrom(RawMooseData + i * MOOSEFRAME_SIZE, - MOOSEPIC_W, MOOSEPIC_H, 8, MOOSEPIC_W, - 0, 0, 0, 0); - if (MooseFrame[i] == NULL) { - fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n", - SDL_GetError()); - free(RawMooseData); - quit(5); - } - SDL_SetColors(MooseFrame[i], MooseColors, 0, 84); - - { - SDL_Surface *newsurf; - SDL_PixelFormat format; + Uint8 MooseFrameRGB[MOOSEFRAME_SIZE*3]; + Uint8 *rgb; + Uint8 *frame; - format.palette = NULL; - format.BitsPerPixel = 32; - format.BytesPerPixel = 4; -#if SDL_BYTEORDER == SDL_LIL_ENDIAN - format.Rshift = 0; - format.Gshift = 8; - format.Bshift = 16; -#else - format.Rshift = 24; - format.Gshift = 16; - format.Bshift = 8; -#endif - format.Ashift = 0; - format.Rmask = 0xff << format.Rshift; - format.Gmask = 0xff << format.Gshift; - format.Bmask = 0xff << format.Bshift; - format.Amask = 0; - format.Rloss = 0; - format.Gloss = 0; - format.Bloss = 0; - format.Aloss = 8; - - newsurf = - SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE); - if (!newsurf) { - fprintf(stderr, - "Couldn't convert picture to 32bits RGB: %s\n", - SDL_GetError()); - quit(6); - } - SDL_FreeSurface(MooseFrame[i]); - MooseFrame[i] = newsurf; + rgb = MooseFrameRGB; + frame = RawMooseData + i * MOOSEFRAME_SIZE; + for (j = 0; j < MOOSEFRAME_SIZE; ++j) { + rgb[0] = MooseColors[frame[j]].r; + rgb[1] = MooseColors[frame[j]].g; + rgb[2] = MooseColors[frame[j]].b; + rgb += 3; } + ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); } free(RawMooseData); - overlay = - SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen); - if (!overlay) { - fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError()); - quit(7); + /* set the start frame */ + i = 0; + if (nodelay) { + fpsdelay = 0; + } else { + fpsdelay = 1000 / fps; } - printf("Created %dx%dx%d %s %s overlay\n", overlay->w, overlay->h, - overlay->planes, overlay->hw_overlay ? "hardware" : "software", - overlay->format == SDL_YV12_OVERLAY ? "YV12" : overlay->format == - SDL_IYUV_OVERLAY ? "IYUV" : overlay->format == - SDL_YUY2_OVERLAY ? "YUY2" : overlay->format == - SDL_UYVY_OVERLAY ? "UYVY" : overlay->format == - SDL_YVYU_OVERLAY ? "YVYU" : "Unknown"); - - for (i = 0; i < overlay->planes; i++) { - printf(" plane %d: pitch=%d\n", i, overlay->pitches[i]); - } - - overlayrect.x = 0; - overlayrect.y = 0; - overlayrect.w = MOOSEPIC_W * scale; - overlayrect.h = MOOSEPIC_H * scale; - - /* set the start frame */ - i = 0; - fpsdelay = 1000 / fps; + displayrect.x = 0; + displayrect.y = 0; + displayrect.w = window_w; + displayrect.h = window_h; /* Ignore key up events, they don't even get filtered */ SDL_EventState(SDL_KEYUP, SDL_IGNORE); - lastftick = SDL_GetTicks(); - /* Loop, waiting for QUIT or RESIZE */ - while (1) { - if (SDL_PollEvent(&event)) { + while (!done) { + while (SDL_PollEvent(&event)) { switch (event.type) { - case SDL_VIDEORESIZE: - screen = - SDL_SetVideoMode(event.resize.w, event.resize.h, 0, - SDL_RESIZABLE | SDL_SWSURFACE); - overlayrect.w = event.resize.w; - overlayrect.h = event.resize.h; - if (paused) { - resized = 1; + case SDL_WINDOWEVENT: + if (event.window.event == SDL_WINDOWEVENT_RESIZED) { + displayrect.w = window_w = event.window.data1; + displayrect.h = window_h = event.window.data2; } break; case SDL_MOUSEBUTTONDOWN: - overlayrect.x = event.button.x - overlayrect.w / 2; - overlayrect.y = event.button.y - overlayrect.h / 2; + displayrect.x = event.button.x - window_w / 2; + displayrect.y = event.button.y - window_h / 2; + break; + case SDL_MOUSEMOTION: + if (event.motion.state) { + displayrect.x = event.motion.x - window_w / 2; + displayrect.y = event.motion.y - window_h / 2; + } break; case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_SPACE) { @@ -597,51 +560,24 @@ break; } case SDL_QUIT: - SDL_FreeYUVOverlay(overlay); - for (i = 0; i < MOOSEFRAMES_COUNT; i++) { - SDL_FreeSurface(MooseFrame[i]); - } - quit(0); + done = SDL_TRUE; + break; } } + SDL_Delay(fpsdelay); - if ((!paused) || (resized)) { - if (((SDL_GetTicks() - lastftick) > (Uint32)fpsdelay) || (resized)) { - lastftick = SDL_GetTicks(); + if (!paused) { + i = (i + 1) % MOOSEFRAMES_COUNT; - switch (overlay_format) { - case SDL_YUY2_OVERLAY: - ConvertRGBtoYUY2(MooseFrame[i], overlay, 0, 100); - break; - case SDL_YV12_OVERLAY: - ConvertRGBtoYV12(MooseFrame[i], overlay, 0, 100); - break; - case SDL_UYVY_OVERLAY: - ConvertRGBtoUYVY(MooseFrame[i], overlay, 0, 100); - break; - case SDL_YVYU_OVERLAY: - ConvertRGBtoYVYU(MooseFrame[i], overlay, 0, 100); - break; - case SDL_IYUV_OVERLAY: - ConvertRGBtoIYUV(MooseFrame[i], overlay, 0, 100); - break; - } - - SDL_DisplayYUVOverlay(overlay, &overlayrect); - if (!resized) { - i++; - if (i == 10) { - i = 0; - } - } else { - resized = 0; - } - } + SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format)); } - /* kind of timeslice to OS */ - SDL_Delay(1); + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect); + SDL_RenderPresent(renderer); } - - SDL_Quit(); + SDL_DestroyRenderer(renderer); + quit(0); return 0; } + +/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testplatform.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testplatform.c Sat Feb 12 19:16:09 2011 -0800 @@ -143,13 +143,11 @@ printf("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize()); printf("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected"); printf("MMX %s\n", SDL_HasMMX()? "detected" : "not detected"); - printf("MMX Ext %s\n", SDL_HasMMXExt()? "detected" : "not detected"); - printf("3DNow %s\n", SDL_Has3DNow()? "detected" : "not detected"); - printf("3DNow Ext %s\n", - SDL_Has3DNowExt()? "detected" : "not detected"); printf("SSE %s\n", SDL_HasSSE()? "detected" : "not detected"); printf("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected"); - printf("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected"); + printf("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected"); + printf("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected"); + printf("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); } return (0); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/testscale.c Sat Feb 12 19:16:09 2011 -0800 @@ -0,0 +1,186 @@ +/* Simple program: Move N sprites around on the screen as fast as possible */ + +#include <stdlib.h> +#include <stdio.h> +#include <time.h> + +#include "SDL.h" +#include "common.h" + +#define WINDOW_WIDTH 640 +#define WINDOW_HEIGHT 480 + +static CommonState *state; + +typedef struct { + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *background; + SDL_Texture *sprite; + SDL_Rect sprite_rect; + int scale_direction; +} DrawState; + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void +quit(int rc) +{ + CommonQuit(state); + exit(rc); +} + +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + fprintf(stderr, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + +void +Draw(DrawState *s) +{ + int w, h; + SDL_Rect rect; + + SDL_GetWindowSize(s->window, &w, &h); + + /* Draw the background */ + SDL_RenderCopy(s->renderer, s->background, NULL, NULL); + + /* Scale and draw the sprite */ + s->sprite_rect.w += s->scale_direction; + s->sprite_rect.h += s->scale_direction; + if (s->scale_direction > 0) { + if (s->sprite_rect.w >= w || s->sprite_rect.h >= h) { + s->scale_direction = -1; + } + } else { + if (s->sprite_rect.w <= 1 || s->sprite_rect.h <= 1) { + s->scale_direction = 1; + } + } + s->sprite_rect.x = (w - s->sprite_rect.w) / 2; + s->sprite_rect.y = (h - s->sprite_rect.h) / 2; + + SDL_RenderCopy(s->renderer, s->sprite, NULL, &s->sprite_rect); + + /* Update the screen! */ + SDL_RenderPresent(s->renderer); +} + +int +main(int argc, char *argv[]) +{ + DrawState *drawstates; + int i, done; + SDL_Event event; + int frames; + Uint32 then, now; + + /* Initialize test framework */ + state = CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return 1; + } + for (i = 1; i < argc;) { + int consumed; + + consumed = CommonArg(state, i); + if (consumed == 0) { + fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state)); + return 1; + } + i += consumed; + } + if (!CommonInit(state)) { + quit(2); + } + + drawstates = SDL_stack_alloc(DrawState, state->num_windows); + for (i = 0; i < state->num_windows; ++i) { + DrawState *drawstate = &drawstates[i]; + + drawstate->window = state->windows[i]; + drawstate->renderer = state->renderers[i]; + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); + if (!drawstate->sprite || !drawstate->background) { + quit(2); + } + SDL_QueryTexture(drawstate->sprite, NULL, NULL, + &drawstate->sprite_rect.w, &drawstate->sprite_rect.h); + drawstate->scale_direction = 1; + } + + /* Main render loop */ + frames = 0; + then = SDL_GetTicks(); + done = 0; + while (!done) { + /* Check for events */ + ++frames; + while (SDL_PollEvent(&event)) { + CommonEvent(state, &event, &done); + } + for (i = 0; i < state->num_windows; ++i) { + Draw(&drawstates[i]); + } + } + + /* Print out some timing information */ + now = SDL_GetTicks(); + if (now > then) { + double fps = ((double) frames * 1000) / (now - then); + printf("%2.2f frames per second\n", fps); + } + + SDL_stack_free(drawstate); + + quit(0); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/testshader.c Sat Feb 12 19:16:09 2011 -0800 @@ -0,0 +1,487 @@ +/* This is a simple example of using GLSL shaders with SDL */ + +#include "SDL.h" + +#ifdef HAVE_OPENGL + +#include "SDL_opengl.h" + + +static SDL_bool shaders_supported; +static int current_shader = 0; + +enum { + SHADER_COLOR, + SHADER_TEXTURE, + SHADER_TEXCOORDS, + NUM_SHADERS +}; + +typedef struct { + GLuint program; + GLuint vert_shader; + GLuint frag_shader; + const char *vert_source; + const char *frag_source; +} ShaderData; + +static ShaderData shaders[NUM_SHADERS] = { + + /* SHADER_COLOR */ + { 0, 0, 0, + /* 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_TEXTURE */ + { 0, 0, 0, + /* 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_TEXCOORDS */ + { 0, 0, 0, + /* vertex shader */ +"varying vec2 v_texCoord;\n" +"\n" +"void main()\n" +"{\n" +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" +" v_texCoord = vec2(gl_MultiTexCoord0);\n" +"}", + /* fragment shader */ +"varying vec2 v_texCoord;\n" +"\n" +"void main()\n" +"{\n" +" vec4 color;\n" +" vec2 delta;\n" +" float dist;\n" +"\n" +" delta = vec2(0.5, 0.5) - v_texCoord;\n" +" dist = dot(delta, delta);\n" +"\n" +" color.r = v_texCoord.x;\n" +" color.g = v_texCoord.x * v_texCoord.y;\n" +" color.b = v_texCoord.y;\n" +" color.a = 1.0 - (dist * 4.0);\n" +" gl_FragColor = color;\n" +"}" + }, +}; + +static PFNGLATTACHOBJECTARBPROC glAttachObjectARB; +static PFNGLCOMPILESHADERARBPROC glCompileShaderARB; +static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; +static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; +static PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; +static PFNGLGETINFOLOGARBPROC glGetInfoLogARB; +static PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; +static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; +static PFNGLLINKPROGRAMARBPROC glLinkProgramARB; +static PFNGLSHADERSOURCEARBPROC glShaderSourceARB; +static PFNGLUNIFORM1IARBPROC glUniform1iARB; +static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; + +static SDL_bool CompileShader(GLenum shader, const char *source) +{ + GLint status; + + glShaderSourceARB(shader, 1, &source, NULL); + glCompileShaderARB(shader); + glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); + if (status == 0) { + GLint length; + char *info; + + glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + info = SDL_stack_alloc(char, length+1); + glGetInfoLogARB(shader, length, NULL, info); + fprintf(stderr, "Failed to compile shader:\n%s\n%s", source, info); + SDL_stack_free(info); + + return SDL_FALSE; + } else { + return SDL_TRUE; + } +} + +static SDL_bool CompileShaderProgram(ShaderData *data) +{ + const int num_tmus_bound = 4; + int i; + GLint location; + + glGetError(); + + /* Create one program object to rule them all */ + data->program = glCreateProgramObjectARB(); + + /* Create the vertex shader */ + data->vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + if (!CompileShader(data->vert_shader, data->vert_source)) { + return SDL_FALSE; + } + + /* Create the fragment shader */ + data->frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + if (!CompileShader(data->frag_shader, data->frag_source)) { + return SDL_FALSE; + } + + /* ... and in the darkness bind them */ + glAttachObjectARB(data->program, data->vert_shader); + glAttachObjectARB(data->program, data->frag_shader); + glLinkProgramARB(data->program); + + /* Set up some uniform variables */ + 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 = glGetUniformLocationARB(data->program, tex_name); + if (location >= 0) { + glUniform1iARB(location, i); + } + } + glUseProgramObjectARB(0); + + return (glGetError() == GL_NO_ERROR); +} + +static void DestroyShaderProgram(ShaderData *data) +{ + if (shaders_supported) { + glDeleteObjectARB(data->vert_shader); + glDeleteObjectARB(data->frag_shader); + glDeleteObjectARB(data->program); + } +} + +static SDL_bool InitShaders() +{ + int i; + + /* 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")) { + glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB"); + glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB"); + glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB"); + glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB"); + glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB"); + glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB"); + glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB"); + glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB"); + glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB"); + glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB"); + glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB"); + glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB"); + if (glAttachObjectARB && + glCompileShaderARB && + glCreateProgramObjectARB && + glCreateShaderObjectARB && + glDeleteObjectARB && + glGetInfoLogARB && + glGetObjectParameterivARB && + glGetUniformLocationARB && + glLinkProgramARB && + glShaderSourceARB && + glUniform1iARB && + glUseProgramObjectARB) { + shaders_supported = SDL_TRUE; + } + } + + if (!shaders_supported) { + return SDL_FALSE; + } + + /* Compile all the shaders */ + for (i = 0; i < NUM_SHADERS; ++i) { + if (!CompileShaderProgram(&shaders[i])) { + fprintf(stderr, "Unable to compile shader!\n"); + return SDL_FALSE; + } + } + + /* We're done! */ + return SDL_TRUE; +} + +static void QuitShaders() +{ + int i; + + for (i = 0; i < NUM_SHADERS; ++i) { + DestroyShaderProgram(&shaders[i]); + } +} + +/* Quick utility function for texture creation */ +static int +power_of_two(int input) +{ + int value = 1; + + while (value < input) { + value <<= 1; + } + return value; +} + +GLuint +SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord) +{ + GLuint texture; + int w, h; + SDL_Surface *image; + SDL_Rect area; + Uint32 saved_flags; + Uint8 saved_alpha; + + /* Use the surface width and height expanded to powers of 2 */ + w = power_of_two(surface->w); + h = power_of_two(surface->h); + texcoord[0] = 0.0f; /* Min X */ + texcoord[1] = 0.0f; /* Min Y */ + texcoord[2] = (GLfloat) surface->w / w; /* Max X */ + texcoord[3] = (GLfloat) surface->h / h; /* Max Y */ + + image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, +#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ + 0x000000FF, + 0x0000FF00, 0x00FF0000, 0xFF000000 +#else + 0xFF000000, + 0x00FF0000, 0x0000FF00, 0x000000FF +#endif + ); + if (image == NULL) { + return 0; + } + + /* Save the alpha blending attributes */ + saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK); + SDL_GetSurfaceAlphaMod(surface, &saved_alpha); + if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { + SDL_SetAlpha(surface, 0, 0); + } + + /* Copy the surface into the GL texture image */ + area.x = 0; + area.y = 0; + area.w = surface->w; + area.h = surface->h; + SDL_BlitSurface(surface, &area, image, &area); + + /* Restore the alpha blending attributes */ + if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { + SDL_SetAlpha(surface, saved_flags, saved_alpha); + } + + /* Create an OpenGL texture for the image */ + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, + 0, + GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); + SDL_FreeSurface(image); /* No longer needed */ + + return texture; +} + +/* A general OpenGL initialization function. Sets all of the initial parameters. */ +void InitGL(int Width, int Height) // We call this right after our OpenGL window is created. +{ + GLdouble aspect; + + glViewport(0, 0, Width, Height); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black + glClearDepth(1.0); // Enables Clearing Of The Depth Buffer + glDepthFunc(GL_LESS); // The Type Of Depth Test To Do + glEnable(GL_DEPTH_TEST); // Enables Depth Testing + glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); // Reset The Projection Matrix + + aspect = (GLdouble)Width / Height; + glOrtho(-3.0, 3.0, -3.0 / aspect, 3.0 / aspect, 0.0, 1.0); + + glMatrixMode(GL_MODELVIEW); +} + +/* The main drawing function. */ +void DrawGLScene(GLuint texture, GLfloat * texcoord) +{ + /* Texture coordinate lookup, to make it simple */ + enum { + MINX, + MINY, + MAXX, + MAXY + }; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer + glLoadIdentity(); // Reset The View + + glTranslatef(-1.5f,0.0f,0.0f); // Move Left 1.5 Units + + // draw a triangle (in smooth coloring mode) + glBegin(GL_POLYGON); // start drawing a polygon + glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red + glVertex3f( 0.0f, 1.0f, 0.0f); // Top + glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green + glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right + glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue + glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left + glEnd(); // we're done with the polygon (smooth color interpolation) + + glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units + + // Enable blending + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + // draw a textured square (quadrilateral) + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, texture); + glColor3f(1.0f,1.0f,1.0f); + if (shaders_supported) { + glUseProgramObjectARB(shaders[current_shader].program); + } + + glBegin(GL_QUADS); // start drawing a polygon (4 sided) + glTexCoord2f(texcoord[MINX], texcoord[MINY]); + glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left + glTexCoord2f(texcoord[MAXX], texcoord[MINY]); + glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right + glTexCoord2f(texcoord[MAXX], texcoord[MAXY]); + glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right + glTexCoord2f(texcoord[MINX], texcoord[MAXY]); + glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left + glEnd(); // done with the polygon + + if (shaders_supported) { + glUseProgramObjectARB(0); + } + glDisable(GL_TEXTURE_2D); + + // swap buffers to display, since we're double buffered. + SDL_GL_SwapBuffers(); +} + +int main(int argc, char **argv) +{ + int done; + SDL_Surface *surface; + GLuint texture; + GLfloat texcoords[4]; + + /* Initialize SDL for video output */ + if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { + fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); + exit(1); + } + + /* Create a 640x480 OpenGL screen */ + if ( SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL ) { + fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError()); + SDL_Quit(); + exit(2); + } + + /* Set the title bar in environments that support it */ + SDL_WM_SetCaption("Shader Demo", NULL); + + surface = SDL_LoadBMP("icon.bmp"); + if ( ! surface ) { + fprintf(stderr, "Unable to load icon.bmp: %s\n", SDL_GetError()); + SDL_Quit(); + exit(3); + } + texture = SDL_GL_LoadTexture(surface, texcoords); + SDL_FreeSurface(surface); + + /* Loop, drawing and checking events */ + InitGL(640, 480); + if (InitShaders()) { + printf("Shaders supported, press SPACE to cycle them.\n"); + } else { + printf("Shaders not supported!\n"); + } + done = 0; + while ( ! done ) { + DrawGLScene(texture, texcoords); + + /* This could go in a separate function */ + { SDL_Event event; + while ( SDL_PollEvent(&event) ) { + if ( event.type == SDL_QUIT ) { + done = 1; + } + if ( event.type == SDL_KEYDOWN ) { + if ( event.key.keysym.sym == SDLK_SPACE ) { + current_shader = (current_shader + 1) % NUM_SHADERS; + } + if ( event.key.keysym.sym == SDLK_ESCAPE ) { + done = 1; + } + } + } + } + } + QuitShaders(); + SDL_Quit(); + return 1; +} + +#else /* HAVE_OPENGL */ + +int +main(int argc, char *argv[]) +{ + printf("No OpenGL support on this system\n"); + return 1; +} + +#endif /* HAVE_OPENGL */ + +/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/teststreaming.c Sat Feb 12 19:16:09 2011 -0800 @@ -0,0 +1,152 @@ +/******************************************************************************** + * * + * Running moose :) Coded by Mike Gorchak. * + * * + ********************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> + +#include "SDL.h" + +#define MOOSEPIC_W 64 +#define MOOSEPIC_H 88 + +#define MOOSEFRAME_SIZE (MOOSEPIC_W * MOOSEPIC_H) +#define MOOSEFRAMES_COUNT 10 + +SDL_Color MooseColors[84] = { + {49, 49, 49}, {66, 24, 0}, {66, 33, 0}, {66, 66, 66}, + {66, 115, 49}, {74, 33, 0}, {74, 41, 16}, {82, 33, 8}, + {82, 41, 8}, {82, 49, 16}, {82, 82, 82}, {90, 41, 8}, + {90, 41, 16}, {90, 57, 24}, {99, 49, 16}, {99, 66, 24}, + {99, 66, 33}, {99, 74, 33}, {107, 57, 24}, {107, 82, 41}, + {115, 57, 33}, {115, 66, 33}, {115, 66, 41}, {115, 74, 0}, + {115, 90, 49}, {115, 115, 115}, {123, 82, 0}, {123, 99, 57}, + {132, 66, 41}, {132, 74, 41}, {132, 90, 8}, {132, 99, 33}, + {132, 99, 66}, {132, 107, 66}, {140, 74, 49}, {140, 99, 16}, + {140, 107, 74}, {140, 115, 74}, {148, 107, 24}, {148, 115, 82}, + {148, 123, 74}, {148, 123, 90}, {156, 115, 33}, {156, 115, 90}, + {156, 123, 82}, {156, 132, 82}, {156, 132, 99}, {156, 156, 156}, + {165, 123, 49}, {165, 123, 90}, {165, 132, 82}, {165, 132, 90}, + {165, 132, 99}, {165, 140, 90}, {173, 132, 57}, {173, 132, 99}, + {173, 140, 107}, {173, 140, 115}, {173, 148, 99}, {173, 173, 173}, + {181, 140, 74}, {181, 148, 115}, {181, 148, 123}, {181, 156, 107}, + {189, 148, 123}, {189, 156, 82}, {189, 156, 123}, {189, 156, 132}, + {189, 189, 189}, {198, 156, 123}, {198, 165, 132}, {206, 165, 99}, + {206, 165, 132}, {206, 173, 140}, {206, 206, 206}, {214, 173, 115}, + {214, 173, 140}, {222, 181, 148}, {222, 189, 132}, {222, 189, 156}, + {222, 222, 222}, {231, 198, 165}, {231, 231, 231}, {239, 206, 173} +}; + +Uint8 MooseFrames[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE]; + +void quit(int rc) +{ + SDL_Quit(); + exit(rc); +} + +void UpdateTexture(SDL_Texture *texture, int frame) +{ + SDL_Color *color; + Uint8 *src; + Uint32 *dst; + int row, col; + void *pixels; + int pitch; + + if (SDL_LockTexture(texture, NULL, &pixels, &pitch) < 0) { + fprintf(stderr, "Couldn't lock texture: %s\n", SDL_GetError()); + quit(5); + } + src = MooseFrames[frame]; + for (row = 0; row < MOOSEPIC_H; ++row) { + dst = (Uint32*)((Uint8*)pixels + row * pitch); + for (col = 0; col < MOOSEPIC_W; ++col) { + color = &MooseColors[*src++]; + *dst++ = (0xFF000000|(color->r<<16)|(color->g<<8)|color->b); + } + } + SDL_UnlockTexture(texture); +} + +int +main(int argc, char **argv) +{ + SDL_Window *window; + SDL_Renderer *renderer; + SDL_RWops *handle; + SDL_Texture *MooseTexture; + SDL_Event event; + SDL_bool done = SDL_FALSE; + int frame; + + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); + return 1; + } + + /* load the moose images */ + handle = SDL_RWFromFile("moose.dat", "rb"); + if (handle == NULL) { + fprintf(stderr, "Can't find the file moose.dat !\n"); + quit(2); + } + SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT); + SDL_RWclose(handle); + + + /* Create the window and renderer */ + window = SDL_CreateWindow("Happy Moose", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + MOOSEPIC_W*4, MOOSEPIC_H*4, + SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE); + if (!window) { + fprintf(stderr, "Couldn't set create window: %s\n", SDL_GetError()); + quit(3); + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + fprintf(stderr, "Couldn't set create renderer: %s\n", SDL_GetError()); + quit(4); + } + + MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + if (!MooseTexture) { + fprintf(stderr, "Couldn't set create texture: %s\n", SDL_GetError()); + quit(5); + } + + /* Loop, waiting for QUIT or the escape key */ + frame = 0; + while (!done) { + while (SDL_PollEvent(&event)) { + switch (event.type) { + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_ESCAPE) { + done = SDL_TRUE; + } + break; + case SDL_QUIT: + done = SDL_TRUE; + break; + } + } + + frame = (frame + 1) % MOOSEFRAMES_COUNT; + UpdateTexture(MooseTexture, frame); + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, MooseTexture, NULL, NULL); + SDL_RenderPresent(renderer); + } + SDL_DestroyRenderer(renderer); + + quit(0); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testvidinfo.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testvidinfo.c Sat Feb 12 19:16:09 2011 -0800 @@ -455,9 +455,7 @@ printf("Display %d: %dx%d at %d,%d\n", d, bounds.w, bounds.h, bounds.x, bounds.y); - SDL_SelectVideoDisplay(d); - - SDL_GetDesktopDisplayMode(&mode); + SDL_GetDesktopDisplayMode(d, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w, @@ -471,13 +469,13 @@ } /* Print available fullscreen video modes */ - nmodes = SDL_GetNumDisplayModes(); + nmodes = SDL_GetNumDisplayModes(d); if (nmodes == 0) { printf("No available fullscreen video modes\n"); } else { printf(" Fullscreen video modes:\n"); for (i = 0; i < nmodes; ++i) { - SDL_GetDisplayMode(i, &mode); + SDL_GetDisplayMode(d, i, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); printf(" Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
--- a/test/testwm.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testwm.c Sat Feb 12 19:16:09 2011 -0800 @@ -210,7 +210,7 @@ printf(" MODE"); } -static void PrintKey(const SDL_KeySym *sym, int pressed) +static void PrintKey(const SDL_Keysym *sym, int pressed) { /* Print the keycode, name and state */ if ( sym->sym ) {
--- a/test/testwm2.c Sun Feb 06 23:48:31 2011 -0800 +++ b/test/testwm2.c Sat Feb 12 19:16:09 2011 -0800 @@ -49,6 +49,19 @@ /* Check for events */ while (SDL_PollEvent(&event)) { CommonEvent(state, &event, &done); + + if (event.type == SDL_WINDOWEVENT) { + if (event.window.event == SDL_WINDOWEVENT_MOVED) { + SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); + if (window) { + printf("Window %d moved to %d,%d (display %d)\n", + event.window.windowID, + event.window.data1, + event.window.data2, + SDL_GetWindowDisplay(window)); + } + } + } } } quit(0);