Use bitmap asset type and 'png' for various costume formats.

This commit is contained in:
Karishma Chadha 2018-04-04 17:31:03 -04:00
parent d61ea23e1e
commit 118c6f0356

View file

@ -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
); );