Avoid clearing canvas twice

This commit is contained in:
Tom Payne
2013-11-12 01:26:41 +01:00
committed by Frederic Junod
parent bd876831ed
commit 900bc176ae
+4 -3
View File
@@ -95,14 +95,15 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
return; return;
} }
var context = this.context_;
var size = frameState.size; var size = frameState.size;
if (this.canvas_.width != size[0] || this.canvas_.height != size[1]) { if (this.canvas_.width != size[0] || this.canvas_.height != size[1]) {
this.canvas_.width = size[0]; this.canvas_.width = size[0];
this.canvas_.height = size[1]; this.canvas_.height = size[1];
} } else {
var context = this.context_;
context.clearRect(0, 0, this.canvas_.width, this.canvas_.height); context.clearRect(0, 0, this.canvas_.width, this.canvas_.height);
}
this.calculateMatrices2D(frameState); this.calculateMatrices2D(frameState);