Fix : protect LayerRenderer against fake setDisplaySize calls

This commit is contained in:
jdescottes 2014-04-12 15:16:18 +02:00
parent c5accf978e
commit 29fa604d74
2 changed files with 15 additions and 1 deletions

View File

@ -24,7 +24,7 @@
*/
ns.CachedFrameRenderer.prototype.setDisplaySize = function (width, height) {
if (this.displayWidth !== width || this.displayHeight !== height) {
pskl.rendering.frame.FrameRenderer.prototype.setDisplaySize.call(this, width, height);
this.superclass.setDisplaySize.call(this, width, height);
}
};

View File

@ -58,6 +58,20 @@
}
};
/**
* See @pskl.rendering.frame.CachedFrameRenderer
* Same issue : FrameRenderer setDisplaySize destroys the canvas
* @param {Number} width
* @param {Number} height
*/
ns.LayersRenderer.prototype.setDisplaySize = function (width, height) {
var size = this.getDisplaySize();
if (size.width !== width || size.height !== height) {
this.superclass.setDisplaySize.call(this, width, height);
}
};
ns.LayersRenderer.prototype.getFrameForLayersAt_ = function (frameIndex, layers) {
var frames = layers.map(function (l) {
return l.getFrameAt(frameIndex);