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

Rendering issue if canvas is transformed using renderingStrategy.Threaded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.2.1
    • 5.0.2
    • None
    • Archlinux x86_64 Qt 5.0.2
      Ubuntu 12.04.2 x86_64 Qt 5.0.2
    • 9ad9615d0003c9fb84255152f0cbb473ee2a7a70

    Description

      Hi,

      I have trouble drawing inside a Canvas if the renderStrategy is Canvas.Cooperative or Canvas.Threaded after/during a fast resize of the window. If the renderStrategy is Canvas.Immediate everything works as expected.

      In the attached image QtPieSlice.png only pieslice1(blue) is correctly rendered, pieslice2(yellow) is not centred and sometimes parts of the rendering are missing. The computer which produces QtPieSlice.png has a Nvidia GPU.

      On a different computer with an AMD GPU the output is completely broken see QtPieSplice2.png .

      PieSlice.qml
      import QtQuick 2.0
      
      Canvas {
       antialiasing: true
      
       property string color: "green"
      
       property real angleSpan: Math.PI/6.0
      
       onAngleSpanChanged: requestPaint()
      
       onPaint: {
        var w = width
        var h = height
        var a = angleSpan
        var ctx = getContext('2d');
        ctx.save();
        ctx.clearRect(0, 0, w, h);
        ctx.translate(w/2.0, h/2.0);
        ctx.fillStyle = color;
        ctx.beginPath();
        ctx.moveTo(0, 0);
        ctx.arc(0, 0, Math.min(w, h)/2.0, - Math.PI/2.0 - a/2.0, - Math.PI/2.0 + a/2.0, false);
        ctx.closePath();
        ctx.fill();
        ctx.restore();
       }
      }
      
      main.qml
      import QtQuick 2.0
      
      Item {
       width:600
       height:600
      
       PieSlice {
        id: pieslice1
        anchors.fill: parent
        renderStrategy: Canvas.Immediate
        color: "blue"
        opacity: 0.5
      
        NumberAnimation on rotation {
         running: true
         loops: Animation.Infinite
         from: 0
         to: 360
         duration: 10000
        }
       }
      
       PieSlice {
        id: pieslice2
        anchors.fill: parent
        color: "yellow"
        opacity: 0.5
      
        NumberAnimation on rotation {
         running: true
         loops: Animation.Infinite
         from: 0
         to: 360
         duration: 7000
        }
       }
      }
      

      Regards,
      Bernd

      Attachments

        1. QtPieSlice.png
          QtPieSlice.png
          12 kB
        2. QtPieSplice2.png
          QtPieSplice2.png
          297 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            amend Bernd Amend
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes