Fix copyPixels optimization

This commit is contained in:
Joshua Granick
2017-05-17 18:23:01 -07:00
parent 76807b2f01
commit c0f8cdb897
2 changed files with 9 additions and 9 deletions

View File

@@ -124,19 +124,19 @@ namespace lime {
bool sourcePremultiplied = sourceImage->buffer->premultiplied;
bool destPremultiplied = image->buffer->premultiplied;
int sourceBitsPerPixel = sourceImage->buffer->bitsPerPixel;
int destBitsPerPixel = image->buffer->bitsPerPixel;
int sourceBytesPerPixel = sourceImage->buffer->bitsPerPixel / 8;
int destBytesPerPixel = image->buffer->bitsPerPixel / 8;
if (!mergeAlpha || !sourceImage->buffer->transparent) {
if (sourceFormat == destFormat && sourcePremultiplied == destPremultiplied && sourceBitsPerPixel == destBitsPerPixel) {
if (sourceFormat == destFormat && sourcePremultiplied == destPremultiplied && sourceBytesPerPixel == destBytesPerPixel) {
for (int y = 0; y < destView.height; y++) {
sourcePosition = sourceView.Row (y);
destPosition = destView.Row (y);
memcpy (&destData[destPosition], &sourceData[sourcePosition], destView.width * destBitsPerPixel);
memcpy (&destData[destPosition], &sourceData[sourcePosition], destView.width * destBytesPerPixel);
}