home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / acorn / 8010 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  4.5 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1
  2. Newsgroups: comp.sys.acorn
  3. Subject: Re: Graphics context switching.
  4. Message-ID: <1992Jul23.232024.28540@cs.aukuni.ac.nz>
  5. From: jwil1@cs.aukuni.ac.nz (TMOTA)
  6. Date: Thu, 23 Jul 1992 23:20:24 GMT
  7. Sender: jwil1@cs.aukuni.ac.nz (TMOTA)
  8. References: <1992Jul24.102619.9594@waikato.ac.nz>
  9. Organization: Computer Science Dept. University of Auckland
  10. Lines: 72
  11.  
  12. bwc@waikato.ac.nz (Ug!) writes:
  13.  
  14. >When RiscOS swaps from one application or 'task' to another, it needs to save
  15. >some information regarding what that task was doing.  This information is
  16. >usually referred to as a 'context'.  It's important to keep a whole heap of
  17. >information about what each task is doing with graphic: imagine that you are
  18. >half way through drawing a line, your application gets swapped out, and when
  19. >you come back, the starting point of your line has changed!  That would cause
  20. >all sorts of wierd behaviour.
  21.  
  22. ...except that the application chooses when to be paged out - we don't have
  23. pre-emptive multitasking. Thus, it is up to the application to remember
  24. where it left off... In fact, in the middle of a redraw, when you call
  25. Wimp_GetRectangle to get the next rectangle to draw, the WIMP sets the
  26. drawing colour back to black (I spent about 3 hours trying to figure out
  27. what was wrong with my DSEdit cursor update routine before I realised that
  28. somebody was changing my EOR plotting mode back to black! Argh!)
  29.  
  30. >When RiscOS switches, it copies *all* (or maybe just most) of the information
  31. >regarding what the graphics system is currently doing (have a look at
  32. >OS_ReadVDUVars sometime to see how much information there is) into the context
  33. >of the application which has just finished, and then copies all the information
  34. >back again from the application which is about to recommence.  That's a fair
  35. >bit of copying.
  36.  
  37. Actually, it doesn't copy any of this information. It's up to the app.
  38. to remember things like this. For example, if you select a sprite to draw
  39. with, then after a Wimp_Poll, you cannot assume that sprite is still
  40. the selected one, so when you start drawing again, you must re-select the
  41. sprite (sortof "restore your graphics context"). This is actually pretty
  42. good, because the application only restores the parts of the total context
  43. that it is actually interested in.
  44.  
  45. The WIMP also changes some values to defaults before calling an app. so that
  46. you can rely on the fact that when you are called, the painting mode is not
  47. left in EOR mode or using dotted lines or whatever. But this is not restoring
  48. a saved context - it simply wipes the context back to a safe default, which
  49. you then modify back to the state that you need. Often this means you don't
  50. have to do anything much (maybe just change the plotting colour)
  51.  
  52. The problem of saving contexts only happens when printing (and some other
  53. activities) when your output is trapped and sent into a sprite rather than
  54. to the screen - to put it simply, to print, you start the printer driver up
  55. and then redraw your window contents - but the redraw doesn't go to screen,
  56. it is redirected into the printer driver's own "strip buffer" sprite.
  57.  
  58. The problem with printing in a real "background multitasking" fashion is that
  59. our current printing system uses cooperative multitasking - The printer
  60. driver, once started on a page, is a single-tasking entity communicating
  61. with the printing app. via SWIs. If the application doesn't Wimp_Poll, then
  62. you don't multitask at all.
  63.  
  64. The problem is that to really do it properly you either need a new cooperative
  65. system designed from the bottom up as a multitasking printer driving system,
  66. or the current system has to be modified to pre-empt the current print job,
  67. save the current graphics context, and then Wimp_Poll.
  68.  
  69. The major problem with this is that none of our applications expect to be
  70. pre-empted in this fashion - what do you do if a message must be delivered
  71. to the printing application? Is it re-entrant?
  72.  
  73. Thus, the only real-world solution I can see happening is that we get
  74. partial multitasking as an option, for example, printing a single page to
  75. a file, and then multitasking while the file is dumped in the background
  76. to the printer - this would be very rough, but implementing a better
  77. background printing system would (I think) mean re-designing the current
  78. printing system completely with multitasking as it's main objective.
  79.  
  80. -- 
  81. _________________  "I'd like to answer this question in two ways:
  82.   /____ _ _/_ __       First in my normal voice, and then
  83.  // / //_//_ /_/       in a silly, high-pitched whine." (Monty Python)
  84.