]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagxpm.cpp
fix XPM SaveFile for more than 92 colors
[wxWidgets.git] / src / common / imagxpm.cpp
index 3db566fcb741be9ef7a95f4ace6c5269a3e3d359..5bf4ec4af3beaee56f838564fe14cdfd28e6bba8 100644 (file)
@@ -181,12 +181,10 @@ bool wxXPMHandler::SaveFile(wxImage * image,
         symbols[index] = symbols_data + index * (chars_per_pixel+1);
         char *sym = symbols[index];
 
-        k = index % MaxCixels;
-        sym[0] = Cixel[k];
-        for (j = 1; j < chars_per_pixel; j++)
+        for (j = 0; j < chars_per_pixel; j++)
         {
-            k = ((index - k) / MaxCixels) % MaxCixels;
-            sym[j] = Cixel[k];
+            sym[j] = Cixel[index % MaxCixels];
+            index /= MaxCixels;
         }
         sym[j] = '\0';