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