On Thu, Oct 05, 2006 at 09:43:13PM +0200, Andre Poenitz wrote:

> So if that's a bug in the raster painter it's none I've seen before...

I finally found the reason of this nasty bug. The attached patch fixes
it for Qt 4.1.4. After I found it, I checked whether it has been addressed
in 4.2.2, and I saw that it has been solved, even if in a different manner
as they also slightly modified the raster painter sources.

What I don't understand is why this bug led to a crash only on cygwin,
seemingly. However, I know for sure that it led to memory trashing, as in
certain circumstances a pointer was wrongly initialized. Oh, well...

-- 
Enrico
--- src/gui/painting/qpaintengine_raster.cpp.orig       2006-08-18 
05:44:52.000000000 +0200
+++ src/gui/painting/qpaintengine_raster.cpp    2006-12-03 15:07:42.000000000 
+0100
@@ -3234,6 +3234,7 @@ static void drawLine_midpoint_i(int x1, 
     const int NSPANS = 256;
     QT_FT_Span spans[NSPANS];
     int current = 0;
+    bool incr_current = false;
     bool ordered = true;
 
     if (dy == 0) {
@@ -3307,6 +3308,8 @@ static void drawLine_midpoint_i(int x1, 
             spans[index].y = y;
             if (ordered) // only incremented when y changes in the 0-45 case
                 ++current;
+           else
+               incr_current = true;
         }
 
         if (y2 > y1) { // 315 -> 360 and 135 -> 180 (unit circle degrees)
@@ -3358,7 +3361,11 @@ static void drawLine_midpoint_i(int x1, 
 
             while (x < x2) {
                 if (d < 0) {
-                    ++current;
+                   if (incr_current)
+                       ++current;
+                   else
+                       incr_current = true;
+
                     if (current == NSPANS) {
                         span_func(NSPANS, spans, data);
                         current = 0;

Reply via email to