Fix ImageDataUtil.copyPixels crash on Hashlink (#1875)

* Fix copyPixels crash on Hashlink

* Move nullcheck to C++

* Simplify further

* Avoid unneccessary object allocation

* Formatting

* Simplify by using an if statement
This commit is contained in:
ACrazyTown
2024-12-16 16:41:37 +01:00
committed by GitHub
parent 9c4fa35361
commit 45505f433a

View File

@@ -2052,7 +2052,17 @@ namespace lime {
} else {
ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha);
if (!alphaPoint) {
Vector2 _alphaPoint = Vector2 (0, 0);
ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, &_alphaPoint, mergeAlpha);
} else {
ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha);
}
}