Jump to content

PMPaintThread: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 10: Line 10:
'''Note:''' it is not necessary to wait for the ready flag.
'''Note:''' it is not necessary to wait for the ready flag.


[[Category:The OS/2 API Project]]
[[Category:PM++]]

Revision as of 09:26, 14 February 2017

Description

Paint thread class: Allows to dump lenghty paint operations on a secondary thread.

What to do to use the class:

  1. Create the class (you'll want to derive another class and redefine the paint function).
  2. when creating the window that uses the class (in the create() func.) open a DC of the window, get a PS, create the paint thread, and if you want, you may produce a segment on the PS. (openSegment with drawing mode set to DM_RETAIN).
  3. When WM_PAINT is sent to the window, do default processing (ie erasing the window, then stop drawing in the paint thread, wait for ready flag (readySem posted), and post the triggerSem to trigger drawing.
  4. When exiting the window, kill the thread, (optionally calling stop and waiting for ready flag).

Note: it is not necessary to wait for the ready flag.