mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-10 15:02:06 -05:00
Remove calls to updateDrawableSkinIdRotationCenter
This commit is contained in:
parent
8faad67439
commit
a434bc5a34
3 changed files with 13 additions and 23 deletions
|
@ -212,8 +212,17 @@ 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 or rotationCenter are undefined...
|
// createBitmapSkin does the right thing if costume.bitmapResolution is undefined...
|
||||||
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, rotationCenter);
|
// TODO: is rotationCenter ever undefined?
|
||||||
|
let center;
|
||||||
|
if (rotationCenter) {
|
||||||
|
center = [
|
||||||
|
rotationCenter[0] / 2,
|
||||||
|
rotationCenter[1] / 2
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
costume.size = [renderSize[0] * 2, renderSize[1] * 2]; // Actual size, since all bitmaps are resolution 2
|
costume.size = [renderSize[0] * 2, renderSize[1] * 2]; // Actual size, since all bitmaps are resolution 2
|
||||||
|
|
|
@ -458,19 +458,7 @@ class RenderedTarget extends Target {
|
||||||
);
|
);
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
const costume = this.getCostumes()[this.currentCostume];
|
const costume = this.getCostumes()[this.currentCostume];
|
||||||
if (
|
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
|
||||||
typeof costume.rotationCenterX !== 'undefined' &&
|
|
||||||
typeof costume.rotationCenterY !== 'undefined'
|
|
||||||
) {
|
|
||||||
const scale = costume.bitmapResolution || 2;
|
|
||||||
const rotationCenter = [
|
|
||||||
costume.rotationCenterX / scale,
|
|
||||||
costume.rotationCenterY / scale
|
|
||||||
];
|
|
||||||
this.renderer.updateDrawableSkinIdRotationCenter(this.drawableID, costume.skinId, rotationCenter);
|
|
||||||
} else {
|
|
||||||
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this);
|
this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this);
|
||||||
|
@ -709,11 +697,7 @@ class RenderedTarget extends Target {
|
||||||
this.renderer.updateDrawableVisible(this.drawableID, this.visible);
|
this.renderer.updateDrawableVisible(this.drawableID, this.visible);
|
||||||
|
|
||||||
const costume = this.getCostumes()[this.currentCostume];
|
const costume = this.getCostumes()[this.currentCostume];
|
||||||
const bitmapResolution = costume.bitmapResolution || 2;
|
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
|
||||||
this.renderer.updateDrawableSkinIdRotationCenter(this.drawableID, costume.skinId, [
|
|
||||||
costume.rotationCenterX / bitmapResolution,
|
|
||||||
costume.rotationCenterY / bitmapResolution
|
|
||||||
]);
|
|
||||||
|
|
||||||
for (const effectName in this.effects) {
|
for (const effectName in this.effects) {
|
||||||
if (!this.effects.hasOwnProperty(effectName)) continue;
|
if (!this.effects.hasOwnProperty(effectName)) continue;
|
||||||
|
|
3
test/fixtures/fake-renderer.js
vendored
3
test/fixtures/fake-renderer.js
vendored
|
@ -17,9 +17,6 @@ FakeRenderer.prototype.getFencedPositionOfDrawable = function (d, p) { // eslint
|
||||||
FakeRenderer.prototype.updateDrawableSkinId = function (d, skinId) { // eslint-disable-line no-unused-vars
|
FakeRenderer.prototype.updateDrawableSkinId = function (d, skinId) { // eslint-disable-line no-unused-vars
|
||||||
};
|
};
|
||||||
|
|
||||||
FakeRenderer.prototype.updateDrawableSkinIdRotationCenter =
|
|
||||||
function (d, skinId, rotationCenter) {}; // eslint-disable-line no-unused-vars
|
|
||||||
|
|
||||||
FakeRenderer.prototype.updateDrawablePosition = function (d, position) { // eslint-disable-line no-unused-vars
|
FakeRenderer.prototype.updateDrawablePosition = function (d, position) { // eslint-disable-line no-unused-vars
|
||||||
this.x = position[0];
|
this.x = position[0];
|
||||||
this.y = position[1];
|
this.y = position[1];
|
||||||
|
|
Loading…
Reference in a new issue