c++ - wxWidgets wxPen size changes unexpectedly -


i've used following code draw on image using wxmemorydc. used wxpen , changed settings of pen in following code. code compiles , runs in windows environment. in ubuntu draws lines pen size stays correctly little time , pen size becomes low.(as shown in image) not error of m_pensize variable because prints correct value. why works strange in ubuntu when works correctly in windows?.

(m_graphics memorydc here)

            if (x<m_backgroundimage.getwidth() && y< m_backgroundimage.getheight()){                 m_graphics.selectobject(m_maskimage);                 wxpen* pen;                 if (m_isdrawing){                     pen = wxthepenlist->findorcreatepen(*wxred, m_pensize);                     printf("pen size %d", m_pensize);                 }                 else{                     pen = wxthepenlist->findorcreatepen(*wxblack, m_pensize);                 }                 if (m_pentype != circle){                     pen->setcap(wxcap_projecting);                 }                 m_graphics.setpen(*pen);                 m_graphics.drawline(m_lastx,m_lasty,x,y);                 m_graphics.selectobject(wxnullbitmap);             } 

in windows shown correctly enter image description here

in linux pen size changed unexpectadly. enter image description here

your appreciated.

if same code behaves differently in wxmsw , wxgtk, it's bug in wxwidgets itself, fix it needs reproduced in simple test way, ideally making smallest possible change wxwidgets drawing sample , opening ticket attaching change patch it.

to simplify code as possible, i'd recommend:

  1. getting rid of wxthepenlist , creating pen directly. it's unlikely bug here, knows.
  2. check if it's not due setcap() call, candidate imho.

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -