Attach (recommended) or Link to PDF file here:
[bug.pdf](https://github.com/mozilla/pdf.js/files/2886648/bug.pdf)
Also available at https://bug1529152.bmoattachments.org/attachment.cgi?id=9045439


Configuration:
- Web browser and its version: Firefox Nightly 67.0a1 (2019-02-20) (64-bit)
- Operating system and its version: Linux (64-bit Ubuntu 18.10)
- PDF.js version: whatever is bundled with current Nightly
- Is a browser extension: No (using built-in version, which is not listed in extensions)

Steps to reproduce the problem:
1. View [attached PDF](https://github.com/mozilla/pdf.js/files/2886648/bug.pdf)) in PDF.js (e.g. via Firefox Nightly built-in PDF viewer).  It's also hosted here: https://bug1529152.bmoattachments.org/attachment.cgi?id=9045439
This PDF was generated from an [HTML testcase](https://bugzilla.mozilla.org/attachment.cgi?id=9045438) that has a repeating-linear-gradient with "hard stops" (0-100px all the same color, 100-200px all the same color, & repeat)

What is the expected behavior?
There should be **solid stripes** of blue and lime.  There shouldn't be any blurring between the colors.  I think there should be 6 total stripes, though different viewers seem to disagree (Safari+Edge render 6 stripes; Chrome renders a tiny blue stripe at the top; Evince renders 3 broad stripes)  But bottom line, there should be distinct solid-colored stripes. Here's a screenshot of the Chrome built-in PDF viewer's rendering:
![image](https://user-images.githubusercontent.com/426803/53128057-c8735680-3518-11e9-82fa-f75d733bda44.png)

What went wrong?
PDF.js renders a gradual gradient from lime to blue (but mostly lime).  Here's a screenshot:
![image](https://user-images.githubusercontent.com/426803/53127935-6f0b2780-3518-11e9-8f77-6d1998150ee0.png)
static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  
  static TRIANGLE_DENSITY = 20;
  constructor(
    stream,
    xref,
    resources,
    pdfFunctionFactory,
    localColorSpaceCache
  ) {
    super();
    if (!(stream instanceof BaseStream)) {
      throw new FormatError("Mesh data is not a stream");
    }
    const dict = stream.dict;
    this.shadingType = dict.get("ShadingType");
    const bbox = dict.getArray("BBox");
    if (Array.isArray(bbox) && bbox.length === 4) {
      this.bbox = Util.normalizeRect(bbox);
    } else {
      this.bbox = null;
    }
    const cs = ColorSpace.parse({