X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0bddb3cc6fbe51996d0cab95f8ce46017a8d0311..f0ce3409421a7c5c800a2255295274187220e8de:/src/common/imagpcx.cpp diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 3b806c35f4..348dd9f8f9 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -276,6 +276,18 @@ int ReadPCX(wxImage *image, wxInputStream& stream) *(p++) = pal[3 * index + 1]; *(p++) = pal[3 * index + 2]; } + + unsigned char* r = new unsigned char[256]; + unsigned char* g = new unsigned char[256]; + unsigned char* b = new unsigned char[256]; + for (i = 0; i < 256; i++) + { + r[i] = pal[3*i + 0]; + g[i] = pal[3*i + 1]; + b[i] = pal[3*i + 2]; + } + image->SetPalette(wxPalette(256, r, g, b)); + delete[] r; delete[] g; delete[] b; } return wxPCX_OK; @@ -444,10 +456,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose { switch (error) { - case wxPCX_INVFORMAT: wxLogError(_("wxPCXHandler: image format unsupported")); break; - case wxPCX_MEMERR: wxLogError(_("wxPCXHandler: couldn't allocate memory")); break; - case wxPCX_VERERR: wxLogError(_("wxPCXHandler: version number too low")); break; - default: wxLogError(_("wxPCXHandler: unknown error !!!")); + case wxPCX_INVFORMAT: wxLogError(_("PCX: image format unsupported")); break; + case wxPCX_MEMERR: wxLogError(_("PCX: couldn't allocate memory")); break; + case wxPCX_VERERR: wxLogError(_("PCX: version number too low")); break; + default: wxLogError(_("PCX: unknown error !!!")); } } image->Destroy(); @@ -467,9 +479,9 @@ bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos { switch (error) { - case wxPCX_INVFORMAT: wxLogError(_("wxPCXHandler: invalid image")); break; - case wxPCX_MEMERR: wxLogError(_("wxPCXHandler: couldn't allocate memory")); break; - default: wxLogError(_("wxPCXHandler: unknown error !!!")); + case wxPCX_INVFORMAT: wxLogError(_("PCX: invalid image")); break; + case wxPCX_MEMERR: wxLogError(_("PCX: couldn't allocate memory")); break; + default: wxLogError(_("PCX: unknown error !!!")); } } }