From df0f77b91c7a24c5d40aac999853994a0875e44a Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Tue, 20 Nov 2018 08:57:32 -0800 Subject: [PATCH] Skip pixel translation in blur if no offset or strength change --- src/lime/_internal/graphics/ImageDataUtil.hx | 42 ++++++++++---------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/lime/_internal/graphics/ImageDataUtil.hx b/src/lime/_internal/graphics/ImageDataUtil.hx index 1b6e3e005..e03b4bafd 100644 --- a/src/lime/_internal/graphics/ImageDataUtil.hx +++ b/src/lime/_internal/graphics/ImageDataUtil.hx @@ -781,30 +781,32 @@ class ImageDataUtil { bIndex += 2; } - var x: Int; - var y: Int; - if (offset <= 0) { - y = 0; - while (y < h) { - x = 0; - while (x < w) { - translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); - x += 1; + var x:Int; + var y:Int; + if (offset != 0 || strength != 1) { + if (offset <= 0) { + y = 0; + while (y < h) { + x = 0; + while (x < w) { + translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); + x += 1; + } + y += 1; } - y += 1; - } - } else { - y = h-1; - while (y >= 0 ) { - x = w-1; - while (x >= 0) { - translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); - x -= 1; + } else { + y = h-1; + while (y >= 0 ) { + x = w-1; + while (x >= 0) { + translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); + x -= 1; + } + y -= 1; } - y -= 1; } } - + image.dirty = true; image.version++; sourceImage.dirty = true;