Widget to device pixel alignment under fractional DPI scaling

Dmitry Kazakov dimula73 at gmail.com
Thu Oct 18 11:43:21 BST 2018


Hi, Alvin!

I didn't test Krita much on fractional scaling, but I haven't seen any 
special code in Qt for this alignment. We have a thing like that is 
Krita to support Instant Preview, but it has nothing related to GUI.
> 3. On QOpenGLWidget: It creates the FBO in device pixels in
> `QOpenGLWidgetPrivate::recreateFbo`, but with the code `const QSize
> deviceSize = q->size() * q->devicePixelRatioF();` the FBO size is
> implicitly truncated to integer.
Yes, it looks like truncation is possible here. First, Qt calculates the 
desired size of the widget in DI-pixels, and then allocates a 
framebuffer of a corresponding size. When we do a thing like that in 
Krita, we usually use qCeil() for the final size. But in Qt's code, 
there seem to be no such thing.

I guess the best approach would be if you provided us with a patch that 
we can apply to a local build of Qt in Krita. And after testing by the 
users it would be much easier to push it upstream to Qt :)

>   Is there a possibility of
> rounding errors, especially when the QOpenGLWidget is not using its
> own native window?
I guess there should be some rounding errors, yes. Usually, such errors 
look like semi-transparent or write line at the border of the canvas.

-- 
Dmitry Kazakov



More information about the kimageshop mailing list