comparison Framework/ImageToolbox.cpp @ 210:cab272485c38

minor optimization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Nov 2020 17:45:36 +0100
parents 628201cb48c2
children 7459819f3176
comparison
equal deleted inserted replaced
209:628201cb48c2 210:cab272485c38
189 if (compression == ImageCompression_None) 189 if (compression == ImageCompression_None)
190 { 190 {
191 unsigned int pitch = GetBytesPerPixel(source.GetFormat()) * source.GetWidth(); 191 unsigned int pitch = GetBytesPerPixel(source.GetFormat()) * source.GetWidth();
192 target.resize(pitch * source.GetHeight()); 192 target.resize(pitch * source.GetHeight());
193 193
194 for (unsigned int i = 0; i < source.GetHeight(); i++) 194 const unsigned int height = source.GetHeight();
195 for (unsigned int i = 0; i < height; i++)
195 { 196 {
196 memcpy(&target[i * pitch], source.GetConstRow(i), pitch); 197 memcpy(&target[i * pitch], source.GetConstRow(i), pitch);
197 } 198 }
198 } 199 }
199 else 200 else