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

Wrong size calculation in QSGBasicInternalImageNode::updateGeometry()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.12.0
    • Quick: SceneGraph
    • None
    • All

    Description

      The bug reports comes from a discussion in the forum: https://forum.qt.io/topic/97439/

      It looks like the calculation of the needed size for xData and yData is wrong which leads to an assertion ( Q_ASSERT(xs == xData.data() + xData.size()); and Q_ASSERT(ys == yData.data() + yData.size()).

      valgrind does not show anything problematic since the length is smaller than 32 elements so the memory is correctly allocated.

      From my pov there is a ++h/vCells missing when innerTargetRect.width()/.height() is != 0 (see attached patch, can provide it as gerrit patch if my assumption proves correct).

       

      if (innerTargetRect.width() != 0) {
          xs[0].x = innerTargetRect.left();
          xs[0].tx = innerSourceRect.x() + (subSourceRect.left() - floorLeft) * innerSourceRect.width();
          ++xs;             <--------- this and ...
          float b = innerTargetRect.width() / subSourceRect.width();
          float a = innerTargetRect.x() - subSourceRect.x() * b;
          for (int i = floorLeft + 1; i <= ceilRight - 1; ++i) {
              xs[0].x = xs[1].x = a + b * i;
              xs[0].tx = innerSourceRect.right();
              xs[1].tx = innerSourceRect.left();
              xs += 2;
          }
          xs[0].x = innerTargetRect.right();
          xs[0].tx = innerSourceRect.x() + (subSourceRect.right() - ceilRight + 1) * innerSourceRect.width();
          ++xs; <--------- ... this is not counted above
      }
      

      Attachments

        1. demobuttons.zip
          12 kB
        2. qtbug_73472.diff
          0.8 kB
        3. qtbug_73742.tgz
          4 kB

        Issue Links

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

          Activity

            People

              janichol Andy Nichols
              chehrlic Christian Ehrlicher
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes