|
|
|
@ -756,6 +756,24 @@ void TQt3CairoPaintDevice::drawPolygon(const TQPointArray* pointarray, bool wind
|
|
|
|
|
cairo_close_path(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
|
dualStrokePen();
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
|
// The Cairo anti-aliasing code fights back--HARD--when drawing 0px lines!
|
|
|
|
|
// See http://projecthamster.wordpress.com/2009/12/22/getting-sharp-pixels-and-actually-something-drawn-using-cairo/ for more details.
|
|
|
|
|
// This code works around the problem by overstriking the line end points with a single pixel, thereby ensuring they are properly drawn.
|
|
|
|
|
if (m_pen.width() < 1) {
|
|
|
|
|
cairo_save(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_set_line_cap(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_CAP_ROUND);
|
|
|
|
|
cairo_set_line_join(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_JOIN_ROUND);
|
|
|
|
|
cairo_set_line_width(FASTEST_AVAILABLE_PAINTER, 1);
|
|
|
|
|
for (i=0;i<pointarray->count();i++) {
|
|
|
|
|
pointarray->point(i, &x, &y);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
}
|
|
|
|
|
cairo_stroke(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
@ -1354,8 +1372,32 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
|
if (FASTEST_AVAILABLE_PAINTER) {
|
|
|
|
|
cairo_save(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
if (m_pen.style() != TQPen::NoPen) {
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
bool has_current_point = cairo_has_current_point(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
double cr_x2;
|
|
|
|
|
double cr_y2;
|
|
|
|
|
cairo_get_current_point(FASTEST_AVAILABLE_PAINTER, &cr_x2, &cr_y2);
|
|
|
|
|
int x2 = cr_x2-CAIRO_PEN_PIXEL_OFFSET;
|
|
|
|
|
int y2 = cr_y2-CAIRO_PEN_PIXEL_OFFSET;
|
|
|
|
|
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
dualStrokePen();
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
|
// The Cairo anti-aliasing code fights back--HARD--when drawing 0px lines!
|
|
|
|
|
// See http://projecthamster.wordpress.com/2009/12/22/getting-sharp-pixels-and-actually-something-drawn-using-cairo/ for more details.
|
|
|
|
|
// This code works around the problem by overstriking the line end points with a single pixel, thereby ensuring they are properly drawn.
|
|
|
|
|
if (m_pen.width() < 1) {
|
|
|
|
|
cairo_save(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_set_line_cap(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_CAP_ROUND);
|
|
|
|
|
cairo_set_line_join(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_JOIN_ROUND);
|
|
|
|
|
cairo_set_line_width(FASTEST_AVAILABLE_PAINTER, 1);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_stroke(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
@ -1367,6 +1409,23 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
dualStrokePen();
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
|
// The Cairo anti-aliasing code fights back--HARD--when drawing 0px lines!
|
|
|
|
|
// See http://projecthamster.wordpress.com/2009/12/22/getting-sharp-pixels-and-actually-something-drawn-using-cairo/ for more details.
|
|
|
|
|
// This code works around the problem by overstriking the line end points with a single pixel, thereby ensuring they are properly drawn.
|
|
|
|
|
if (m_pen.width() < 1) {
|
|
|
|
|
cairo_save(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_set_line_cap(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_CAP_ROUND);
|
|
|
|
|
cairo_set_line_join(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_JOIN_ROUND);
|
|
|
|
|
cairo_set_line_width(FASTEST_AVAILABLE_PAINTER, 1);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_stroke(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
@ -1459,6 +1518,23 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
dualStrokePen();
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
|
// The Cairo anti-aliasing code fights back--HARD--when drawing 0px lines!
|
|
|
|
|
// See http://projecthamster.wordpress.com/2009/12/22/getting-sharp-pixels-and-actually-something-drawn-using-cairo/ for more details.
|
|
|
|
|
// This code works around the problem by overstriking the line end points with a single pixel, thereby ensuring they are properly drawn.
|
|
|
|
|
if (m_pen.width() < 1) {
|
|
|
|
|
cairo_save(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_set_line_cap(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_CAP_ROUND);
|
|
|
|
|
cairo_set_line_join(FASTEST_AVAILABLE_PAINTER, CAIRO_LINE_JOIN_ROUND);
|
|
|
|
|
cairo_set_line_width(FASTEST_AVAILABLE_PAINTER, 1);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x+CAIRO_PEN_PIXEL_OFFSET, y+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_move_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_line_to(FASTEST_AVAILABLE_PAINTER, x2+CAIRO_PEN_PIXEL_OFFSET, y2+CAIRO_PEN_PIXEL_OFFSET);
|
|
|
|
|
cairo_stroke(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
cairo_restore(FASTEST_AVAILABLE_PAINTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|