Skip to content

Commit 49915fd

Browse files
committed
fix nonsquare images can't be loaded correctly.
1 parent a2769fd commit 49915fd

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pietron",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Cross-platform IDE for Piet.",
55
"main": "src/main.js",
66
"repository": {

src/canvas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const createCanvas = (width, height) => {
6565

6666
const createFromBitmap = bitmap => {
6767
bitmap = transpose(bitmap);
68-
const [width, height] = [bitmap.length, bitmap[0].length];
68+
const [height, width] = [bitmap.length, bitmap[0].length];
6969
setCanvasWidth(width, false);
7070
setCanvasHeight(height, false);
7171
for (let i = 0; i < height; i++) {

src/file.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ const fileToBitmap = async path => {
7272
for (let i = 0; i < fieldWidth; i++) {
7373
const row = [];
7474
for (let j = 0; j < fieldHeight; j++) {
75-
// const hex = img.bitmap.data.readUInt32BE(img.getPixelIndex(i * codelSize, j * codelSize));
76-
const hex = img.getPixelColor(i * codelSize, j * codelSize);
75+
const hex = img.bitmap.data.readUInt32BE(img.getPixelIndex(i * codelSize, j * codelSize));
7776
const color = hexToPietColor(hex);
7877
row.push(color > -1 ? color : 18);
7978
}

0 commit comments

Comments
 (0)