зеркало из https://github.com/mozilla/pluotsorbet.git
wee, fix a bug in the unzip code and decode pngs
This commit is contained in:
Родитель
5a78fed2ce
Коммит
f7f715e94a
16
midp.js
16
midp.js
|
@ -501,8 +501,20 @@ Native["javax/microedition/lcdui/Font.init.(III)V"] = function(ctx, stack) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Native["javax/microedition/lcdui/ImageDataFactory.createImmutableImageDecodeImage.(Ljavax/microedition/lcdui/ImageData;[BII)V"] = function(ctx, stack) {
|
Native["javax/microedition/lcdui/ImageDataFactory.createImmutableImageDecodeImage.(Ljavax/microedition/lcdui/ImageData;[BII)V"] = function(ctx, stack) {
|
||||||
var length = stack.pop(), offset = stack.pop(), bytes = stack.pop(), image = stack.pop();
|
var length = stack.pop(), offset = stack.pop(), bytes = stack.pop(), imageData = stack.pop();
|
||||||
image.data = bytes.buffer.slice(offset, offset + length);
|
var blob = new Blob([bytes.buffer.slice(offset, offset + length)], { type: "image/png" });
|
||||||
|
var img = new Image();
|
||||||
|
img.src = URL.createObjectURL(blob);
|
||||||
|
img.onload = function() {
|
||||||
|
imageData["javax/microedition/lcdui/ImageData$width"] = img.naturalWidth;
|
||||||
|
imageData["javax/microedition/lcdui/ImageData$height"] = img.naturalHeight;
|
||||||
|
imageData["javax/microedition/lcdui/ImageData$nativeImageData"] = img;
|
||||||
|
ctx.resume();
|
||||||
|
}
|
||||||
|
img.onerror = function(e) {
|
||||||
|
ctx.resume();
|
||||||
|
}
|
||||||
|
throw VM.Pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
Native["com/sun/midp/chameleon/layers/SoftButtonLayer.isNativeSoftButtonLayerSupported0.()Z"] = function(ctx, stack) {
|
Native["com/sun/midp/chameleon/layers/SoftButtonLayer.isNativeSoftButtonLayerSupported0.()Z"] = function(ctx, stack) {
|
||||||
|
|
|
@ -224,7 +224,6 @@ function inflate(bytes) {
|
||||||
|
|
||||||
ensureBuffer(bufferLength + blockLen);
|
ensureBuffer(bufferLength + blockLen);
|
||||||
var end = bufferLength + blockLen;
|
var end = bufferLength + blockLen;
|
||||||
bufferLength = end;
|
|
||||||
for (var n = bufferLength; n < end; ++n) {
|
for (var n = bufferLength; n < end; ++n) {
|
||||||
if (typeof (b = bytes[bytesPos++]) == 'undefined') {
|
if (typeof (b = bytes[bytesPos++]) == 'undefined') {
|
||||||
eof = true;
|
eof = true;
|
||||||
|
@ -232,6 +231,7 @@ function inflate(bytes) {
|
||||||
}
|
}
|
||||||
buffer[n] = b;
|
buffer[n] = b;
|
||||||
}
|
}
|
||||||
|
bufferLength = end;
|
||||||
return eof;
|
return eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче