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

Tiled canvas sometimes broken

    XMLWordPrintable

Details

    • Linux/X11, macOS

    Description

      This bug appears different depending on the Qt versions.

      5.1.0:
      At first all tiles are broken. After scrolling all tiles are correct.

      stable-branch:
      At first all tiles are correct. After scrolling the program crashes.

      dev-branch:
      At first all tiles are correct. After scrolling some tiles are broken like the attached image.

      All of them are tested on OS X.

      import QtQuick 2.0
      
      Rectangle {
          width: 400
          height: 400
          Flickable {
              id: flick
              anchors.fill: parent
              contentWidth: 400
              contentHeight: 40000
          }
          Canvas {
              parent: flick
              anchors.fill: parent
              contextType: "2d"
              canvasSize: Qt.size(flick.contentWidth, flick.contentHeight)
              canvasWindow: Qt.rect(flick.contentX, flick.contentY,
                                    flick.width, flick.height)
              tileSize: Qt.size(20, 20)
              renderStrategy: Canvas.Cooperative
              onPaint: {
                  for (var y = region.y; y < region.y + region.height;
                       y += tileSize.height) {
                      for (var x = region.x; x < region.x + region.width;
                           x += tileSize.width) {
                          context.fillStyle = "black";
                          context.fillRect(x, y, tileSize.width, tileSize.height);
                          context.fillStyle = "green";
                          context.fillRect(x + 1, y + 1, tileSize.width - 2,
                                           tileSize.height - 2);
                      }
                  }
              }
              onCanvasWindowChanged: requestPaint()
          }
      }
      

      Attachments

        Activity

          People

            srutledg Shawn Rutledge
            sqq S.Gold
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: