Speeded up image saving to XML (WriteHex).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2011-03-24 10:59:47 +00:00
parent 879e4f6e19
commit 4dc7ae1ae8

View File

@@ -10417,8 +10417,13 @@ bool wxRichTextImageBlock::Load(wxImage& image)
// Write data in hex to a stream
bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream)
{
const int bufSize = 512;
char buf[bufSize+1];
if (m_dataSize == 0)
return true;
int bufSize = 100000;
if (int(m_dataSize+1) < bufSize)
bufSize = m_dataSize+1;
char* buf = new char[bufSize+1];
int left = m_dataSize;
int n, i, j;
@@ -10444,6 +10449,7 @@ bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream)
buf[n] = 0;
stream.Write((const char*) buf, n);
}
delete[] buf;
return true;
}