[cairo] Fwd: cairo path rendering bug with inkscape
Carl Worth
cworth at cworth.org
Sat Apr 5 06:54:54 PDT 2008
On Sat, 05 Apr 2008 06:26:30 -0700, Carl Worth wrote:
> So Bulia, I'm throwing the ball back into your court. It appears
> there's a bug in inkscape that is converting some C path elements into
> cairo_move_to instead of cairo_curve_to.
>
> I haven't tried chasing this down into inkscape yet.
It was easy enough to see where inkscape is using cairo_move_to
instead of cairo_curve_to:
In inkscape-cairo.cpp:112:
if (!optimize_stroke || swept.intersects(view))
cairo_curve_to (ct, tm1[NR::X], tm1[NR::Y], tm2[NR::X], tm2[NR::Y], tm3[NR::X], tm3[NR::Y]);
else
cairo_move_to(ct, tm3[NR::X], tm3[NR::Y]);
And sure enough, eliminating that optimization, (as with the below
patch), does make the bug go away. But that's just a band-aid really,
and doesn't tell us what's wrong with the optimization, (since it
should be a reasonable thing to discard curves that are not visible).
I'll look a little closer now.
-Carl
PS. I guess since we're in inkscape's code now, I'll move the
discussion to the inkscape-devel list. Followups need not include the
cairo list anymore.
From ea87c392609cf6ad931bf64b0be35ac6a7233977 Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth at cworth.org>
Date: Sat, 5 Apr 2008 06:48:45 -0700
Subject: [PATCH] Bandaid to avoid incorrect curve optimization
I'm not sure what's wrong with the optimization here, but removing
it definitely clears up bugs. Look at this file with the cairo-based
outline mode both with and without the optimization to see:
http://cairographics.org/~cworth/images/cairobug.svg
(You may need to zoom in a bit to see the bug appear.)
---
src/display/inkscape-cairo.cpp | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp
index 5d87d39..a32cd13 100644
--- a/src/display/inkscape-cairo.cpp
+++ b/src/display/inkscape-cairo.cpp
@@ -109,10 +109,7 @@ feed_curve_to_cairo (cairo_t *ct, NArtBpath *bpath, NR::Matrix trans, NR::Maybe<
tm1 -= shift;
tm2 -= shift;
tm3 -= shift;
- if (!optimize_stroke || swept.intersects(view))
- cairo_curve_to (ct, tm1[NR::X], tm1[NR::Y], tm2[NR::X], tm2[NR::Y], tm3[NR::X], tm3[NR::Y]);
- else
- cairo_move_to(ct, tm3[NR::X], tm3[NR::Y]);
+ cairo_curve_to (ct, tm1[NR::X], tm1[NR::Y], tm2[NR::X], tm2[NR::Y], tm3[NR::X], tm3[NR::Y]);
break;
}
--
1.5.5.rc0.24.g86c30
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080405/266f5bde/attachment.pgp
More information about the cairo
mailing list