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

QPainterPath::toFillPolygon() incorrect for Release build

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.13.2
    • Fix Version/s: None
    • Component/s: GUI: Painting
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      The following code produces wrong QPolygonF results in Release builds with Visual Studio 2019 Windows 10 64bit.

      Debug builds seem to work fine.

      Tests with MacOS seem also to be fine for both builds – Release and Debug.

       

      === SNIP ===

      #include <QPainterPath>
      #include <iostream>

      int main(int argc, char** argv)
      {
      QPainterPath p = QPainterPath();
      QRectF r(-10, -10, 20, 20);
      p.addEllipse(r);

      QPolygonF poly_fail = p.toFillPolygon();

      std::cout << std::fixed;
      for (auto p : poly_fail)

      { std::cout << p.x() << " " << p.y() << std::endl; }

      std::cout << "poly_fail size: " << poly_fail.size() << std::endl;

      return 0;
      }

      === SNIP ===

              • Output in Debug (correct) **

      10.000000 0.000000
      9.214150 3.892451
      7.071068 7.071068
      3.892451 9.214150
      0.000000 10.000000
      -3.892451 9.214150
      -7.071068 7.071068
      -9.214150 3.892451
      -10.000000 0.000000
      -9.214150 -3.892451
      -7.071068 -7.071068
      -3.892451 -9.214150
      0.000000 -10.000000
      3.892451 -9.214150
      7.071068 -7.071068
      9.214150 -3.892451
      10.000000 0.000000
      poly_fail size: 17

       

       

              • Output in Release (wrong) **

      10.000000 0.000000
      0.000000 0.000000
      0.000000 0.000000
      0.000000 10.000000
      0.000000 0.000000
      0.000000 0.000000
      -10.000000 0.000000
      0.000000 0.000000
      0.000000 0.000000
      0.000000 -10.000000
      0.000000 0.000000
      0.000000 0.000000
      10.000000 0.000000
      poly_fail size: 13

       

       

      ==== CMakeLists.txt ====

      cmake_minimum_required(VERSION 3.1.0)

      project(fillpoly)

      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      FIND_PACKAGE(Qt5Core)
      FIND_PACKAGE(Qt5Gui)

      add_executable(fillpoly main.cpp)

      target_link_libraries(fillpoly Qt5::Gui)

        Attachments

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

          Activity

            People

            Assignee:
            vgt Eirik Aavitsland
            Reporter:
            thorroed thorroed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes