)]}'
{
  "commit": "ab6e36ff1fe84842229d134bdcbd80c720606c1c",
  "tree": "46b4137b80f252757a946f27ad5c8953b6db776d",
  "parents": [
    "781e06cdbf1ffaa2ef3ea0087dc94371d2ed6ef8"
  ],
  "author": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Fri Nov 20 23:38:44 2026 -0600"
  },
  "committer": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Fri Nov 20 23:38:44 2026 -0600"
  },
  "message": "[raster] Average an image that is shrunk\n\nhb-raster read an image at one place for each pixel it painted, with\nbilinear reconstruction, which takes in two pixels of the image a\nside.  Where a pixel painted spans more than that, the rest of the\nimage under it was left out: edges came out ragged, and thin lines in\npieces.  Noto Color Emoji has one strike of 136 by 128 pixels, so\nthat is every emoji at text sizes.\n\nTake a grid of samples for such a pixel, spread over it, and average\nthem: one sample a side for each two pixels of the image that the\npixel spans along that side, so that no pixel of the image is left\nout, and at most 16 a side.  A sample that falls outside of the\nimage is clear, so the edges of a shrunk image are softened as well.\nWhere the image is not shrunk by more than two, it is one sample as\nbefore.\n\nThe grid is laid out in the pixel painted, so it is right for an\nimage under any transform.  Nothing is allocated.  The samples taken\nare no more than the pixels of the image under the clip, which the\nbudget is charged for already.\n\nTesting: a new test shrinks an image whose every fourth column is\nred by eight, and checks that the pixels are a quarter red; read at\none place they were half red.  It fails without the change.\n\nAgainst the true average of a 256 by 256 image of discs and lines,\nshrunk onto a whole number of pixels, the largest error in any\nchannel and how many pixels are more than 24 levels off:\n\n  shrunk by    before          after\n    2            0,  none       0, none\n    4          111,  28%        1, none\n    8          147,  43%        0, none\n   16          141,  50%        0, none\n   32          124,  64%        0, none\n   64          115,  75%       13, none\n  128          174, 100%        9, none\n\nAgainst hb-view, where cairo filters an image that it shrinks, the\nfive glyphs of NotoColorEmoji.subset.ttf at 16 to 48 pixels per em\nhad 5% to 46% of their pixels more than 24 levels off, and now have\nnone; from 64 up, where the image is shrunk by less than two, nothing\nchanges.\n\nThe tests and the raster fuzzer over the test fonts are clean under\nASan and UBSan.  Full test suite passes.\n\nCo-Authored-By: Claude Fable 5.2 \u003cnoreply@anthropic.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "47f8d30f766ef7a02e071a95e6338a5a0d51c7b7",
      "old_mode": 33188,
      "old_path": "src/hb-raster-paint.cc",
      "new_id": "23d83260c19a783c85adcf8b501a36decf41d630",
      "new_mode": 33188,
      "new_path": "src/hb-raster-paint.cc"
    },
    {
      "type": "modify",
      "old_id": "a51405b69469d6f5c1ad5e037c549badf557af8b",
      "old_mode": 33188,
      "old_path": "test/api/test-raster.cc",
      "new_id": "e1dda6937fa9ac14e4ff2e3f04cfb33afc8d26ab",
      "new_mode": 33188,
      "new_path": "test/api/test-raster.cc"
    }
  ]
}
