Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139997

Curve renderer matrix scale detection fails when layer is enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 6.11.0 FF
    • 6.5.10, 6.10.0 Beta3
    • Quick: Shapes
    • None

      The curve renderer has logic to detect the current scale in order to get the antialiasing right. However, when layer is enabled, this will always be 1, even if the scene has a scale. This causes very blurry results.

      Example:

      import QtQuick
      import QtQuick.VectorImage
      import QtQuick.VectorImage.Helpers
      import QtQuick.Shapes
      
      Window {
          id: win
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Item {
              anchors.centerIn: parent
      
              implicitWidth: 100
              implicitHeight: 100
      
              scale: 10
      
              id: _qt_node0
              Item {
                  objectName: "myMask"
                  id: _qt_node1
                  visible: true
                  implicitWidth: 100
                  implicitHeight: 100
      
                  layer.enabled: true
                  layer.textureSize: Qt.size(1000, 1000)
      
                  Shape {
                      id: _qt_node2
                      implicitWidth: 100
                      implicitHeight: 100
                      preferredRendererType: Shape.CurveRenderer
                      ShapePath {
                          id: _qt_shapePath_0
                          strokeColor: "transparent"
                          fillColor: "#ffffffff"
                          fillRule: ShapePath.WindingFill
                          PathSvg { path: "M 0 0 L 100 0 L 100 100 L 0 100 L 0 0 " }
                      }
                  }
                  Shape {
                      id: _qt_node3
                      implicitWidth: 80
                      implicitHeight: 80
                      preferredRendererType: Shape.CurveRenderer
                      ShapePath {
                          id: _qt_shapePath_1
                          strokeColor: "transparent"
                          fillColor: "#ff000000"
                          fillRule: ShapePath.WindingFill
                          PathSvg { path: "M 10 35 C 10 23.9543 18.9543 15 30 15 C 41.0457 15 50 23.9543 50 35 C 50 23.9543 58.9543 15 70 15 C 81.0457 15 90 23.9543 90 35 C 90 55 76.6667 75 50 95 C 23.3333 75 10 55 10 35 " }
                      }
                  }
              }
          }
      }
      

      This looks as follows:

      Either we have to somehow detect the real scale factor; not sure why it's wrong, since the shape is scaled correctly and drawn at the correct size, so we must be passing in the right matrix somewhere..

      Alternatively, we could perhaps detect when we are rendering to a layer and enable the fragment shader gradients in that case, like we do for 3D (granted that it's available). This would at least fix the issue for a majority of targets at the expense of some extra GPU time when rendering the layer.

        1. image-2025-09-08-14-59-46-628.png
          45 kB
          Eskil Abrahamsen Blomfeldt
        For Gerrit Dashboard: QTBUG-139997
        # Subject Branch Project Status CR V

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes