pxt-microbit 7.1.8 → 7.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/block-tests.js +1 -1
- package/built/sim.d.ts +1 -1
- package/built/sim.js +15 -16
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/package.json +1 -1
package/built/sim.js
CHANGED
|
@@ -1126,13 +1126,13 @@ var pxsim;
|
|
|
1126
1126
|
BitmapMethods.drawLine = drawLine;
|
|
1127
1127
|
function drawIcon(img, icon, x, y, color) {
|
|
1128
1128
|
const src = icon.data;
|
|
1129
|
-
if (!pxsim.
|
|
1129
|
+
if (!pxsim.bitmaps.isValidImage(icon))
|
|
1130
1130
|
return;
|
|
1131
1131
|
if (src[1] != 1)
|
|
1132
1132
|
return; // only mono
|
|
1133
|
-
let width = pxsim.
|
|
1134
|
-
let height = pxsim.
|
|
1135
|
-
let byteH = pxsim.
|
|
1133
|
+
let width = pxsim.bitmaps.bufW(src);
|
|
1134
|
+
let height = pxsim.bitmaps.bufH(src);
|
|
1135
|
+
let byteH = pxsim.bitmaps.byteHeight(height, 1);
|
|
1136
1136
|
x |= 0;
|
|
1137
1137
|
y |= 0;
|
|
1138
1138
|
const destHeight = img._height;
|
|
@@ -1478,15 +1478,15 @@ var pxsim;
|
|
|
1478
1478
|
})(BitmapMethods = pxsim.BitmapMethods || (pxsim.BitmapMethods = {}));
|
|
1479
1479
|
})(pxsim || (pxsim = {}));
|
|
1480
1480
|
(function (pxsim) {
|
|
1481
|
-
var
|
|
1482
|
-
(function (
|
|
1481
|
+
var bitmaps;
|
|
1482
|
+
(function (bitmaps) {
|
|
1483
1483
|
function byteHeight(h, bpp) {
|
|
1484
1484
|
if (bpp == 1)
|
|
1485
1485
|
return h * bpp + 7 >> 3;
|
|
1486
1486
|
else
|
|
1487
1487
|
return ((h * bpp + 31) >> 5) << 2;
|
|
1488
1488
|
}
|
|
1489
|
-
|
|
1489
|
+
bitmaps.byteHeight = byteHeight;
|
|
1490
1490
|
function isLegacyImage(buf) {
|
|
1491
1491
|
if (!buf || buf.data.length < 5)
|
|
1492
1492
|
return false;
|
|
@@ -1501,11 +1501,11 @@ var pxsim;
|
|
|
1501
1501
|
function bufW(data) {
|
|
1502
1502
|
return data[2] | (data[3] << 8);
|
|
1503
1503
|
}
|
|
1504
|
-
|
|
1504
|
+
bitmaps.bufW = bufW;
|
|
1505
1505
|
function bufH(data) {
|
|
1506
1506
|
return data[4] | (data[5] << 8);
|
|
1507
1507
|
}
|
|
1508
|
-
|
|
1508
|
+
bitmaps.bufH = bufH;
|
|
1509
1509
|
function isValidImage(buf) {
|
|
1510
1510
|
if (!buf || buf.data.length < 5)
|
|
1511
1511
|
return false;
|
|
@@ -1519,15 +1519,14 @@ var pxsim;
|
|
|
1519
1519
|
return false;
|
|
1520
1520
|
return true;
|
|
1521
1521
|
}
|
|
1522
|
-
|
|
1522
|
+
bitmaps.isValidImage = isValidImage;
|
|
1523
1523
|
function create(w, h) {
|
|
1524
1524
|
// truncate decimal sizes
|
|
1525
1525
|
w |= 0;
|
|
1526
1526
|
h |= 0;
|
|
1527
1527
|
return new pxsim.RefImage(w, h, 4);
|
|
1528
1528
|
}
|
|
1529
|
-
|
|
1530
|
-
// TODO: move to image namespace
|
|
1529
|
+
bitmaps.create = create;
|
|
1531
1530
|
function ofBuffer(buf) {
|
|
1532
1531
|
const src = buf.data;
|
|
1533
1532
|
let srcP = 4;
|
|
@@ -1583,7 +1582,7 @@ var pxsim;
|
|
|
1583
1582
|
}
|
|
1584
1583
|
return r;
|
|
1585
1584
|
}
|
|
1586
|
-
|
|
1585
|
+
bitmaps.ofBuffer = ofBuffer;
|
|
1587
1586
|
function toBuffer(img) {
|
|
1588
1587
|
let col = byteHeight(img._height, img._bpp);
|
|
1589
1588
|
let sz = 8 + img._width * col;
|
|
@@ -1626,7 +1625,7 @@ var pxsim;
|
|
|
1626
1625
|
}
|
|
1627
1626
|
return new pxsim.RefBuffer(r);
|
|
1628
1627
|
}
|
|
1629
|
-
|
|
1628
|
+
bitmaps.toBuffer = toBuffer;
|
|
1630
1629
|
function doubledIcon(buf) {
|
|
1631
1630
|
let img = ofBuffer(buf);
|
|
1632
1631
|
if (!img)
|
|
@@ -1634,8 +1633,8 @@ var pxsim;
|
|
|
1634
1633
|
img = pxsim.BitmapMethods.doubled(img);
|
|
1635
1634
|
return toBuffer(img);
|
|
1636
1635
|
}
|
|
1637
|
-
|
|
1638
|
-
})(
|
|
1636
|
+
bitmaps.doubledIcon = doubledIcon;
|
|
1637
|
+
})(bitmaps = pxsim.bitmaps || (pxsim.bitmaps = {}));
|
|
1639
1638
|
})(pxsim || (pxsim = {}));
|
|
1640
1639
|
var pxsim;
|
|
1641
1640
|
(function (pxsim) {
|