From ee5ce4b4a2cdea0cb6beca226b8fc3a2de66eb6e Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Thu, 13 Aug 2015 17:58:18 +0200
Subject: [PATCH] Fix typo in `drawFigures`, in webgl.js, which causes
 shadingPatterns with `figure.type === triangles` to render incorrectly

The file `issue2948.pdf` from the test-suite can be used to (manually) test the patch.
---
 src/display/webgl.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/display/webgl.js b/src/display/webgl.js
index c102580d7..8a64dd406 100644
--- a/src/display/webgl.js
+++ b/src/display/webgl.js
@@ -360,7 +360,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
           for (var j = 0, jj = ps.length; j < jj; j++) {
             coords[pIndex] = coordsMap[ps[j]];
             coords[pIndex + 1] = coordsMap[ps[j] + 1];
-            colors[cIndex] = colorsMap[cs[i]];
+            colors[cIndex] = colorsMap[cs[j]];
             colors[cIndex + 1] = colorsMap[cs[j] + 1];
             colors[cIndex + 2] = colorsMap[cs[j] + 2];
             pIndex += 2;