Improved performance when using ImageData methods in multiple threads when ImageData:encode is called

This commit is contained in:
Alex Szpakowski
2013-06-26 03:42:42 -03:00
parent b8efa6372b
commit b04a2fee87
6 changed files with 25 additions and 21 deletions
+6 -5
View File
@@ -149,14 +149,15 @@ void ImageData::paste(ImageData *src, int dx, int dy, int sx, int sy, int sw, in
// If the dimensions match up, copy the entire memory stream in one go
if (sw == getWidth() && getWidth() == src->getWidth()
&& sh == getHeight() && getHeight() == src->getHeight())
memcpy(d, s, sizeof(pixel) * sw * sh);
else if (sw > 0) // Otherwise, copy each row individually
&& sh == getHeight() && getHeight() == src->getHeight())
{
memcpy(d, s, sizeof(pixel) * sw * sh);
}
else if (sw > 0)
{
// Otherwise, copy each row individually.
for (int i = 0; i < sh; i++)
{
memcpy(d + dx + (i + dy) * getWidth(), s + sx + (i + sy) * src->getWidth(), sizeof(pixel) * sw);
}
}
}