From bca08c6de2b156cbec90944c809e5e7faecd231d Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 1 May 2009 20:33:33 +0200 Subject: cwindowsbitmap: seek to bitmap data cpixmap: use copy() instead of accessing array via indices --- ue2/imgsynth2/cpixmap.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ue2/imgsynth2/cpixmap.cpp') 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) } /* pixel data */ - //TODO: better via copy? for (uint32_t y = 0; y < getHeight(); y++) { out << "\""; - for (uint32_t x = 0; x < getWidth(); x++) - out << m_pixeldata[y * getWidth() + x]; + uint32_t offset = y * getWidth(); + copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator(out)); out << "\"," << endl; } @@ -297,8 +296,8 @@ void CPixmap::dump(std::ostream& out) cout << "[XPM Pixel Data]" << endl; for (uint32_t y = 0; y < getHeight(); y++) { - for (uint32_t x = 0; x < getWidth(); x++) - out << m_pixeldata[y * getWidth() + x]; + uint32_t offset = y * getWidth(); + copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator(cout)); out << endl; } out << endl; -- cgit v1.2.3