MCPcopy Create free account
hub / github.com/codeaashu/claude-code / _findGlyphBoundingBox

Method _findGlyphBoundingBox

src/server/web/public/terminal.js:7879–7927  ·  view source on GitHub ↗
(e3, t3, i3, s3, r2, o2)

Source from the content-addressed store, hash-verified

7877 if (N.x + $.size.x <= U.canvas.width) break;
7878 N === U.currentRow ? (N.x = 0, N.y += N.height, N.height = 0) : U.fixedRows.splice(U.fixedRows.indexOf(N), 1);
7879 }
7880 return $.texturePage = this._pages.indexOf(U), $.texturePosition.x = N.x, $.texturePosition.y = N.y, $.texturePositionClipSpace.x = N.x / U.canvas.width, $.texturePositionClipSpace.y = N.y / U.canvas.height, $.sizeClipSpace.x /= U.canvas.width, $.sizeClipSpace.y /= U.canvas.height, N.height = Math.max(N.height, $.size.y), N.x += $.size.x, U.ctx.putImageData(O, $.texturePosition.x - this._workBoundingBox.left, $.texturePosition.y - this._workBoundingBox.top, this._workBoundingBox.left, this._workBoundingBox.top, $.size.x, $.size.y), U.addGlyph($), U.version++, $;
7881 }
7882 _findGlyphBoundingBox(e3, t3, i3, s3, r2, o2) {
7883 t3.top = 0;
7884 const n2 = s3 ? this._config.deviceCellHeight : this._tmpCanvas.height, a2 = s3 ? this._config.deviceCellWidth : i3;
7885 let h2 = false;
7886 for (let i4 = 0; i4 < n2; i4++) {
7887 for (let s4 = 0; s4 < a2; s4++) {
7888 const r3 = i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3;
7889 if (0 !== e3.data[r3]) {
7890 t3.top = i4, h2 = true;
7891 break;
7892 }
7893 }
7894 if (h2) break;
7895 }
7896 t3.left = 0, h2 = false;
7897 for (let i4 = 0; i4 < o2 + a2; i4++) {
7898 for (let s4 = 0; s4 < n2; s4++) {
7899 const r3 = s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3;
7900 if (0 !== e3.data[r3]) {
7901 t3.left = i4, h2 = true;
7902 break;
7903 }
7904 }
7905 if (h2) break;
7906 }
7907 t3.right = a2, h2 = false;
7908 for (let i4 = o2 + a2 - 1; i4 >= o2; i4--) {
7909 for (let s4 = 0; s4 < n2; s4++) {
7910 const r3 = s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3;
7911 if (0 !== e3.data[r3]) {
7912 t3.right = i4, h2 = true;
7913 break;
7914 }
7915 }
7916 if (h2) break;
7917 }
7918 t3.bottom = n2, h2 = false;
7919 for (let i4 = n2 - 1; i4 >= 0; i4--) {
7920 for (let s4 = 0; s4 < a2; s4++) {
7921 const r3 = i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3;
7922 if (0 !== e3.data[r3]) {
7923 t3.bottom = i4, h2 = true;
7924 break;
7925 }
7926 }
7927 if (h2) break;
7928 }
7929 return { texturePage: 0, texturePosition: { x: 0, y: 0 }, texturePositionClipSpace: { x: 0, y: 0 }, size: { x: t3.right - t3.left + 1, y: t3.bottom - t3.top + 1 }, sizeClipSpace: { x: t3.right - t3.left + 1, y: t3.bottom - t3.top + 1 }, offset: { x: -t3.left + o2 + (s3 || r2 ? Math.floor((this._config.deviceCellWidth - this._config.deviceCharWidth) / 2) : 0), y: -t3.top + o2 + (s3 || r2 ? 1 === this._config.lineHeight ? 0 : Math.round((this._config.deviceCellHeight - this._config.deviceCharHeight) / 2) : 0) } };
7930 }

Callers 1

_drawToCacheMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected