Mercurial > hg > orthanc
diff OrthancFramework/Sources/Images/ImageProcessing.cpp @ 4278:9279de56a405
avoid multiple calls to GetWidth() and GetHeight() on pixel loops
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 03 Nov 2020 20:05:55 +0100 |
parents | 2d5209153b32 |
children | 785a2713323e |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Tue Nov 03 18:45:32 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Tue Nov 03 20:05:55 2020 +0100 @@ -501,11 +501,11 @@ throw OrthancException(ErrorCode_IncompatibleImageFormat); } - unsigned int lineSize = source.GetBytesPerPixel() * source.GetWidth(); - + const unsigned int lineSize = source.GetBytesPerPixel() * source.GetWidth(); assert(source.GetPitch() >= lineSize && target.GetPitch() >= lineSize); - for (unsigned int y = 0; y < source.GetHeight(); y++) + const unsigned int height = source.GetHeight(); + for (unsigned int y = 0; y < height; y++) { memcpy(target.GetRow(y), source.GetConstRow(y), lineSize); }