utelle / wxpdfdoc

wxPdfDocument - Generation of PDF documents from wxWidgets applications
http://utelle.github.io/wxpdfdoc/
Other
70 stars 27 forks source link

wxPdfDC::DrawSpline uses wrong pen #51

Closed pele65 closed 5 years ago

pele65 commented 5 years ago

Thank you for this great lib! I'm just starting to use it (master 0.9.6 from 2018-12-09) When I call wxPdfDC::DrawSpline with different pens the splines are drawn with an older pen. It seems the proper pen is used when I call DrawLines before. In wxPdfDCImpl::DoDrawSpline the line SetPen( m_pen ); maybe should be replaced with SetupPen(); If I change this, the splines are drawn correctly. I do not know enough about this lib yet to be sure about this change.

utelle commented 5 years ago

When I call wxPdfDC::DrawSpline with different pens the splines are drawn with an older pen. It seems the proper pen is used when I call DrawLines before.

That shouldn't be necessary, of course.

In wxPdfDCImpl::DoDrawSpline the line

SetPen( m_pen );

maybe should be replaced with

SetupPen();

If I change this, the splines are drawn correctly.

You are absolutely right. SetPen just remembers the selected pen, but doesn't apply it to the PDF document. Obviously, it is a bug to use SetPen instead of SetupPen. That it wasn't detected for quite a long time, indicates that method DrawSpline is seldom used.

Thanks for reporting the bug. I will fix it shortly.

utelle commented 5 years ago

Commit 019cb1a0ae10f408c1cec032a43cc4ba319e31cf fixes the issue.