diff --git a/src/lime/_internal/graphics/ImageDataUtil.hx b/src/lime/_internal/graphics/ImageDataUtil.hx index e1944e4b1..657368931 100644 --- a/src/lime/_internal/graphics/ImageDataUtil.hx +++ b/src/lime/_internal/graphics/ImageDataUtil.hx @@ -50,19 +50,19 @@ class ImageDataUtil var sourceOffset:Int; - var sourcePixel:RGBA; - var mapPixel:RGBA; - var targetPixel:RGBA; + var sourcePixel:RGBA = new RGBA(); + var mapPixel:RGBA = new RGBA(); + var targetPixel:RGBA = new RGBA(); var mapPixelX:Float; var mapPixelY:Float; var mapPixelA:Float; // for bilinear smoothing - var s1:RGBA; - var s2:RGBA; - var s3:RGBA; - var s4:RGBA; + var s1:RGBA = new RGBA(); + var s2:RGBA = new RGBA(); + var s3:RGBA = new RGBA(); + var s4:RGBA = new RGBA(); var mPointXFloor:Int; var mPointYFloor:Int; @@ -180,7 +180,7 @@ class ImageDataUtil var greenTable = colorMatrix.getGreenTable(); var blueTable = colorMatrix.getBlueTable(); - var row, offset, pixel:RGBA; + var row, offset, pixel:RGBA = new RGBA(); for (y in 0...dataView.height) { @@ -240,8 +240,8 @@ class ImageDataUtil var srcPosition, destPosition, - srcPixel:RGBA, - destPixel:RGBA, + srcPixel:RGBA = new RGBA(), + destPixel:RGBA = new RGBA(), value = 0; for (y in 0...destView.height) @@ -329,7 +329,8 @@ class ImageDataUtil var sourcePosition, destPosition; var sourceAlpha, destAlpha, oneMinusSourceAlpha, blendAlpha; - var sourcePixel:RGBA, destPixel:RGBA; + var sourcePixel:RGBA = new RGBA(); + var destPixel:RGBA = new RGBA(); var sourcePremultiplied = sourceImage.buffer.premultiplied; var destPremultiplied = image.buffer.premultiplied; @@ -423,7 +424,7 @@ class ImageDataUtil { var alphaData = alphaImage.buffer.data; var alphaFormat = alphaImage.buffer.format; - var alphaPosition, alphaPixel:RGBA; + var alphaPosition, alphaPixel:RGBA = new RGBA(); var alphaView = new ImageDataView(alphaImage, new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y), @@ -571,7 +572,7 @@ class ImageDataUtil var fillColor:RGBA = color; - var hitColor:RGBA; + var hitColor:RGBA = new RGBA(); hitColor.readUInt8(data, ((y + image.offsetY) * (image.buffer.width * 4)) + ((x + image.offsetX) * 4), format, premultiplied); if (!image.transparent) @@ -601,7 +602,7 @@ class ImageDataUtil nextPointX, nextPointY, nextPointOffset, - readColor:RGBA; + readColor:RGBA = new RGBA(); while (queue.length > 0) { @@ -809,7 +810,7 @@ class ImageDataUtil public static function getPixel(image:Image, x:Int, y:Int, format:PixelFormat):Int { - var pixel:RGBA; + var pixel:RGBA = new RGBA(); pixel.readUInt8(image.buffer.data, (4 * (y + image.offsetY) * image.buffer.width + (x + image.offsetX) * 4), image.buffer.format, image.buffer.premultiplied); @@ -828,7 +829,7 @@ class ImageDataUtil public static function getPixel32(image:Image, x:Int, y:Int, format:PixelFormat):Int { - var pixel:RGBA; + var pixel:RGBA = new RGBA(); pixel.readUInt8(image.buffer.data, (4 * (y + image.offsetY) * image.buffer.width + (x + image.offsetX) * 4), image.buffer.format, image.buffer.premultiplied); @@ -861,7 +862,10 @@ class ImageDataUtil var premultiplied = image.buffer.premultiplied; var dataView = new ImageDataView(image, rect); - var position, argb:ARGB, bgra:BGRA, pixel:RGBA; + var position; + var argb:ARGB = new RGBA(); + var bgra:BGRA = new RGBA(); + var pixel:RGBA= new RGBA(); var destPosition = 0; for (y in 0...dataView.height) @@ -917,7 +921,9 @@ class ImageDataUtil var sourcePremultiplied = sourceImage.buffer.premultiplied; var destPremultiplied = image.buffer.premultiplied; - var sourcePosition, destPosition, sourcePixel:RGBA, destPixel:RGBA; + var sourcePosition, destPosition; + var sourcePixel:RGBA = new RGBA(); + var destPixel:RGBA = new RGBA(); for (y in 0...destView.height) { @@ -958,7 +964,7 @@ class ImageDataUtil { var format = image.buffer.format; var length = Std.int(data.length / 4); - var pixel:RGBA; + var pixel:RGBA = new RGBA(); for (i in 0...length) { @@ -1341,8 +1347,8 @@ class ImageDataUtil var srcPosition, destPosition, - srcPixel:RGBA, - destPixel:RGBA, + srcPixel:RGBA = new RGBA(), + destPixel:RGBA = new RGBA(), pixelMask:UInt, test:Bool, value:Int; @@ -1408,7 +1414,7 @@ class ImageDataUtil { var format = image.buffer.format; var length = Std.int(data.length / 4); - var pixel:RGBA; + var pixel:RGBA = new RGBA(); for (i in 0...length) {