Article View: comp.sys.acorn.tech
Article #440Re: Flicker-free Icon updating
From: TMOTA
Date: Tue, 29 Sep 1992 02:45
Date: Tue, 29 Sep 1992 02:45
36 lines
2522 bytes
2522 bytes
SMARTIN@ESOC.BITNET writes: >I am writing an application that requires a number of text icons to be >updated fairly regularly (frequency definable by the user). Currently, I >am using the SWI SetIconState with zero arguments to force an update, but >if the update frequency is more than a few frames per second, the flicker >is quite intolerable with or without icon borders. Well, as others have said, you can call Os-Byte 19 / *FX19 / WAIT just before causing update. THis works well, except near the top of the screen, and aslo has the drawback of slowing things down a lot if you update many times a second (especially if other programs are also WAITing... An ARM-3 machine can do up to around 260,000 instructions in the time it takes to do a WAIT!) Another trick that can reduce flicker substantially is to draw your info into a sprite, and then SetIconState,0,0 the icon containing the sprite. This should be near flicker-free without a WAIT, but a WAIT as well should make it very good. Minimising the area of the screen can help a lot too. If you have something like "Reading file: 10%", all you really need to update is the percentage, and so you can stop the flicker of the text "Reading file" completely. As you are drawing less (2 characters only now), the redraw is faster, so the flicker on the updated number is also reduced. The last trick is to think about what info you are updating - does it need to be updated so frequently? You could read the time when you update the icon (SWI "OS_ReadMonotonicTime" TO timenow) and refuse to update the icon until the new time is > 25 centiseconds or so, giving a maximum speed of update of 4 updates a second... When doing a lot of stuff you can end up continuously redrawing the icon and doing very little processing, and this can stop that type of problem from happening. -- _________________ "I'd like to answer this question in two ways: /____ _ _/_ __ First in my normal voice, and then // / //_//_ /_/ in a silly, high-pitched whine." (Monty Python)
Technical Details
Message-ID:
<1992Sep29.024537.6255@cs.aukuni.ac.nz>Path:
arc1-ca.pugleaf.net!sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1References:
<92272.103620SMARTIN@ESOC.BITNET>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1 Newsgroups: comp.sys.acorn.tech Subject: Re: Flicker-free Icon updating Message-ID: <1992Sep29.024537.6255@cs.aukuni.ac.nz> From: jwil1@cs.aukuni.ac.nz (TMOTA) Date: Tue, 29 Sep 1992 02:45:37 GMT Sender: jwil1@cs.aukuni.ac.nz (TMOTA) References: <92272.103620SMARTIN@ESOC.BITNET> Organization: Computer Science Dept. University of Auckland Lines: 36