QskGraphic: Scale factors are still off for painter paths
peter-ha opened this issue · comments
The following program calculates zoom factors for painter paths that are still too small for the attached shape (needs to be unpacked first).
#include <QtGui>
#include <SkinnyShortcut.h>
#include <QskGraphic.h>
#include <QskGraphicIO.h>
#include <QskGraphicLabel.h>
#include <QskSetup.h>
#include <QskWindow.h>
int main( int argc, char** argv )
{
QGuiApplication app( argc, argv );
SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugShortcuts );
QskWindow w;
w.setPreferredSize( { 500, 500 } );
QskGraphic = QskGraphicIO::read( QStringLiteral( "shape.graphic" ) );
new QskGraphicLabel( graphic, w.contentItem() );
w.show();
return app.exec();
}
So the purpose of QskGraphicPrivate::PathInfo::scaleFactor*() is for the pen to not draw beneath the rect, because in our initial scale factor calculation we only take the pointRect into account, is that correct?
Unfortunately we can't simply use QPainterPath::controlPointsRect() because of the pens, that might grow out of bounds when being scaled. The code in the scaleFactor methods should be about trying to address this problem.
But this code is derived from code of the Qwt Project - something I wrote > 10 years ago - and I can't remember if tested all corner cases back in the days.