Only check for fill and stroke once

This commit is contained in:
Andreas Hocevar
2016-09-12 23:43:32 +02:00
parent 129757578d
commit 430aee95fd

View File

@@ -80,9 +80,6 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
var fill = state.fillStyle !== undefined;
var stroke = state.strokeStyle != undefined;
var numEnds = ends.length;
if (!fill && !stroke) {
return ends[numEnds - 1];
}
var beginPathInstruction = [ol.render.canvas.Instruction.BEGIN_PATH];
this.instructions.push(beginPathInstruction);
this.hitDetectionInstructions.push(beginPathInstruction);
@@ -178,11 +175,9 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
ol.DEBUG && console.assert(state.fillStyle === undefined && strokeStyle === undefined,
'fillStyle or strokeStyle should be defined');
if (strokeStyle !== undefined) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');