Fix alpha point and offset in image copyPixels (fix openfl/openfl#1707)

This commit is contained in:
Joshua Granick
2017-09-12 13:21:41 -07:00
parent 3f011e5a6e
commit e56394ccd3
2 changed files with 4 additions and 6 deletions

View File

@@ -287,7 +287,6 @@ class ImageDataUtil {
var alphaView = new ImageDataView (alphaImage, new Rectangle (alphaPoint.x, alphaPoint.y, destView.width, destView.height)); var alphaView = new ImageDataView (alphaImage, new Rectangle (alphaPoint.x, alphaPoint.y, destView.width, destView.height));
var alphaPosition, alphaPixel:RGBA; var alphaPosition, alphaPixel:RGBA;
var alphaOffsetY = alphaView.y - destView.y;
if (blend) { if (blend) {
@@ -295,7 +294,7 @@ class ImageDataUtil {
sourcePosition = sourceView.row (y); sourcePosition = sourceView.row (y);
destPosition = destView.row (y); destPosition = destView.row (y);
alphaPosition = alphaView.row (y + alphaOffsetY); alphaPosition = alphaView.row (y);
for (x in 0...destView.width) { for (x in 0...destView.width) {
@@ -334,7 +333,7 @@ class ImageDataUtil {
sourcePosition = sourceView.row (y); sourcePosition = sourceView.row (y);
destPosition = destView.row (y); destPosition = destView.row (y);
alphaPosition = alphaView.row (y + alphaOffsetY); alphaPosition = alphaView.row (y);
for (x in 0...destView.width) { for (x in 0...destView.width) {

View File

@@ -215,7 +215,6 @@ namespace lime {
ImageDataView alphaView = ImageDataView (alphaImage, &alphaRect); ImageDataView alphaView = ImageDataView (alphaImage, &alphaRect);
int alphaPosition; int alphaPosition;
RGBA alphaPixel; RGBA alphaPixel;
int alphaOffsetY = alphaView.y - destView.y;
if (blend) { if (blend) {
@@ -223,7 +222,7 @@ namespace lime {
sourcePosition = sourceView.Row (y); sourcePosition = sourceView.Row (y);
destPosition = destView.Row (y); destPosition = destView.Row (y);
alphaPosition = alphaView.Row (y + alphaOffsetY); alphaPosition = alphaView.Row (y);
for (int x = 0; x < destView.width; x++) { for (int x = 0; x < destView.width; x++) {
@@ -262,7 +261,7 @@ namespace lime {
sourcePosition = sourceView.Row (y); sourcePosition = sourceView.Row (y);
destPosition = destView.Row (y); destPosition = destView.Row (y);
alphaPosition = alphaView.Row (y + alphaOffsetY); alphaPosition = alphaView.Row (y);
for (int x = 0; x < destView.width; x++) { for (int x = 0; x < destView.width; x++) {