|
From: Bastian M. <bma...@we...> - 2008-09-08 18:34:08
|
Ethan Merritt schrieb:
>
> But I see that the bug demonstrated by the attached script is still present.
> I have reverted in CVS the patch that I suspect is responsible.
> Bastian Maerkisch is looking into the problem, but until we have a more solid
> fix I think reversion is best.
>
> Petr:
> Could you test whether the latest CVS (just changed a few minutes ago) fixes
> the win terminal bug as tested by the attached script?
>
> Bastian:
> The original patch that I have reverted looks wrong to me, now that I have
> stared at the code. Do you have a script that demonstrates the problem it
> was originally intended to fix? So far as I can see, there should be no
> path through the code that produces a "polyline of length 1". The vertex
> counter starts at 1, and each polyline vector call increases it. So
> (polyi == 1) really means a polyline of length 0, and we shouldn't draw it.
> But maybe it should execute a MoveTo()?
>
Ethan, your conclusion is not correct.
Polylines are drawn with commands like this:
MOVE, VECTOR, VECTOR, VECTOR, VECTOR, ...
The code defines the end of a polyline if the next command is not VECTOR.
In the case of RGB color lines there actually are length 1 polylines.
That's because they are drawn with commands like like that:
MOVE, COLOR, VECTOR, COLOR, VECTOR, COLOR, ...., VECTOR
The fix, which you just reverted, fixes this.
The new bug is IMHO triggered by some ill-behaviour of the Windows API.
In the case you just send me the command sequence is like this:
MOVE, VECTOR, COLOR, VECTOR, COLOR, VECTOR, COLOR, ...., VECTOR
The first move and vector command reference the same point. The windows
API optimizes this away and does not even update the drawing position.
So with the next VECTOR we get "spurious" lines.
Why don't you try the single line fix I sent to the mailing list? We
hist add an additional MoveTo() after each Polyline, like this:
if ((lastop==W_vect) && (curptr->op!=W_vect)) {
if (polyi >= 2) {
Polyline(hdc, ppt, polyi);
MoveTo(hdc, ppt[polyi-1].x, ppt[polyi-1].y); /* make sure we move the
drawing position in case of empty polygons */
} else if (polyi == 1)
LineTo(hdc, ppt[0].x, ppt[0].y);
polyi = 0;
}
|