From bfa2b2896bfe0d9ee15f5f1691a3fa73da459e3c Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 23 Feb 2017 19:32:18 +0100 Subject: [PATCH] Use wxDecToHex() to convert integer value to hex string --- src/generic/dcpsg.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index c0e1536c1d..0681f93ffb 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -963,9 +963,6 @@ void wxPostScriptDCImpl::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) DoDrawBitmap( icon, x, y, true ); } -/* this has to be char, not wxChar */ -static const char hexArray[] = "0123456789ABCDEF"; - void wxPostScriptDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask) ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); @@ -1006,7 +1003,6 @@ void wxPostScriptDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor // size of the buffer = width*rgb(3)*hexa(2)+'\n' wxCharBuffer charbuffer(w*6 + 1); - int firstDigit, secondDigit; //rows for (int j = 0; j < h; j++) @@ -1016,10 +1012,10 @@ void wxPostScriptDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor //cols for (int i = 0; i < w*3; i++) { - firstDigit = (int)(*data/16.0); - secondDigit = (int)(*data - (firstDigit*16.0)); - *(bufferindex++) = hexArray[firstDigit]; - *(bufferindex++) = hexArray[secondDigit]; + char c1, c2; + wxDecToHex(*data, &c1, &c2); + *(bufferindex++) = c1; + *(bufferindex++) = c2; data++; }