From 1a5f13bcf5d15a270f8e91b7206f1d1e84be1d3c Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 3 Jul 2007 03:08:26 +0000 Subject: [PATCH] fix XPM SaveFile for more than 92 colors git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/imagxpm.cpp | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d0546db447..06d3ea135e 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -105,6 +105,7 @@ All (GUI): - Added wxAuiNotebook::SetFont, GetTabCtrlHeight, GetHeightForPageHeight. - Added SetBitmap/GetBitmap to wxWizard, to allow e.g. on-the-fly creation of bitmap to fit page height. +- 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';