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

Stroked line rendering artifact in examples/widgets/groupbox (qtriangulatingstroker?)



    • Commits:


      When running the groupbox example, the upper right box contains some checkboxes but the grey background has a diagonal white line (dashed) going from the upper right corner of the group to the lower left corner. The rendering artifact occurs only with the GL (ES2) paint engine. It does not occurs if the setFlat(true) is changed to false.

      In the end it looks like some NaNs values are sent to GL in the DrawArrays call. These appear to originate from arithmetic using the normal vector members "m_nvx", "m_nvy" in qtriangulatingstroker that are NaNs for some reason.

      1193 setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices());
      (gdb) p stroker
      $115 = {m_vertices =

      {capacity = 64, siz = 26, buffer = 0x1459d8}

      , m_cx = 457, m_cy = 8, m_nvx = nan(0x400000), m_nvy = nan(0x400000), m_width = 0.5, m_miter_limit = 0, m_roundness = 1, m_sin_theta = -8.74227766e-08, m_cos_theta = -1,
      m_inv_scale = 1, m_curvyness_mul = 0.392699093, m_curvyness_add = 0.5, m_join_style = Qt::BevelJoin, m_cap_style = Qt::SquareCap}
      (gdb) call stroker.vertices()
      $116 = (const float *) 0x1459d8
      (gdb) x/26f 0x1459d8
      0x1459d8: -0.5 8.5 -0.5 7.5
      0x1459e8: 0 8.5 0 7.5
      0x1459f8: 457 8.5 457 7.5
      0x145a08: nan(0x400000) nan(0x400000) -nan(0x400000) -nan(0x400000)
      0x145a18: nan(0x400000) nan(0x400000) -nan(0x400000) -nan(0x400000)
      0x145a28: nan(0x400000) -nan(0x400000) nan(0x400000) -nan(0x400000)
      0x145a38: nan(0x400000) -nan(0x400000)
      (gdb) bt
      #0 QGL2PaintEngineExPrivate::stroke (this=0x728e8, path=..., pen=...) at gl2paintengineex/qpaintengineex_opengl2.cpp:1193
      #1 0x422b8398 in QGL2PaintEngineEx::stroke (this=0x145528, path=..., pen=...) at gl2paintengineex/qpaintengineex_opengl2.cpp:1147
      #2 0x403d4314 in QPaintEngineEx::drawPolygon (this=0x145528, points=0x168c08, pointCount=3, mode=QPaintEngine::PolylineMode) at painting/qpaintengineex.cpp:942
      #3 0x403ef590 in QPainter::drawPolyline (this=0x8ef36f9c, points=0x168c08, pointCount=3) at painting/qpainter.cpp:4837
      #4 0x40301220 in QPainter::drawPolyline (this=0x8ef36f9c, polyline=...) at ../../include/QtGui/../../src/gui/painting/qpainter.h:617
      #5 0x403b243c in qDrawShadeLine (p=0x8ef36f9c, x1=0, y1=8, x2=457, y2=8, pal=..., sunken=true, lineWidth=1, midLineWidth=0) at painting/qdrawutil.cpp:138
      #6 0x403b2834 in qDrawShadeLine (p=0x8ef36f9c, p1=..., p2=..., pal=..., sunken=true, lineWidth=1, midLineWidth=0) at painting/qdrawutil.cpp:579
      #7 0x406d1c68 in QCommonStyle::drawPrimitive (this=0x533a0, pe=QStyle::PE_FrameGroupBox, opt=0x8ef364e0, p=0x8ef36f9c, widget=0x4f088) at styles/qcommonstyle.cpp:539
      #8 0x407a53f8 in QWindowsStyle::drawPrimitive (this=0x533a0, pe=QStyle::PE_FrameGroupBox, opt=0x8ef364e0, p=0x8ef36f9c, w=0x4f088) at styles/qwindowsstyle.cpp:1787
      #9 0x406ba114 in QCommonStyle::drawComplexControl (this=0x533a0, cc=QStyle::CC_GroupBox, opt=0x8ef36f44, p=0x8ef36f9c, widget=0x4f088) at styles/qcommonstyle.cpp:3685
      #10 0x40799134 in QWindowsStyle::drawComplexControl (this=0x533a0, cc=QStyle::CC_GroupBox, opt=0x8ef36f44, p=0x8ef36f9c, widget=0x4f088) at styles/qwindowsstyle.cpp:3154
      #11 0x407cdb88 in QStylePainter::drawComplexControl (this=0x8ef36f9c, cc=QStyle::CC_GroupBox, opt=...) at ../../include/QtGui/../../src/gui/painting/qstylepainter.h:94
      #12 0x4083c29c in QGroupBox::paintEvent (this=0x4f088) at widgets/qgroupbox.cpp:327
      #13 0x40218c98 in QWidget::event (this=0x4f088, event=0x8ef378c0) at kernel/qwidget.cpp:8230
      #14 0x4083c1ec in QGroupBox::event (this=0x4f088, e=0x8ef378c0) at widgets/qgroupbox.cpp:397
      #15 0x40174a78 in QApplicationPrivate::notify_helper (this=0x169d8, receiver=0x4f088, e=0x8ef378c0) at kernel/qapplication.cpp:4336
      #16 0x40178204 in QApplication::notify (this=0x8ef386d0, receiver=0x4f088, e=0x8ef378c0) at kernel/qapplication.cpp:4301
      #17 0x41085b64 in QCoreApplication::notifyInternal (this=0x8ef386d0, receiver=0x4f088, event=0x8ef378c0) at kernel/qcoreapplication.cpp:704
      #18 0x40191aec in QCoreApplication::sendSpontaneousEvent (receiver=0x4f088, event=0x8ef378c0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
      #19 0x40214cf8 in QWidgetPrivate::drawWidget (this=0x54568, pdev=0x55a2c, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x55b00) at kernel/qwidget.cpp:5313
      #20 0x402157f8 in QWidgetPrivate::paintSiblingsRecursive (this=0x54338, pdev=0x55a2c, siblings=..., index=0, rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x55b00) at kernel/qwidget.cpp:5520
      #21 0x402152b0 in QWidgetPrivate::drawWidget (this=0x54338, pdev=0x55a2c, rgn=..., offset=..., flags=5, sharedPainter=0x0, backingStore=0x55b00) at kernel/qwidget.cpp:5366
      #22 0x40525520 in QWidgetBackingStore::sync (this=0x55b00) at painting/qbackingstore.cpp:1300
      #23 0x40525820 in QWidgetBackingStore::sync (this=0x55b00, exposedWidget=0x8ef386bc, exposedRegion=...) at painting/qbackingstore.cpp:1105
      #24 0x4020b990 in QWidgetPrivate::syncBackingStore (this=0x54338, region=...) at kernel/qwidget.cpp:1718
      #25 0x40268108 in QETWidget::translatePaintEvent (this=0x8ef386bc, event=0x8ef38450) at kernel/qapplication_x11.cpp:5118
      #26 0x4026abf4 in QApplication::x11ProcessEvent (this=0x8ef386d0, event=0x8ef38450) at kernel/qapplication_x11.cpp:3437
      #27 0x402ad8fc in x11EventSourceDispatch (s=0x1a128, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
      #28 0x414e5c48 in g_main_dispatch (context=0x2) at gmain.c:2012
      #29 IA__g_main_context_dispatch (context=0x2) at gmain.c:2564
      #30 0x414e8d7c in g_main_context_iterate (context=0x19f80, block=1, dispatch=1092618196, self=<value optimized out>) at gmain.c:2645
      #31 0x414e8f00 in IA__g_main_context_iteration (context=0x19f80, may_block=1) at gmain.c:2708
      #32 0x410d8ae8 in QEventDispatcherGlib::processEvents (this=0x18580, flags=...) at kernel/qeventdispatcher_glib.cpp:412
      #33 0x402acca4 in QGuiEventDispatcherGlib::processEvents (this=0x18580, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
      #34 0x410809c8 in QEventLoop::processEvents (this=0x8ef38674, flags=...) at kernel/qeventloop.cpp:149
      #35 0x41080cb8 in QEventLoop::exec (this=0x8ef38674, flags=...) at kernel/qeventloop.cpp:201
      #36 0x41086888 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
      #37 0x40178240 in QApplication::exec () at kernel/qapplication.cpp:3615
      #38 0x0000bbb8 in main (argc=1, argv=0x8ef38834) at main.cpp:51

      Here is the actual draw call of 13 (vertexCount() / 2) triangle strip elements from that array:

      QGL2PaintEngineExPrivate::stroke (this=0x728e8, path=..., pen=...) at gl2paintengineex/qpaintengineex_opengl2.cpp:1194
      1194 glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);

      When telling GL to only draw the strips with the first 6 vertices (that are real float numbers) then the stroke on the line appears to be correct.


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



            kjernase Trond Kjernåsen (Inactive)
            ndhb Nicolai de Haan
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes