Hello Wojtek,
Thanks again for your input. I do understand Qnx’s desire to have
developers not stray outside boundaries so I apologize for this. I
do think my straying will result in a cleaner system design.
I will try to clarify my needs so you can maybe understand why I would
prefer to plot directly instead of go through the DamageWidget
process.
My system is composed of two processes on the same hardware. Process
1 is a high priority real time process performing a servoing
operation. It acquires a/d data, manipulates it, and then outputs the
values in d/a form. Concurrent with doing this, the process will
store a/d data in shared memory for evaluation by the system operator.
The data update rate is reasonably fast–around 2000 hz.
A second process, P2 runs at a lower priority and provides graphic
displays of the data in shared memory via photon. As new data is
ready for display, P1 will trigger a proxy attached to P2. P2 will
then know that new data is available and the graphic display needs
updating. I have written a main loop using a Receive, PhEventRead,
PtEventHandler loop as described in the PhEventRead example in the
manual. If the Receive pid is not a photon event (determined by
PhEventRead) I check to see if it is the new data proxy, and if so, I
will do my updates. In this way, my updates occur only when photon is
in a stable state-not mid any PtEventHandler activity.
The display update will usually involve updating 15-30 50x10 pixel
areas scattered about the display area.
One option would be to generate a PtDamageWidgetExtent call for each
of the 15-30 update areas. This would be a little tricky, in that the
physical plotting location will not provide me with sufficient
information to update the pixels. I will have use my window repair
algorithm for these little rectangles.
As an aside, the window repair algorithm is designed to repair good
size chunks of the video display since this will be the most likely
occurrence. The windows will be rarely occluded and when occluded it
will be some good size rectangular window (some sort of option
selection window). The current display status model is fairly complex
hence using this model for small updates would be clumsy.
So, using the PtDamageWidgetExtent to update the screen will be
reasonably complex, in my opinion.
The direct plotting of the raw widget is much simpler. I just simply
go to the various rectangles that need updating and update them. I
change my model so they can be restored in case of damage and that’s
it. I have all the information I need for updating at the time of
update. It is very clean, in my opinion.
Photon will handle all the window occluding–the only thing I will not
be able to do (it seems to me) will be to create widgets on my windows
that are not windows themselves. I have experimented with this and it
seems to work. I do the following:
Oldcontext = PgSetGC(created context)
PgSetRegion(parent window’s region)
do my updates
PgSetGC(OldContext)
done
You have said that photon will do a flush on the PgSetGC call, so I
don’t flush the drawing buffer before I restore the context.
This all seems to work fine. Do you see any problems that I am likely
to have that I have not anticipated?
One thing I have noticed: The raw widget I have created has an rid of
zero (raw → rid) so I am using the rid of the raw widget’s parent
window. Why would the raw widget have an rid of zero?
Thanks,
Greg Laird
On 24 Oct 2000 16:32:15 GMT, Wojtek Lerch <wojtek@qnx.com> wrote:
Greg Laird <> glaird@teleport.com> > wrote:
I had thought to use DamageWidgetExtent after I submitted the post but
have concluded that this would not work that well because clipping
would be active when my damage repair function was called. I would
only be able to repair the damage in the areas that were specified as
I don’t think I get it. Why would you need to redraw areas that you
haven’t given to DamageWidgetExtent()? Or, in other words, why would you
not give DamageWidgetExtent() any areas that you do need to redraw?
BTW In case you think it’s a problem that DamageWidgetExtent() only
takes a single rectangle: if you call PtHold(), then
DamageWidgetExtent() a few times, and then PtUpdate(), your draw
function will be only called once, and the damage list will be the
intersection of all the rectangles that you gave to
DamageWidgetExtent(). Does that help?
damaged. Possibly, if I could DamageWidgetExtent the complete raw
canvas in a way that would be decrenable from ‘real’ damage by my draw
routine, this would work.
Of course, you could set a global flag or something before calling
DamageWidgetExtent(), and clear it in your draw function. Note however
that when your draw function gets called eventually, there is a chance
that your damages have been merged with some unrelated damages, and you
need to also redraw things that have nothing to do with your global flag
and your call to DamageWidgetExtent().
I would prefer to do the change context and PgDraw and the restore the
context as I described in my original post–it seems much more
straightforward. Mitchell has suggested that he thought this would
work–do you see any problems? I am using Photon 1.14, Qnx 4.25. All
of this will occur on a single machine.
It can work but will be less efficient (switching a GC causes a flush)
and requires more knowledge about how the context needs to be set up.
It will be particularly difficult if other widgets in your window might
partially cover your PtRaw widget.
\
Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.