Skip to content

Commit

Permalink
ObviousAlexC/penPlus: fix #1712 (#1823)
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Orangemoon authored Dec 29, 2024
1 parent a8764bf commit 02d06b2
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions extensions/obviousAlexC/penPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3917,9 +3917,6 @@

//?Renderer Freaks out if we don't do this so do it.

//trying my best to reduce memory usage
gl.viewport(0, 0, nativeSize[0], nativeSize[1]);

//Paratheses because I know some obscure browser will screw this up.
x1 = Scratch.Cast.toNumber(x1);
x2 = Scratch.Cast.toNumber(x2);
Expand Down Expand Up @@ -3957,9 +3954,6 @@

//?Renderer Freaks out if we don't do this so do it.

//trying my best to reduce memory usage
gl.viewport(0, 0, nativeSize[0], nativeSize[1]);

//Paratheses because I know some obscure browser will screw this up.
x1 = Scratch.Cast.toNumber(x1);
x2 = Scratch.Cast.toNumber(x2);
Expand Down Expand Up @@ -4077,15 +4071,15 @@
if (costIndex >= 0) {
const curCostume =
curTarget.sprite.costumes[costIndex].asset.encodeDataURI();
return curCostume;
return curCostume || 0;
}
}

getDimensionOf({ dimension, costume }, util) {
//Just a simple thing to allow for pen drawing
const costIndex = this.penPlusCostumeLibrary[costume];
if (costIndex) {
return costIndex[dimension];
return costIndex[dimension] || "";
}
}

Expand Down Expand Up @@ -4142,11 +4136,13 @@
y = Math.floor(y - 1);
const colorIndex = (y * curCostume.width + x) * 4;
if (textureData[colorIndex] && x < curCostume.width && x >= 0) {
return this.colorLib.rgbtoSColor({
R: textureData[colorIndex] / 2.55,
G: textureData[colorIndex + 1] / 2.55,
B: textureData[colorIndex + 2] / 2.55,
});
return (
this.colorLib.rgbtoSColor({
R: textureData[colorIndex] / 2.55,
G: textureData[colorIndex + 1] / 2.55,
B: textureData[colorIndex + 2] / 2.55,
}) || "0"
);
}
return this.colorLib.rgbtoSColor({ R: 100, G: 100, B: 100 });
}
Expand All @@ -4162,7 +4158,7 @@
curCostume.height
);
if (textureData) {
return textureData;
return textureData || "";
}
return "";
}
Expand Down Expand Up @@ -4341,8 +4337,6 @@
// prettier-ignore
if (!this.inDrawRegion) renderer.enterDrawRegion(this.penPlusDrawRegion);

gl.viewport(0, 0, nativeSize[0], nativeSize[1]);

//Safe to assume they have a buffer;
const buffer = this.programs[shader].buffer;

Expand Down Expand Up @@ -6041,7 +6035,7 @@

//Ignore reductive values
if (!(id > 0 && id <= 3)) return def;
if (!value) return def;
if (typeof value == "undefined") return def;

//Parse it
let parsed = JSON.parse(def);
Expand Down

0 comments on commit 02d06b2

Please sign in to comment.