diff --git a/docs/changes.txt b/docs/changes.txt index 5f4de91df5..e3cbd0ff82 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -181,6 +181,7 @@ All (GUI): - Fixed freeing of "static" alpha data in wxImage (Axel Gembe) - Don't invalidate the font in SetNativeFontInfo[Desc]() if the string is invalid, to conform to the documented behaviour (Langhammer) +- Fixed wxXPMHandler::SaveFile for images with more than 92 colors. wxMSW: diff --git a/src/common/imagxpm.cpp b/src/common/imagxpm.cpp index 3db566fcb7..5bf4ec4af3 100644 --- a/src/common/imagxpm.cpp +++ b/src/common/imagxpm.cpp @@ -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';