Re: Bugs in Dia's MetaPost Plug-In

Hi all,

So the problem is that the bubbles appear at all?  I guess maybe if
the line width isn't correctly reset between drawing the arrow and
drawing the rectangle corners using that, we could see this effect.
The order does come into play in that it determines what should be
drawn on top of what, which is normally handled in lib/diagramdata.c
in layer_render, but the plugin can do it itself if it wants to.  If
anything, it's the same or a related bug as #1, involving correct
setting of line width -- or maybe some rendering functions don't do
the linecap correctly.

Now I understand the problem and, of course, you are right. By bringing
the first rectangle into background it is drawn before the thick arrow
and therefore line width was not yet touched. So of course, there is
only the line width bug.

The problem lies more or less in the end_draw_op method:
It is called in plug-ins/metapost/render_metapost.c::fill_rect and this
method is called in objects/standard/box.c::box_draw.
But this happens before there the method set_linewidth is called, so we
still use the old line width as it was set, e.g. by a thick lined arrow.

Several solutions are possible:
1.) Move all lines calling set_* methods in objects/standard/box.c such
that this code is executed before the fill methods.
2.) eleminate end_draw_op which mean a lot of duplicated code (not
3.) create a new global variable which remembers whether or not end
_draw_op fills an object or draws a line and such decides which line
width to use (this was the first idea for my patch, before I got behind

Actually I prefer the first solution, but I don't know if there could
be any interferences with other plugins or so. I tried this solution
and can't see any problems, but maybe you do.

It might behoove the metapost plugin to
define its own rendering for rounded rectangle, I would think it can
do it better than the default (which uses quarter-arcs).
This should be possible. I will think about it.

I already wrote a patch for this which I will send to this list. It
simply remembers at the end of each function whether it is going to
draw a line or to fill an area in the function

Shouldn't you be setting the corner style, too, to avoid rounded
corners on non-filled arrows (see attached file)?  
Forget about the patch I told you about. I got an idea for this, give me
some time.


P.S.: Would you mind adding *.lo and *.la to the .cvsignore file of the
visio plugin directory (plug-ins/vdx/) ?! Maybe the same with stamp-it
in po directory but I don't really know.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]