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

Clipping Rectangle within Flippable can create rendering artifacts when flipped

    XMLWordPrintable

Details

    Description

      import QtQuick 1.0
      
      Rectangle {
          id: window
          width: 360
          height: 640
      
          Flipable {
              id: flipable
              anchors.fill: parent
      
              front: Rectangle {
                  anchors.fill: parent
                  color: "red"
      
                  Rectangle {
                      anchors.centerIn: parent
                      x: 50; y: 50
                      width: 250; height: 250
                      color: "black"
                      clip: true
      
                      Rectangle {
                          anchors.centerIn: parent
                          width: 200
                          height: 200
                          color: "blue"
                      }
                  }
              }
      
              back: Rectangle {
                  anchors.fill: parent
                  color: "red"
      
                  Rectangle {
                      anchors.centerIn: parent
                      x: 50; y: 50
                      width: 250; height: 250
                      color: "black"
                      clip: true
      
                      Rectangle {
                          anchors.centerIn: parent
                          width: 200
                          height: 200
                          color: "blue"
                      }
                  }
              }
      
              transform: Rotation {
                  id: rotation
                  origin.x: flipable.width/2
                  origin.y: flipable.height/2
                  axis.x: 0; axis.y: 1; axis.z: 0
                  angle: 0
      
                  Behavior on angle {
                      RotationAnimation { duration: 500 }
                  }
              }
          }
      
          MouseArea {
              anchors.fill: parent
              onPositionChanged: rotation.angle = ((360/window.width) * mouseX) - 90
          }
      }
      

      Take the above Flipable element. It has on both of its sides a Rectangle with 'clip: true' set and inside that a visible element which doesn't exceed its parents boundaries (in other words, there is no clipping required). If you rotate the above flipable beyond 45 or -45 degrees artifacts will begin to appear at the same size and shape of the clipping rectangle at the particular angle. This shape will then remain on top of everything else, leaving a small hole in the middle where the rendering shows through. You will notice the same behaviour at around 135 and 225 degrees (45 and -45 degress for the other side).

      If you increase the size of the content so that the clipping rectangle has something to clip then the artifacts go away.

      You can remove the outer rectangles from from each side and you will still get the same issue – they are just there to provide some colour so you can see the artifacts more clearly. You can remove the behaviour on rotation and the issue still shows, and you can also remove one of the sides and the artifacts will still appear (though of course will only be triggered by the side with content).

      Jari Airaksinen's video shows the situation pretty well too – this is the exact issue I'm having.

      This was working fine in the Qt SDK 1.1 Tech Preview (Qt 4.7.0?) but has shown up in the Beta release (Qt 4.7.2 final). I haven't had a chance to test it on Symbian^1.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            firedomain Qt Graphics Team (Inactive)
            nikrolls Nik Rolls
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes