Buffered MorphOS Drawing

Posted by ALB42 on 31. Januar 20162 Comments

I noticed something strange in MorphOS LCL, I made a little Painting program in LCL. When the mouse moves over the image and the window is not active it works as expected (coordinate and pixel color) but when clicked into the Painting area or the window is active it becomes very slow and the mouse pointer stops.
I made some tests and noticed the difference is that the main painting region gets repainted and there it becomes slow, but its not the drawing routine self.
 

MorphOS SimplePaint

MorphOS SimplePaint


 

The drawing works at the moment in this (buffered) way:

  • MUIM_Draw – Event appears
  • MUI_AddClipping – set a Clipping
  • Create a new Buffer RastPort
  • Create a Bitmap (AllocBitmap) for the Buffer Rastport, with width and height of the drawing area, Depth from the MUI rastport (from Renderinfo), BMF_MINPLANES or BMF_CLEAR and the bitmap of the MUI rastports Bitmap as Friend Bitmap
  • ClipBlit of the MUI Rastport to the Buffer Rastport
  • Drawing of the LCL things to the Buffer Rastport
  • ClipBlit of the Buffer Rastport to the MUI RastPort
  • Destroy Buffer Rastport and Bitmap
  • Remove Clipping
  • Leave Draw Event

If I remove the Buffering, so draw directly onto the MUI RastPort it stays fast and the mouse pointer makes no problems. When the program starts this stuttering mouse pointer is maybe related to it also? I noticed also other programs have this stuttering mouse on start (OWB for example). I still have no idea why.

2 comments to "Buffered MorphOS Drawing"

  1. Wouldnt it be faster to allocate the backdraw bitmap after the size of the full component, and only re-allocate on resize?

    • ALB42 sagt:

      Could be, currently I’m in the state of make it work… 😉 and not make it more complicated than it is already. Speed difference should be not very big (beside this MorphOS problem) at least speed does not change when comparing with directly draw onto the Rastport of the Element.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.