[Development] Aliasing with QSGRectangleNode

Curtis Mitch mitch.curtis at theqtcompany.com
Wed Dec 16 18:12:10 CET 2015


> -----Original Message-----
> From: Gunnar Sletta [mailto:gunnar at sletta.org]
> Sent: Wednesday, 16 December 2015 9:05 AM
> To: Curtis Mitch <mitch.curtis at theqtcompany.com>
> Cc: development at qt-project.org
> Subject: Re: [Development] Aliasing with QSGRectangleNode
> 
> It is curious that the aliasing in the 1x image is not reproducible with
> the Rectangle {} element and only for some of the elements.. Some subtlety
> with the private api. One difference might be that you are giving your
> rectangle nodes an explicit x/y while the Rectangle element uses a
> transform node. It would require a bit of digging..

Thanks! That fixed it. :)

For those interested, I changed it to the following:

        QPointF pos = QPointF(boundingRect().width() / 2 - circleRadius, boundingRect().height() / 2 - circleRadius);
        pos = moveBy(pos, 360 / circles * i, boundingRect().height() / 2 - circleRadius);
        rectNode->setRect(QRectF(QPointF(0, 0), QSizeF(circleRadius * 2, circleRadius * 2)));
        rectNode->setColor(i % 2 == 0 ? QColor("#353637") : QColor("transparent"));
        rectNode->setPenColor(QColor("#353637"));
        rectNode->setPenWidth(i % 2 == 0 ? 0 : 1);
        rectNode->update();

        QMatrix4x4 matrix = transformNode->matrix();
        matrix.translate(pos.x(), pos.y(), 0);
        transformNode->setMatrix(matrix);

> The segmentation you see in the 2x and 6x images is a different problem.
> That comes from the fact that the rectangle node doesn't know its render
> size, so when the thing gets scaled up by 2x or 6x it doesn't know to take
> that scale factor into account. This is another place that needs to look
> up QQuickWindow::effectiveDevicePixelRatio() and apply that to the
> segmentation factor.
> 
> cheers,
> Gunnar
> 
> > On 15 Dec 2015, at 17:03, Curtis Mitch <mitch.curtis at theqtcompany.com>
> wrote:
> >
> >
> > Hi.
> >
> > I'm implementing a busy indicator for the new controls using
> QSGRectangleNode. Even after calling rectNode->setAntialiasing(true), I'm
> noticing some strange aliasing going on. Take a look at the various
> attached screenshots to see what I'm talking about (the 2x/6x variants are
> with QT_SCALE_FACTOR set). For filled "rectangles", there seems to be a
> lack of antialiasing on the outer left side, and for unfilled rectangles
> with borders, it's missing on the left inner side.
> >
> > The attached zip file contains a simplified example to try out.
> >
> > Anyone know why this is happening?
> >
> > Cheers.<busyindicator-simplified-example.zip><aliasing.png><aliasing-
> 2x.png><aliasing-6x.png>_______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list