nanogui: GrArea slows down machine
Subject:
GrArea slows down machine
From:
Patrick Collins ####@####.####
Date:
11 Apr 2007 13:58:51 +0100
Message-Id: <461CDB73.1070806@railtec-systems.ch>
Hello everybody
I'm working on a software which displays a couple of values as dials.
Good-old analog dials as we're used to them from mom's old car. I'm
using nano-X to do this.
Running the application on my developer's machine is no problem and it
works fine. However, the idea is that the application should run on a
133 MHz industrial PC. On that machine, the whole thing becomes very slow.
To redraw the dial's numbers, after the dial's pointer (or arm) has
passed over it, I call the GrArea function and redraw a square part of
the dial in which the pointer moves. The "drawBackground"-Flag for the
Area's GC is off.
The trouble is that I have to cover the previous pointer with black
(backgroundcolor) and then paint the new one with something visible.
That black pointer covers my dial's values. If I set the black color's
GC_MODE to XOR the dial's values remain visible, of course. But the old
pointer as well.
To prevent flickering of the Pointers the black color's gc gets clipped
with GrSubtractRegion.
So here is what my application does, and I really wonder whether it is
possible to get the same effect with less CPU-cycles:
GrReadArea(...,meter_1); // This gets done only the first time the
window gets freshly drawn
//then, if the value to be displayed changes the following happens:
bool isRedrawn = 0;
if (m_value != oldValue)
{
drawPointer(...); // self-made function where "GdSubtractRegion"
is called a couple of times. Here, the previous pointer gets blackened
and the new one drawn
isRedrawn = 1;
}
if (isRedrawn)
{
GrArea(...,meter_1,1);
isRedrawn = 0;
}
I feel that if I could tell the black pointer covering up the previous
visible pointer not to cover anything but the previous pointer, the
whole application would work somewhat quicker. I guess I could also
forget about the "SubtractRegion"-calls.
Any ideas, anybody?
kindly, Patrick