summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ue2/imgsynth2/cpixmap.cpp')
-rw-r--r--ue2/imgsynth2/cpixmap.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/ue2/imgsynth2/cpixmap.cpp b/ue2/imgsynth2/cpixmap.cpp
index d3e10d8..9e03d86 100644
--- a/ue2/imgsynth2/cpixmap.cpp
+++ b/ue2/imgsynth2/cpixmap.cpp
@@ -272,12 +272,11 @@ void CPixmap::write(std::ofstream& out)
272 } 272 }
273 273
274 /* pixel data */ 274 /* pixel data */
275 //TODO: better via copy?
276 for (uint32_t y = 0; y < getHeight(); y++) 275 for (uint32_t y = 0; y < getHeight(); y++)
277 { 276 {
278 out << "\""; 277 out << "\"";
279 for (uint32_t x = 0; x < getWidth(); x++) 278 uint32_t offset = y * getWidth();
280 out << m_pixeldata[y * getWidth() + x]; 279 copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator<uint8_t>(out));
281 out << "\"," << endl; 280 out << "\"," << endl;
282 } 281 }
283 282
@@ -297,8 +296,8 @@ void CPixmap::dump(std::ostream& out)
297 cout << "[XPM Pixel Data]" << endl; 296 cout << "[XPM Pixel Data]" << endl;
298 for (uint32_t y = 0; y < getHeight(); y++) 297 for (uint32_t y = 0; y < getHeight(); y++)
299 { 298 {
300 for (uint32_t x = 0; x < getWidth(); x++) 299 uint32_t offset = y * getWidth();
301 out << m_pixeldata[y * getWidth() + x]; 300 copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator<uint8_t>(cout));
302 out << endl; 301 out << endl;
303 } 302 }
304 out << endl; 303 out << endl;