mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Clarify loadBitmap_ comments
This commit is contained in:
parent
a434bc5a34
commit
5387f3a729
1 changed files with 6 additions and 2 deletions
|
@ -212,16 +212,20 @@ const loadBitmap_ = function (costume, runtime, _rotationCenter) {
|
||||||
return fetched;
|
return fetched;
|
||||||
})
|
})
|
||||||
.then(({canvas, mergeCanvas, rotationCenter}) => {
|
.then(({canvas, mergeCanvas, rotationCenter}) => {
|
||||||
// createBitmapSkin does the right thing if costume.bitmapResolution is undefined...
|
// createBitmapSkin does the right thing if costume.rotationCenter are undefined.
|
||||||
// TODO: is rotationCenter ever undefined?
|
// That will be the case if you upload a bitmap asset or create one by taking a photo.
|
||||||
let center;
|
let center;
|
||||||
if (rotationCenter) {
|
if (rotationCenter) {
|
||||||
|
// fetchBitmapCanvas will ensure that the costume's bitmap resolution is 2 and its rotation center is
|
||||||
|
// scaled to match, so it's okay to always divide by 2.
|
||||||
center = [
|
center = [
|
||||||
rotationCenter[0] / 2,
|
rotationCenter[0] / 2,
|
||||||
rotationCenter[1] / 2
|
rotationCenter[1] / 2
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: costume.bitmapResolution will always be 2 at this point because of fetchBitmapCanvas_, so we don't
|
||||||
|
// need to pass it in here.
|
||||||
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, center);
|
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, center);
|
||||||
canvasPool.release(mergeCanvas);
|
canvasPool.release(mergeCanvas);
|
||||||
const renderSize = runtime.renderer.getSkinSize(costume.skinId);
|
const renderSize = runtime.renderer.getSkinSize(costume.skinId);
|
||||||
|
|
Loading…
Reference in a new issue