Change nested loop and directly change pixels

This commit is contained in:
Dávid Szabó 2016-08-25 20:20:10 +02:00 committed by Julian Descottes
parent f829d589d5
commit 7707aca03e

View file

@ -121,11 +121,11 @@
mergeFrames_ : function (frameA, frameB) {
var transparentColorInt = pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR);
frameB.forEachPixel(function (color, col, row) {
if (color != transparentColorInt) {
frameA.setPixel(col, row, color);
for (var i = 0, length = frameA.getWidth() * frameA.getHeight(); i < length; ++i) {
if (frameB.pixels[i] != transparentColorInt && frameA.pixels[i] != frameB.pixels[i]) {
frameA.pixels[i] = frameB.pixels[i];
}
});
}
},
resize : function (frame, targetWidth, targetHeight, smoothing) {