hey!

  ---
  RE: problem: PTS_0005075 (for [EMAIL PROTECTED])
  ---

  ok.. this might be a good one for those interested in
  trying to find possible bugs in the PalmOS development
  environment (i have looked - and cannot figure this 
  one out)..

  i am trying to perform double buffering, and i have
  setup a Graphics.[hc] files for a simple interface
  for all of my programs.

  i have a main _Graphics_initialize() routine that does
  the following:

---
void
_Graphics_initialize()
{
  Word error;
 
  scrnBuffer = WinGetDrawWindow();
  backBuffer = WinCreateOffscreenWindow(PALM_WIDTH, PALM_HEIGHT, 
                                        screenFormat, &error);
  ErrFatalDisplayIf(error, "Cannot create offscreen buffer.");
 
  // remove this to make DOUBLE BUFFERING work
 
  backBuffer = NULL;
 
  if (backBuffer != NULL)
    WinInitializeWindow(backBuffer);
}
---

  whenever i do any drawing routines, i perform the following:

---
  if (backBuffer != NULL)
    WinSetDrawWindow(backBuffer);

  // draw

  if (backBuffer != NULL)
    WinSetDrawWindow(scrnBuffer);
---

  and... when i kill my application - i clean up my memory in
  _Graphics_terminate().

---
  WinSetDrawWindow(scrnBuffer);
 
  if (backBuffer != NULL)
    WinDeleteWindow(backBuffer, false);
 
  backBuffer = NULL;
---

  code looks like it should be working to me. but.. when i 
  execute the application on my palm pilot (and in the
  emulator).. it flickers.

  if i turn off double buffering (by setting the backBuffer
  to NULL) - the same occurs, so the double buffering is
  not occuring.

  as a bonus.. when i kill the application, i get an error
  saying that i am trying to read from an unallocated memory
  block.

  this tells me that 

     a) i called _Graphics_terminated, which then frees the
        backscreen buffer

     b) something is still trying to use the backBuffer?
        - this cannot happen, as i check the value of the
          backBuffer (if it is not NULL) before i draw?

  maybe a method synchronization problem?

  the source code and binaries (palm) can be download 
  here (tar.gz or .zip):

    http://www.hig.se/~ardiri/development/palmIII/cube.tar.gz 
    http://www.hig.se/~ardiri/development/palmIII/cube.zip

  i am using Palm III (with patch 3.0.2)
  and my development environment is linux (990108 build)

  maybe it is just a GCC problem (bug)?

  cheers.

az.
--
Aaron Ardiri 
Java Lecturer                  http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 352 8192           A/H: +46 26 10 16 11

Reply via email to