We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3562 - Screen glitch with landscape application
Summary: Screen glitch with landscape application
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: don't know
Hardware: All Android (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-18 15:47 UTC by Sylvain
Modified: 2017-04-08 00:18 UTC (History)
1 user (show)

See Also:


Attachments
patch (8.11 KB, application/mbox)
2017-01-18 15:47 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2017-01-18 15:47:47 UTC
Created attachment 2682 [details]
patch

With an android landscape application, if you quickly lock, then unlock your device, 
you can see sometimes a quick glitch: screen badly draws in portrait, then it correctly displays in landscape.

Not talking of a smooth rotation, it's a drawing glitch. And you need to have a plain lock screen, with no model nor passphrase. 


I think it happens because the call to "nativeResume()" occurs sometimes too early.

It should be done once you have *all* those three things (in any sequence): 
- onWindowsFocusChanged() set to true
- onResume() called
- a valid call to onSurfaceChanged()


Currently, this is not the case: you don't need to have onResume() called. Just need to have isPaused, (eg onPaused()).
So "isPaused" should be renamed as "isResumedCalled".
But you also need some kind of isPaused state to make sure to don't call nativePause() twice (and deadlocks...).
There are also redundant checks to "mHasFocus" and some creation of the initialisation thread code from onSurfaceChanged() that could me moved.

So here's this patch:
- add some states, so we have cleaner transitions.
- make sure "onResume()" is called.
- some clean up
- it also goes faster in pause state (focus changed, onPause, without requiring isSurfaceReady which does seems to be needed).


Tested on a few devices and it removes the glitch.
But I haven't tested when the activity goes back to "init" state.
Comment 1 Sam Lantinga 2017-01-18 19:59:56 UTC
Gabriel, can you take a look at this?
Comment 2 Ryan C. Gordon 2017-04-08 00:00:07 UTC
Taking this bug.

--ryan.
Comment 3 Ryan C. Gordon 2017-04-08 00:18:03 UTC
This patch is now https://hg.libsdl.org/SDL/rev/f0ddcc015995, thanks!

--ryan.