only check for interrupts for every row.
authorClaus Gittinger <cg@exept.de>
Wed, 20 Aug 1997 16:50:58 +0200
changeset 1875 2f42b8db6d99
parent 1874 a46a8c065050
child 1876 6b5a5931a2b9
only check for interrupts for every row.
Image.st
--- a/Image.st	Tue Aug 19 18:15:12 1997 +0200
+++ b/Image.st	Wed Aug 20 16:50:58 1997 +0200
@@ -6854,7 +6854,6 @@
     unsigned char *srcP, *dstP;
     unsigned char *rgbP;
     unsigned char *idP;
-    unsigned char *dp;
     short *errP, *eP;
     int __fR, __fG, __fB;
     int idx;
@@ -6863,7 +6862,6 @@
     int __nColors = __intVal(lastColor);
     int __wR = -1, __wG, __wB;
     OBJ *__cube;
-    OBJ subCubeColors;
     int cubeIndex, cubeIndex2;
 
     if (__isByteArray(__INST(bytes))
@@ -6901,6 +6899,7 @@
                 int __iR, __iG, __iB;
                 int cR, cG, cB;   
                 int delta;
+                OBJ subCubeColors;
 
                 pix = *srcP++;
 
@@ -7040,20 +7039,6 @@
                         }
                         delta = delta + 1;
 
-                        if (InterruptPending) {
-                            int d_srcP = srcP - __ByteArrayInstPtr(_INST(bytes))->ba_element;
-                            int d_dstP = dstP - __ByteArrayInstPtr(pseudoBits)->ba_element;
-                            int d_errP = errP - (short *) __ByteArrayInstPtr(error)->ba_element;
-
-                            __interrupt__();
-
-                            srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element + d_srcP;
-                            dstP = __ByteArrayInstPtr(pseudoBits)->ba_element + d_dstP;
-                            rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
-                            idP = __ByteArrayInstPtr(ditherIds)->ba_element;
-                            errP = (short *) __ByteArrayInstPtr(error)->ba_element + d_errP;
-                            __cube = __ArrayInstPtr(cube)->a_element;
-                        }
                     }
                     /* cannot happen - will lead to a segmentation violation ... */
                     subCubeColors = nil;
@@ -7090,14 +7075,18 @@
                  */
 
 #ifndef NO_FLOYD_STEINBERG
-                /*
-                 * fetch that colors r/g/b components
-                 */
-                dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-                dp += bestIdx * 3;
-                __dR = dp[0];
-                __dG = dp[1];
-                __dB = dp[2];
+                {
+                    unsigned char *dp;
+
+                    /*
+                     * fetch that colors r/g/b components
+                     */
+                    dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
+                    dp += bestIdx * 3;
+                    __dR = dp[0];
+                    __dG = dp[1];
+                    __dB = dp[2];
+                }
 #endif
 
 /*
@@ -7157,6 +7146,25 @@
                 eP += 3;
 #endif
             }
+
+            /*
+             * allow for an interrupt after every row.
+             * but care to refetch C variables
+             */
+            if (InterruptPending) {
+                int d_srcP = srcP - __ByteArrayInstPtr(_INST(bytes))->ba_element;
+                int d_dstP = dstP - __ByteArrayInstPtr(pseudoBits)->ba_element;
+                int d_errP = errP - (short *) __ByteArrayInstPtr(error)->ba_element;
+
+                __interrupt__();
+
+                srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element + d_srcP;
+                dstP = __ByteArrayInstPtr(pseudoBits)->ba_element + d_dstP;
+                rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
+                idP = __ByteArrayInstPtr(ditherIds)->ba_element;
+                errP = (short *) __ByteArrayInstPtr(error)->ba_element + d_errP;
+                __cube = __ArrayInstPtr(cube)->a_element;
+            }
         }
     }
 %}.
@@ -10977,6 +10985,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.219 1997-08-05 14:33:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.220 1997-08-20 14:50:58 cg Exp $'
 ! !
 Image initialize!