Arcs are always printed as pies when using wxGtkPrinterDC
|Reported by:||charras||Owned by:|
Under wxWidgets 2.9.5 (and 3.0 RC) and GTK only,
compiled with --with-gtkprint option
when printing arcs, there are an one inconsistency and one bug.
Simples arcs are printed as pies, i.e. with a line from the center to each arc end point.
Obviously, they are drawn without these lines.
When an ending point of the arc is + or - 90 degrees, the arc printing is broken.
the fix is easy, and here is my poor fix:
--- src/gtk/print.cpp (revision 75057)
+++ src/gtk/print.cpp (working copy)
@@ -1375,10 +1375,10 @@
alpha1 = (x1 - xc == 0) ?
- (y1 - yc < 0) ? 90.0 : -90.0 :
+ (y1 - yc > 0) ? 90.0 : -90.0 :
atan2(double(y1-yc), double(x1-xc)) * RAD2DEG;
alpha2 = (x2 - xc == 0) ?
- (y2 - yc < 0) ? 90.0 : -90.0 :
+ (y2 - yc > 0) ? 90.0 : -90.0 :
atan2(double(y2-yc), double(x2-xc)) * RAD2DEG;
while (alpha1 <= 0) alpha1 += 360;
@@ -1393,8 +1393,8 @@
cairo_arc_negative ( m_cairo, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2);
- cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc));
- cairo_close_path (m_cairo);
+ cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc));
+ cairo_close_path (m_cairo);
SetBrush( m_brush );
cairo_fill_preserve( m_cairo );
I am thinking try to optimize a call to atan2 is not very useful in a print function (and this optimization certainly already exists in atan2).
Thanks to wxWidgets developers for all this work.
Change History (5)
comment:1 Changed 15 months ago by vadz
- Status changed from new to confirmed
- Summary changed from Under GTK: Arcs are printed as pie and are broken when starting or ending at 90 degrees to Arcs are always printed as pies when using wxGtkPrinterDC