diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-01 20:33:33 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-01 20:33:33 +0200 |
| commit | bca08c6de2b156cbec90944c809e5e7faecd231d (patch) | |
| tree | d544ced2a8eb082cf1f393eb524519884909ed6d /ue2/imgsynth2/cpixmap.cpp | |
| parent | b9ce1555b2baf9be209775dbd4c8b217db5cd735 (diff) | |
| download | ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.tar.gz ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.tar.bz2 ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.zip | |
cwindowsbitmap: seek to bitmap data
cpixmap: use copy() instead of accessing array via indices
Diffstat (limited to 'ue2/imgsynth2/cpixmap.cpp')
| -rw-r--r-- | ue2/imgsynth2/cpixmap.cpp | 9 |
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; |
