Simple Directmedia Layer
Go to file
Sam Lantinga 93a520b385 Fixed bug 3605 - Software renderer no longer renders after Android screen orientation change
Sylvain

This still happens with the current trunk version.  (software renderer of testdrawchessboard.c)

When there is a rotation, the window size changed and the internal surface is marked as "surface_valid == SDL_FALSE".
And all further call fails.

SDL_video.c :

2478 void
2479 SDL_OnWindowResized(SDL_Window * window)
2480 {
2481     window->surface_valid = SDL_FALSE;
2482     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
2483 }

some error set to :
2233         return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");


So, this seems to be the behavior of the API ...


In the loop() function of testdrawchessboard.c, we can recreate the surface/renderer :

 65        if (e.type == SDL_WINDOWEVENT)
 66        {
 67             if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
 68             {
 69                surface = SDL_GetWindowSurface(window);
 70                renderer = SDL_CreateSoftwareRenderer(surface);
 71             }
 72             /* Clear the rendering surface with the specified color */
 73             SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
 74             SDL_RenderClear(renderer);
 75        }

And it displays correctly.
2017-08-13 21:12:14 -07:00
acinclude Fixed bug 3481 - Configure fails to detect dynamic library support on powerpc64le 2016-11-06 20:26:48 -08:00
android-project Provide the correct state of the on-screen keyboard to the API (patch from Sylvain) 2017-08-13 21:05:15 -07:00
build-scripts Fixed bug 2839 - No way to create pre-built libraries for Android 2017-08-13 17:59:59 -07:00
cmake cmake: whoops, Sam and I both fixed this bug at the same time. :) 2017-08-09 22:34:45 -04:00
debian We don't actually build with the Xt library 2017-01-10 23:23:32 -08:00
docs README-linux.md: added libsndio-dev to the package list. 2017-08-07 00:36:45 -04:00
include Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
src Fixed bug 3746 - remove SDLCALL attribute from SDL_BlitFunc() funcptr 2017-08-13 21:09:00 -07:00
test Fixed bug 3605 - Software renderer no longer renders after Android screen orientation change 2017-08-13 21:12:14 -07:00
VisualC Updated Visual Studio 2008 project 2017-07-10 15:55:13 -07:00
VisualC-WinRT WinRT: removed Windows 8.0 from build-bot + NuGet package creation scripts 2017-02-25 21:23:12 -05:00
visualtest Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Xcode Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Xcode-iOS ios: Fixed math include in demos. 2017-05-25 23:01:59 +02:00
.hgignore wayland: Build own version of core protocol 2016-06-23 18:39:05 +08:00
Android.mk Fixed bug 2839 - No way to create pre-built libraries for Android 2017-08-13 17:59:59 -07:00
autogen.sh Don't use pushd/popd in autogen.sh; Ubuntu's /bin/sh doesn't support it. 2016-12-26 22:58:58 -05:00
BUGS.txt BUGS.txt: Changed mailing list link to discourse.libsdl.org. 2017-04-01 00:05:25 -04:00
cmake_uninstall.cmake.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
CMakeLists.txt Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
configure Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
configure.in Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
COPYING.txt Updated copyright for 2017 2017-01-01 18:33:28 -08:00
CREDITS.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
INSTALL.txt More HTTPS doc tweaks. 2017-02-16 16:59:07 -05:00
Makefile.in Fixed bug 3208 - Minor improvements to the configure script 2017-08-12 15:00:33 -07:00
Makefile.minimal Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
Makefile.pandora pandora: Fixed compiler warning about redefining SDL_REVISION. 2017-06-18 23:00:27 +02:00
Makefile.psp PSP: Added missing object for generic TLS to Makefile. 2016-02-13 17:34:14 +01:00
Makefile.wiz Pandora: Updated SDL version in Makefile. 2016-07-19 21:01:30 +02:00
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.txt readme: correct webpage URL to use HTTPS. 2017-02-16 13:30:34 -05:00
sdl2-config.cmake.in Applied Ubuntu patch bug_822210_fix_sdl2-config.cmake_whitespace.patch 2016-10-07 15:08:37 -07:00
sdl2-config.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
sdl2.m4 Fixed bug 3429 - Update AM_PATH_SDL2() to also check for SDL2.framework 2016-09-29 16:37:08 -07:00
sdl2.pc.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL2.spec.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL2Config.cmake Fixed bug 3651 - CMake build does not install CMake package configuration 2017-08-09 19:03:10 -07:00
TODO.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
VisualC.html Fixed two typos in documentation. 2016-01-12 22:23:53 +01:00
WhatsNew.txt Added note for David Carlier's work on OpenBSD 2016-10-12 18:57:12 -07:00

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
https://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting
with README.md

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)