Skip to content

Commit

Permalink
release 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codefrau committed Oct 25, 2023
1 parent c693073 commit a6f3e0f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
1 change: 1 addition & 0 deletions run/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ <h2>Run Squeak images from the internet</h2>
<li>Squeak 4.5 (2014) <a href="#url=https://freudenbergs.de/vanessa/squeakjs&files=[Squeak4.5-13680.image,Squeak4.5-13680.changes,SqueakV41.sources]">link</a></li>
<li>Squeak 5.0 (2015) <a href="#url=https://freudenbergs.de/vanessa/squeakjs&zip=[Squeak5.0-15113.zip,SqueakV50.sources.zip]">link</a></li>
<li>SpeechPlugin Demo (2016) <a href="#zip=https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/squeakjs/SpeechPluginDemo.zip">link</a></li>
<li>Cuis 6.0 (2022) <a href="#highdpi=true&url=https://cdn.jsdelivr.net/gh/Cuis-Smalltalk/Cuis-Smalltalk-Dev@69b4d18&files=[Cuis6.0-6053-v3.image,Cuis6.0-6053-v3.changes,CuisV6.sources]">link</a></li>
<li>Squeak 6.0 64 bit (2022) <a href="#zip=https://files.squeak.org/6.0/Squeak6.0-22104-64bit/Squeak6.0-22104-64bit.zip">link</a></li>
</ul>
On the first run these will be stored locally. Subsequent starts are much faster.
Expand Down
70 changes: 46 additions & 24 deletions squeak.js
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,9 @@
},
loadImageSegment: function(segmentWordArray, outPointerArray) {
// The C VM creates real objects from the segment in-place.
// We do the same, linking the new objects directly into old-space.
// We do the same, inserting the new objects directly into old-space
// between segmentWordArray and its following object (endMarker).
// This only increases oldSpaceCount but not oldSpaceBytes.
// The code below is almost the same as readFromBuffer() ... should unify
var segment = new DataView(segmentWordArray.words.buffer),
littleEndian = false,
Expand Down Expand Up @@ -8475,9 +8477,10 @@
this.showForm(context, cursorForm, bounds, true);
}
var canvas = this.display.context.canvas,
scale = canvas.offsetWidth / canvas.width;
cursorCanvas.style.width = (cursorCanvas.width * scale|0) + "px";
cursorCanvas.style.height = (cursorCanvas.height * scale|0) + "px";
scale = canvas.offsetWidth / canvas.width,
ratio = this.display.highdpi ? window.devicePixelRatio : 1;
cursorCanvas.style.width = (cursorCanvas.width * ratio * scale|0) + "px";
cursorCanvas.style.height = (cursorCanvas.height * ratio * scale|0) + "px";
this.display.cursorOffsetX = cursorForm.offsetX * scale|0;
this.display.cursorOffsetY = cursorForm.offsetY * scale|0;
}
Expand Down Expand Up @@ -8776,7 +8779,13 @@
if (!(form.depth > 0)) return null; // happens if not int
form.pixPerWord = 32 / form.depth;
form.pitch = (form.width + (form.pixPerWord - 1)) / form.pixPerWord | 0;
if (form.bits.length !== (form.pitch * form.height)) return null;
if (form.bits.length !== (form.pitch * form.height)) {
if (form.bits.length > (form.pitch * form.height)) {
this.vm.warnOnce("loadForm(): " + form.bits.length + " !== " + form.pitch + "*" + form.height + "=" + (form.pitch*form.height));
} else {
return null;
}
}
return form;
},
theDisplay: function() {
Expand Down Expand Up @@ -10444,19 +10453,19 @@
if (file.contents === false) // failed to get contents before
return false;
this.vm.freeze(function(unfreeze) {
Squeak.fileGet(file.name,
function success(contents) {
if (contents == null) return error(file.name);
file.contents = this.asUint8Array(contents);
unfreeze();
func(file);
}.bind(this),
function error(msg) {
console.log("File get failed: " + msg);
file.contents = false;
unfreeze();
func(file);
}.bind(this));
var error = (function(msg) {
console.log("File get failed: " + msg);
file.contents = false;
unfreeze();
func(file);
}).bind(this),
success = (function(contents) {
if (contents == null) return error(file.name);
file.contents = this.asUint8Array(contents);
unfreeze();
func(file);
}).bind(this);
Squeak.fileGet(file.name, success, error);
}.bind(this));
}
return true;
Expand Down Expand Up @@ -21190,7 +21199,12 @@
destPitch = (DIV((destWidth + (destPPW - 1)), destPPW)) * 4;
destBitsSize = BYTESIZEOF(destBits);
if (!(interpreterProxy.isWordsOrBytes(destBits) && (destBitsSize === (destPitch * destHeight)))) {
return false;
if (interpreterProxy.isWordsOrBytes(destBits) && (destBitsSize > (destPitch * destHeight))) {
interpreterProxy.vm.warnOnce("BitBlt>>loadBitBltDestForm: destBitsSize != destPitch * destHeight, expected " +
destPitch + "*" + destHeight + "=" + (destPitch * destHeight) + ", got " + destBitsSize);
} else {
return false;
}
}
destBits = destBits.wordsOrBytes();
}
Expand Down Expand Up @@ -21320,7 +21334,12 @@
sourcePitch = (DIV((sourceWidth + (sourcePPW - 1)), sourcePPW)) * 4;
sourceBitsSize = BYTESIZEOF(sourceBits);
if (!(interpreterProxy.isWordsOrBytes(sourceBits) && (sourceBitsSize === (sourcePitch * sourceHeight)))) {
return false;
if (interpreterProxy.isWordsOrBytes(sourceBits) && (sourceBitsSize > (sourcePitch * sourceHeight))) {
interpreterProxy.vm.warnOnce("BitBlt>>loadBitBltSourceForm: sourceBitsSize != sourcePitch * sourceHeight, expected " +
sourcePitch + "*" + sourceHeight + "=" + (sourcePitch * sourceHeight) + ", got " + sourceBitsSize);
} else {
return false;
}
}
sourceBits = sourceBits.wordsOrBytes();
}
Expand Down Expand Up @@ -54765,6 +54784,7 @@
fullscreen: false,
width: 0, // if 0, VM uses canvas.width
height: 0, // if 0, VM uses canvas.height
highdpi: options.highdpi,
mouseX: 0,
mouseY: 0,
buttons: 0,
Expand Down Expand Up @@ -54929,16 +54949,17 @@
function dist(a, b) {return dd(a.pageX, a.pageY, b.pageX, b.pageY);}
function adjustDisplay(l, t, w, h) {
var cursorCanvas = display.cursorCanvas,
scale = w / canvas.width;
scale = w / canvas.width,
ratio = display.highdpi ? window.devicePixelRatio : 1;
canvas.style.left = (l|0) + "px";
canvas.style.top = (t|0) + "px";
canvas.style.width = (w|0) + "px";
canvas.style.height = (h|0) + "px";
if (cursorCanvas) {
cursorCanvas.style.left = (l + display.cursorOffsetX + display.mouseX * scale|0) + "px";
cursorCanvas.style.top = (t + display.cursorOffsetY + display.mouseY * scale|0) + "px";
cursorCanvas.style.width = (cursorCanvas.width * scale|0) + "px";
cursorCanvas.style.height = (cursorCanvas.height * scale|0) + "px";
cursorCanvas.style.width = (cursorCanvas.width * ratio * scale|0) + "px";
cursorCanvas.style.height = (cursorCanvas.height * ratio * scale|0) + "px";
}
if (!options.pixelated) {
var pixelScale = window.devicePixelRatio * scale;
Expand Down Expand Up @@ -55285,7 +55306,7 @@
var scaleW = w < options.minWidth ? options.minWidth / w : 1,
scaleH = h < options.minHeight ? options.minHeight / h : 1,
scale = Math.max(scaleW, scaleH);
if (options.highdpi) scale *= window.devicePixelRatio;
if (display.highdpi) scale *= window.devicePixelRatio;
display.width = Math.floor(w * scale);
display.height = Math.floor(h * scale);
display.initialScale = w / display.width;
Expand Down Expand Up @@ -55317,6 +55338,7 @@
// set cursor scale
var cursorCanvas = display.cursorCanvas,
scale = canvas.offsetWidth / canvas.width;
if (display.highdpi) scale *= window.devicePixelRatio;
if (cursorCanvas && options.fixedWidth) {
cursorCanvas.style.width = (cursorCanvas.width * scale) + "px";
cursorCanvas.style.height = (cursorCanvas.height * scale) + "px";
Expand Down

0 comments on commit a6f3e0f

Please sign in to comment.