Fix floodFill with alpha on neko/cpp (#762)

This commit is contained in:
Giuseppe Di Mauro
2016-06-17 17:19:56 +02:00
committed by Valentin Lemière
parent 5328df1ba7
commit 6111cf43e7
2 changed files with 6 additions and 2 deletions

View File

@@ -387,6 +387,8 @@ class ImageDataUtil {
if (fillColor == hitColor) return;
if (premultiplied) fillColor.multiplyAlpha();
var dx = [ 0, -1, 1, 0 ];
var dy = [ -1, 0, 0, 1 ];
@@ -422,7 +424,7 @@ class ImageDataUtil {
if (readColor == hitColor) {
fillColor.writeUInt8 (data, nextPointOffset, format, premultiplied);
fillColor.writeUInt8 (data, nextPointOffset, format, false);
queue.push (nextPointX);
queue.push (nextPointY);

View File

@@ -277,6 +277,8 @@ namespace lime {
bool premultiplied = image->buffer->premultiplied;
RGBA fillColor (color);
if (premultiplied) fillColor.MultiplyAlpha ();
RGBA hitColor;
hitColor.ReadUInt8 (data, ((y + image->offsetY) * (image->buffer->width * 4)) + ((x + image->offsetX) * 4), format, premultiplied);
@@ -326,7 +328,7 @@ namespace lime {
if (readColor == hitColor) {
fillColor.WriteUInt8 (data, nextPointOffset, format, premultiplied);
fillColor.WriteUInt8 (data, nextPointOffset, format, false);
queue.push_back (nextPointX);
queue.push_back (nextPointY);