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

Item.antialiasing broken when layer.enabled=true

    XMLWordPrintable

Details

    Description

      Here's a small example to reproduce the issue:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Row {
              anchors.centerIn: parent
      
              spacing: 64
      
              Rectangle {
                  width: 200
                  height: 200
                  color: "black"
                  rotation: 51
                  antialiasing: true
      
                  Rectangle {
                      anchors.fill: parent
                      anchors.margins: 64
                      antialiasing: true
                  }
              }
      
              Rectangle {
                  width: 200
                  height: 200
                  color: "black"
                  rotation: 51
                  antialiasing: true
                  layer.enabled: true
                  layer.smooth: true
      
                  Rectangle {
                      anchors.fill: parent
                      anchors.margins: 64
                      antialiasing: true
                  }
              }
      
          }
      }
      

      As you can see, the rectangle on the right has very jagged edges while the one on the left is perfectly fine.

      According to the document in the Antialiasing section, both rectangles should be rendered with antialiasing feature.

      Vertex antialiasing can be enabled and disabled on a per-item basis using the Item::antialiasing property. It will work regardless of what the underlying hardware supports and produces higher quality antialiasing, both for normally rendered primitives and also for primitives captured into framebuffer objects, for instance using the ShaderEffectSource type.

      Since an item with layer enabled become a texture provider, I think we can also easily smooth the edges of the textures that requests antialiasing.

      Attachments

        1. qml-antialiasing-effect.png
          qml-antialiasing-effect.png
          6 kB
        2. qml-antialiasing-layer.png
          qml-antialiasing-layer.png
          4 kB
        3. screenshot-1.png
          screenshot-1.png
          7 kB
        4. screenshot-2.png
          screenshot-2.png
          12 kB
        5. screenshot-3.png
          screenshot-3.png
          14 kB
        For Gerrit Dashboard: QTBUG-121584
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            gpbeta Joshua GPBeta
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change