[ui] Reuse a single offscreen canvas in MiddleTruncate (#25569)