minor cleanup

This commit is contained in:
Rolux 2010-03-04 10:29:32 +01:00
parent c0bd184347
commit c58e5b9a03
2 changed files with 5 additions and 5 deletions

View File

@ -804,7 +804,7 @@ Encoding functions
str = Ox.encodeUTF8(str);
var len = str.length, c = Ox.canvas(Math.ceil((4 + len) / 3), 1), data;
str = Ox.pad(Ox.encodeBase256(len), 4, Ox.char(0)) + str +
+ Ox.repeat("\u00FF", (4 - len % 4) % 4); // simpler? Ox.pad()?
Ox.repeat("\u00FF", (4 - len % 4) % 4); // simpler? Ox.pad()?
/* fixme: why does map not work here?
c.data = $.map(c.data, function(v, i) {
return i % 4 < 3 ? str.charCodeAt(i - parseInt(i / 4)) : 255;
@ -815,7 +815,7 @@ Encoding functions
}
c.context.putImageData(c.imageData, 0, 0);
data = atob(c.canvas.toDataURL().split(",")[1]);
Ox.print("deflate", len, "->", data.length - 20);
//Ox.print("deflate", len, "->", data.length - 20);
return data.substr(8, data.length - 20);
}
@ -823,7 +823,7 @@ Encoding functions
var image = new Image();
image.src = "data:image/png;base64," + btoa("\u0089PNG\r\n\u001A\n" +
str + Ox.repeat("\u0000", 4) + "IEND\u00AEB`\u0082");
while(!image.width) {}
while (!image.width) {} // wait for image data
str = Ox.map(Ox.canvas(image).data, function(v, i) {
return i % 4 < 3 ? Ox.char(v) : "";
}).join("");

View File

@ -1354,13 +1354,13 @@ requires
function mousedownLayer() {
that.$layer.stop().animate({
opacity: 0.5
}, 100);
}, 50);
}
function mouseupLayer() {
that.$layer.stop().animate({
opacity: 0
}, 100);
}, 50);
}
function reset() {