Menu

Ideas for improvement

2009-10-09
2013-04-08
  • Mathias Dz.

    Mathias Dz. - 2009-10-09

    Hi,

    some suggestions for the next release:

    In wxSFLineShape i've changed the visibility of the members m-nSrcOffset and m-nTrgOffset to protected. I'm using my own data model and need access to them for saving and restoring.

    The wxSFScaledDC has problems with small font sizes. Here's a fix:

    void wxSFScaledDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
    {
    if( m_fEnableGC )
    {
    #if wxUSE_GRAPHICS_CONTEXT
    //InitGC();
    m_pGC->DrawText( text, x, y );
    //UninitGC();
    #endif
    }
    else
    {
    wxFont font = GetFont();
    wxFont prevfont = font;

    if(font != wxNullFont)
    {
    int scaledSize=font.GetPointSize()*m_nScale;
    if (scaledSize>0) {
    font.SetPointSize(scaledSize);
    SetFont(font);
    m_pTargetDC->DrawText(text, Scale(x), Scale(y));
    }
    }
    else
    m_pTargetDC->DrawText(text, Scale(x), Scale(y));

    SetFont(prevfont);
    }
    }

    Regards,

    Mathias

     
  • Michal Bližňák

    Hi, thank you for the feedback. I've implemented requested changes in SVN 248. Your patch couldn't be applied as it is because you cannot draw texts if used font is NULL (at least on some supported platforms) but now the used font cannot be smaller than 1pt.

     
  • Mathias Dz.

    Mathias Dz. - 2009-10-09

    Hi again,

    i've discovered a performance issue, when creating many shapes. My project creates 200 shapes. Most of the time (92%) is spent in the function wxXmlSerializer::GetNewId().

    GetNewId() makes a linear search and calls IsIdUsed() which calls GetIDCount(). GetIDCount() makes a linear search over all shapes again. The generation of the 200. ID iterates over 40.000 shapes.

    It's not urgent, perhaps you can implement a better algorithm some time.

    But in general the wxShapeFramework is a very nice thing.

     
  • Michal Bližňák

    Hi, I've implemented completely new approach for IDs' handling (IDs are stored in map containing also pointer to owners now) so the performance of all ID's related functions should be much higher now. Please, test the latest SVN (249) and let me know whether it helped you. Thank you. M.

     
  • spanner888

    spanner888 - 2009-10-13

    Hi Michal

    these speed changes are a very good improvement thanks heaps, as the app I am creating needs to scale to large numbers of shapes/lines.  This change makes at least a fourfold improvement on my slow test system!

    The other changes/additions in SVN249 and in v1.80 are also greatly appreciated - your libraries are rapidly maturing!

     

Log in to post a comment.