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

QRasterPaintEngine::drawEllipse() fails with large rects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.5.0
    • GUI: Painting
    • None
    • 16af209f76074553c6f56b3cd0da3610a71410ab

      Drawing a circle with QRasterPaintEngine::drawEllipse() results in
      all kinds of funny lines if the width or height of the rectangle
      exceeds about 30000 (presumably a 16 bit overflow problem somewhere
      down drawEllipse_midpoint_i()/drawEllipsePoints()/...

      The attached patch works around this (an actual fix would probably
      have to be done further inside the code, if at all possible).

      BTW: while looking at drawEllipse_midpoint_i() I saw that a*a and b*b
      are used rather often (even inside the loops). Don't you think it would
      save some CPU cycles if these were calculated once instead of multiple times?

      PATCH:
      — src/gui/painting/qpaintengine_raster.cpp.001 2009-02-25 22:32:35.000000000 +0100
      +++ src/gui/painting/qpaintengine_raster.cpp 2009-04-20 14:29:29.439238971 +0200
      @@ -3511,6 +3511,7 @@
      ensurePen();
      if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)

      (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased))
      + && qMax(rect.width(), rect.height()) < 30000 // drawEllipse_midpoint_i() fails beyond 16 bit
      #ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
      && qMax(rect.width(), rect.height()) < 128 // integer math breakdown
      #endif

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

            wallison Warwick Allison (closed Nokia identity) (Inactive)
            janichol Andy Nichols
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes