QUItCoding / qnanopainter

Library for implementing OpenGL accelerated Qt (Quick) C++ UI components.
http://quitcoding.com
Other
405 stars 79 forks source link

Solid line turns into dashed (AA disabled, 1px width) #85

Open Aleksevs opened 6 months ago

Aleksevs commented 6 months ago

Hello!

Tried to draw 1px polyline without antialiasing but bumped into a strange behaviour. Lines drawn almost vertically became dashed (see left pic). paint_glitch

Drawing sequence is like following (paint method in modified HelloWidget example):

p->setLineWidth(1);
p->setPixelAlign(QNanoPainter::PIXEL_ALIGN_NONE); // (Doesn't affect anything)
p->beginPath();

p->moveTo(200+0.25, 392); // (Fraction added to make assymetry)
p->lineTo(200+0.25 + 4, 0);
//p->moveTo(200+0.25 + 4, 0); // (*) Removes dashing
p->lineTo(200+0.25 + 8, 392);

p->setStrokeStyle("#202020");
p->stroke();

At the same time, after (*) line is uncommented, the plot gets much better (right pic). Could you please give a clue how to fix this issue without adding moveTo for each line?

PS. Qt 5.15. Debug output during start:

Creating suitable QNanoBackend for OpenGL 4.6 context
Using backend: "OpenGL 3"

Regards, Alekseus