-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup QPicture dpi scaling workarounds #58122
Conversation
Move to a single function in QgsPainting
This hides the messy scaling workaround details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good move 👍
// Then when being drawn, it scales the painter. The following call | ||
// negates the effect. There is no way of setting QPicture's DPI. | ||
// See QTBUG-20361 | ||
const double xScale = static_cast< double >( QgsPainting::qtDefaultDpiX() ) / painter->device()->logicalDpiX(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not calling applyScaleFixForQPictureDpi and using save/restore instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's considerable overhead in save/restore calls, and it's trivial to avoid them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Just out of curiosity, do you have any discussion/information about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my own experiences profiling QGIS rendering. And it makes sense -- saving / restoring QPainter state requires storing a lot of properties, especially when clip masks are in place. In comparison scaling is an almost zero-cost operation.
Unifies the various QPicture DPI scaling workaround implementations, and adds high level methods to make this simpler to handle