mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Change nested loop and directly change pixels
This commit is contained in:
parent
f829d589d5
commit
7707aca03e
@ -121,11 +121,11 @@
|
|||||||
|
|
||||||
mergeFrames_ : function (frameA, frameB) {
|
mergeFrames_ : function (frameA, frameB) {
|
||||||
var transparentColorInt = pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR);
|
var transparentColorInt = pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR);
|
||||||
frameB.forEachPixel(function (color, col, row) {
|
for (var i = 0, length = frameA.getWidth() * frameA.getHeight(); i < length; ++i) {
|
||||||
if (color != transparentColorInt) {
|
if (frameB.pixels[i] != transparentColorInt && frameA.pixels[i] != frameB.pixels[i]) {
|
||||||
frameA.setPixel(col, row, color);
|
frameA.pixels[i] = frameB.pixels[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resize : function (frame, targetWidth, targetHeight, smoothing) {
|
resize : function (frame, targetWidth, targetHeight, smoothing) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user