From ac44102aaf46cbde0a60d5496e7415ec8d796003 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 29 Jul 2019 11:38:05 -0700 Subject: [PATCH] Native image.copyPixels + alphaImage fix --- project/src/graphics/utils/ImageDataUtil.cpp | 2 +- src/lime/_internal/graphics/ImageDataUtil.hx | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/project/src/graphics/utils/ImageDataUtil.cpp b/project/src/graphics/utils/ImageDataUtil.cpp index 2e01c0108..32d7011ed 100644 --- a/project/src/graphics/utils/ImageDataUtil.cpp +++ b/project/src/graphics/utils/ImageDataUtil.cpp @@ -214,7 +214,7 @@ namespace lime { int alphaPosition; RGBA alphaPixel; - Rectangle alphaRect = Rectangle (alphaPoint->x, alphaPoint->y, alphaImage->width, alphaImage->height); + Rectangle alphaRect = Rectangle (sourceView.x + alphaPoint->x, sourceView.y + alphaPoint->y, sourceView.width, sourceView.height); ImageDataView alphaView = ImageDataView (alphaImage, &alphaRect); destView.Clip (destPoint->x, destPoint->y, alphaView.width, alphaView.height); diff --git a/src/lime/_internal/graphics/ImageDataUtil.hx b/src/lime/_internal/graphics/ImageDataUtil.hx index 956d9b7db..9e7a7c6b6 100644 --- a/src/lime/_internal/graphics/ImageDataUtil.hx +++ b/src/lime/_internal/graphics/ImageDataUtil.hx @@ -420,13 +420,11 @@ class ImageDataUtil } else { - if (alphaPoint == null) alphaPoint = new Vector2(); - var alphaData = alphaImage.buffer.data; var alphaFormat = alphaImage.buffer.format; var alphaPosition, alphaPixel:RGBA; - var alphaView = new ImageDataView(alphaImage, new Rectangle(alphaPoint.x, alphaPoint.y, alphaImage.width, alphaImage.height)); + var alphaView = new ImageDataView(alphaImage, new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y), sourceView.width, sourceView.height)); destView.clip(Std.int(destPoint.x), Std.int(destPoint.y), alphaView.width, alphaView.height);