mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Use bitmap asset type and 'png' for various costume formats.
This commit is contained in:
parent
d61ea23e1e
commit
118c6f0356
1 changed files with 2 additions and 5 deletions
|
@ -106,14 +106,11 @@ const deserializeCostume = function (costume, runtime, zip, assetFileName) {
|
||||||
log.error(`Could not find costume file associated with the ${costume.name} costume.`);
|
log.error(`Could not find costume file associated with the ${costume.name} costume.`);
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
let dataFormat = null;
|
|
||||||
let assetType = null;
|
let assetType = null;
|
||||||
const costumeFormat = costume.dataFormat.toLowerCase();
|
const costumeFormat = costume.dataFormat.toLowerCase();
|
||||||
if (costumeFormat === 'svg') {
|
if (costumeFormat === 'svg') {
|
||||||
dataFormat = storage.DataFormat.SVG;
|
|
||||||
assetType = storage.AssetType.ImageVector;
|
assetType = storage.AssetType.ImageVector;
|
||||||
} else if (costumeFormat === 'png') {
|
} else if (['png', 'bmp', 'jpeg', 'jpg', 'gif'].indexOf(costumeFormat) >= 0) {
|
||||||
dataFormat = storage.DataFormat.PNG;
|
|
||||||
assetType = storage.AssetType.ImageBitmap;
|
assetType = storage.AssetType.ImageBitmap;
|
||||||
} else {
|
} else {
|
||||||
log.error(`Unexpected file format for costume: ${costumeFormat}`);
|
log.error(`Unexpected file format for costume: ${costumeFormat}`);
|
||||||
|
@ -126,7 +123,7 @@ const deserializeCostume = function (costume, runtime, zip, assetFileName) {
|
||||||
return costumeFile.async('uint8array').then(data => {
|
return costumeFile.async('uint8array').then(data => {
|
||||||
storage.builtinHelper.cache(
|
storage.builtinHelper.cache(
|
||||||
assetType,
|
assetType,
|
||||||
dataFormat,
|
costumeFormat,
|
||||||
data,
|
data,
|
||||||
assetId
|
assetId
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue