)]}'
{
  "commit": "2bf942dda86b9a3cf69120247e59fb6758fbf19d",
  "tree": "d5dfde546c2f7d1c93dbd70bdea7f06138834733",
  "parents": [
    "5b8f48160347885f76f679b39f31aa48bfc4f8bd"
  ],
  "author": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Fri Nov 20 14:58:58 2026 -0600"
  },
  "committer": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Fri Nov 20 15:38:42 2026 -0600"
  },
  "message": "[vector] Interpolate gradient colors with alpha multiplied in\n\nOpenType requires the colors of a COLR gradient to be interpolated\nwith alpha multiplied into them, hb_color_stop_t\u0027s documentation says\nso, and hb-raster and hb-gpu do it.  hb-vector writes the stops as an\nSVG or PDF gradient, and viewers interpolate the color and the alpha\nof the stops separately.  That differs between two stops that differ\nin alpha.  From an opaque orange to black at 30%, hb-vector\u0027s output\nwent through a dark brown that hb-raster\u0027s does not have, and a color\nfading out to a transparent stop took on that stop\u0027s color on the\nway, though a transparent stop has none.\n\nRewrite the stops so that the viewers\u0027 interpolation gives COLR\u0027s.\nA transparent stop takes its neighbor\u0027s color, on each side, which\nmakes those gradients exact.  Between two other stops that differ in\nalpha the color is not linear in the offset, and stops are added\nalong its curve: up to 15, as many as keep the premultiplied color\nwithin about two levels out of 255.  Stops that share an alpha are\nwritten as before.\n\nThe PDF function builder sorted stops that its callers had already\nsorted.  That sort is not stable past 24 stops and could now reorder\nstops that share an offset, so it goes.\n\nTesting: foreground_color_linear_alpha_0.3 and its radial and sweep\nsiblings in test_glyphs-glyf_colr_1.ttf differed from hb-raster on\n18% to 29% of their pixels in Chrome and librsvg (SVG) and in pdfium,\nMuPDF and poppler\u0027s cairo backend (PDF); now on none, but for the\nsweep in librsvg, which drops wedges of any sweep at that size\n(#6841).  Of the mapped glyphs of the COLR test fonts, these three in\neach of three fonts change their picture, two more change their bytes\nonly, and the rest are byte for byte what they were.\n\nReplaying the same paint calls on hb-raster and hb-vector for 300\nrandom scenes of linear, radial and sweep gradients of two or three\nstops with alphas from 0 to 255, about 140 had the pixels hb-raster\ngives them in each of those five renderers, and all 300 do now, as\ndo the first 100 in Firefox.  Ghostscript differs on eight; the two\nthat were reduced are a linear gradient under a rotation, whose\nlength Ghostscript gets wrong whatever its colors.\n\nThe new test paints gradients into SVG, reads the stops back, and\nchecks what a viewer makes of them against what COLR makes of the\nstops given, at a thousand offsets; without the change it fails.\nThe vector tests and fuzzer are clean under ASan and UBSan, the new\ntest under MSan, and the fuzzer with failing allocations.  Full test\nsuite passes.\n\nCo-Authored-By: Claude Fable 5.2 \u003cnoreply@anthropic.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "22675f8a34f3127b1e4365d1803721b6369eb690",
      "old_mode": 33188,
      "old_path": "src/hb-vector-paint-pdf.cc",
      "new_id": "fab8b95a73c7b00768bd60a9e196ea32d9e8cfea",
      "new_mode": 33188,
      "new_path": "src/hb-vector-paint-pdf.cc"
    },
    {
      "type": "modify",
      "old_id": "61f49e1dcdf7591facc119dcc35b497f9c18704d",
      "old_mode": 33188,
      "old_path": "src/hb-vector-paint-svg.cc",
      "new_id": "5c3ae00b7a30d2298af6b0bdeea19b5784798a80",
      "new_mode": 33188,
      "new_path": "src/hb-vector-paint-svg.cc"
    },
    {
      "type": "modify",
      "old_id": "b1f3d60651960680b6b3f609f7200d2565417459",
      "old_mode": 33188,
      "old_path": "src/hb-vector-paint.hh",
      "new_id": "595228034bc51e4b1319bbf61677d59fd05aa5c4",
      "new_mode": 33188,
      "new_path": "src/hb-vector-paint.hh"
    },
    {
      "type": "modify",
      "old_id": "8d9a9dd1c54168389dae2a815479849b2253d062",
      "old_mode": 33188,
      "old_path": "test/vector/meson.build",
      "new_id": "de6dbf92be39d7107bd13b205f1157ce0564b81b",
      "new_mode": 33188,
      "new_path": "test/vector/meson.build"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "9cea62eb3e9157fb20f331d3cc7599d881c49e2f",
      "new_mode": 33188,
      "new_path": "test/vector/test-vector-gradient.c"
    }
  ]
}
