From 965b88d7c8e71a0385aca422ed168ca2987ed210 Mon Sep 17 00:00:00 2001 From: Petr Sloup Date: Fri, 16 Oct 2015 16:20:34 +0200 Subject: [PATCH] Save context state only when it's actually necessary --- src/ol/reproj/reproj.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ol/reproj/reproj.js b/src/ol/reproj/reproj.js index 7609942c61..fbca15fa90 100644 --- a/src/ol/reproj/reproj.js +++ b/src/ol/reproj/reproj.js @@ -144,8 +144,6 @@ ol.reproj.render = function(width, height, pixelRatio, var targetTopLeft = ol.extent.getTopLeft(targetExtent); triangulation.getTriangles().forEach(function(triangle, i, arr) { - context.save(); - /* Calculate affine transform (src -> dst) * Resulting matrix can be used to transform coordinate * from `sourceProjection` to destination pixels. @@ -199,6 +197,7 @@ ol.reproj.render = function(width, height, pixelRatio, return; } + context.save(); context.beginPath(); if (ol.reproj.browserAntialiasesClip_) { var centroidX = (u0 + u1 + u2) / 3, centroidY = (v0 + v1 + v2) / 3;