Skip to content

Commit 0e5c9c5

Browse files
committed
use temporary variables for swap indices
1 parent 3e05b5b commit 0e5c9c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/plots/gl3d/scene.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,9 +1012,11 @@ proto.toImage = function(format) {
10121012
for(var j = 0, k = h - 1; j < k; ++j, --k) {
10131013
for(var i = 0; i < w; ++i) {
10141014
for(var l = 0; l < 4; ++l) {
1015-
var tmp = pixels[4 * (w * j + i) + l];
1016-
pixels[4 * (w * j + i) + l] = pixels[4 * (w * k + i) + l];
1017-
pixels[4 * (w * k + i) + l] = tmp;
1015+
var a = 4 * (w * j + i) + l;
1016+
var b = 4 * (w * k + i) + l;
1017+
var tmp = pixels[a];
1018+
pixels[a] = pixels[b];
1019+
pixels[b] = tmp;
10181020
}
10191021
}
10201022
}

0 commit comments

Comments
 (0)