Merge pull request #1314 from fredj/canvas_clear

Avoid clearing canvas twice
This commit is contained in:
Frédéric Junod
2013-11-25 01:58:51 -08:00
+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);