let "getImageAttribute" deal with null costumes

pull/89/head
jmoenig 2019-04-09 10:27:55 +02:00
rodzic 223e493316
commit 530afb1a60
3 zmienionych plików z 15 dodań i 9 usunięć

Wyświetl plik

@ -64,6 +64,7 @@
### 2019-04-09
* Blocks, Objects, Threads: new "getImageAttribute" reporter primitive
* Objects, Threads: let "getImageAttribute" deal with null costumes
### 2019-04-08
* Blocks, Objects, Threads: new "getSoundAttribute" reporter primitive

Wyświetl plik

@ -8910,14 +8910,19 @@ Costume.prototype.rasterized = function () {
};
Costume.prototype.pixels = function () {
var i,
pixels = [],
src = this.contents.getContext('2d').getImageData(
0,
0,
this.contents.width,
this.contents.height
);
var pixels = [],
src,
i;
if (!this.contents.width || !this.contents.height) {
return pixels;
}
src = this.contents.getContext('2d').getImageData(
0,
0,
this.contents.width,
this.contents.height
);
for (i = 0; i < src.data.length; i += 4) {
pixels.push(new List([
src.data[i],

Wyświetl plik

@ -4345,7 +4345,7 @@ Process.prototype.reportGetImageAttribute = function (choice, name) {
this.blockReceiver().costumes.asArray(),
function (c) {return c.name === name.toString(); }
)
),
) || new Costume(),
option = this.inputOption(choice);
switch (option) {