From 7ad6fed3359d4241f1bb7824042fd902e802ea5a Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 19 Feb 2025 08:42:11 +0100 Subject: [PATCH] preparing the code to be able to skip QPainter::Antialiasing --- tools/svg2qvg/main.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/svg2qvg/main.cpp b/tools/svg2qvg/main.cpp index 2695a80f..c0c0691f 100644 --- a/tools/svg2qvg/main.cpp +++ b/tools/svg2qvg/main.cpp @@ -41,6 +41,28 @@ static QRectF viewBox( QSvgRenderer& renderer ) return hasViewBox ? viewBox : QRectF( 0.0, 0.0, -1.0, -1.0 ); } +class Graphic : public QskGraphic +{ + protected: + void addCommand( const QskPainterCommand& cmd ) override + { +#if 0 + if ( cmd.type() == QskPainterCommand::State ) + { + /* + QSvgRenderer enables QPainter::Antialiasing initially + However this is something we might want to decide, + when replaying the commands. + */ + auto sd = const_cast< QskPainterCommand::StateData* >( cmd.stateData() ); + sd->renderHints &= ~QPainter::Antialiasing; + } +#endif + + QskGraphic::addCommand( cmd ); + } +}; + int main( int argc, char* argv[] ) { if ( argc != 3 ) @@ -71,7 +93,7 @@ int main( int argc, char* argv[] ) if ( !renderer.load( QString( argv[1] ) ) ) return -2; - QskGraphic graphic; + Graphic graphic; graphic.setViewBox( ::viewBox( renderer ) ); QPainter painter( &graphic );