(e3, t3, i3, n2, a2 = false)
| 7755 | return d2.setColor(e3, s3, f2), f2; |
| 7756 | } |
| 7757 | _getContrastCache(e3) { |
| 7758 | return e3 ? this._config.colors.halfContrastCache : this._config.colors.contrastCache; |
| 7759 | } |
| 7760 | _drawToCache(e3, t3, i3, n2, a2 = false) { |
| 7761 | const h2 = "number" == typeof e3 ? String.fromCharCode(e3) : e3, l2 = Math.min(this._config.deviceCellWidth * Math.max(h2.length, 2) + 4, this._textureSize); |
| 7762 | this._tmpCanvas.width < l2 && (this._tmpCanvas.width = l2); |
| 7763 | const d2 = Math.min(this._config.deviceCellHeight + 8, this._textureSize); |
| 7764 | if (this._tmpCanvas.height < d2 && (this._tmpCanvas.height = d2), this._tmpCtx.save(), this._workAttributeData.fg = i3, this._workAttributeData.bg = t3, this._workAttributeData.extended.ext = n2, this._workAttributeData.isInvisible()) return _; |
| 7765 | const u2 = !!this._workAttributeData.isBold(), v2 = !!this._workAttributeData.isInverse(), p2 = !!this._workAttributeData.isDim(), C = !!this._workAttributeData.isItalic(), m = !!this._workAttributeData.isUnderline(), L = !!this._workAttributeData.isStrikethrough(), x = !!this._workAttributeData.isOverline(); |
| 7766 | let w = this._workAttributeData.getFgColor(), b = this._workAttributeData.getFgColorMode(), M = this._workAttributeData.getBgColor(), R = this._workAttributeData.getBgColorMode(); |
| 7767 | if (v2) { |
| 7768 | const e4 = w; |
| 7769 | w = M, M = e4; |
| 7770 | const t4 = b; |
| 7771 | b = R, R = t4; |
| 7772 | } |
| 7773 | const y = this._getBackgroundColor(R, M, v2, p2); |
| 7774 | this._tmpCtx.globalCompositeOperation = "copy", this._tmpCtx.fillStyle = y.css, this._tmpCtx.fillRect(0, 0, this._tmpCanvas.width, this._tmpCanvas.height), this._tmpCtx.globalCompositeOperation = "source-over"; |
| 7775 | const A = u2 ? this._config.fontWeightBold : this._config.fontWeight, E = C ? "italic" : ""; |
| 7776 | this._tmpCtx.font = `${E} ${A} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`, this._tmpCtx.textBaseline = s2.TEXT_BASELINE; |
| 7777 | const S = 1 === h2.length && (0, o.isPowerlineGlyph)(h2.charCodeAt(0)), T = 1 === h2.length && (0, o.isRestrictedPowerlineGlyph)(h2.charCodeAt(0)), D = this._getForegroundColor(t3, R, M, i3, b, w, v2, p2, u2, (0, o.treatGlyphAsBackgroundColor)(h2.charCodeAt(0))); |
| 7778 | this._tmpCtx.fillStyle = D.css; |
| 7779 | const B = T ? 0 : 4; |
| 7780 | let F = false; |
| 7781 | false !== this._config.customGlyphs && (F = (0, r.tryDrawCustomChar)(this._tmpCtx, h2, B, B, this._config.deviceCellWidth, this._config.deviceCellHeight, this._config.fontSize, this._config.devicePixelRatio)); |
| 7782 | let P, I = !S; |
| 7783 | if (P = "number" == typeof e3 ? this._unicodeService.wcwidth(e3) : this._unicodeService.getStringCellWidth(e3), m) { |
| 7784 | this._tmpCtx.save(); |
| 7785 | const e4 = Math.max(1, Math.floor(this._config.fontSize * this._config.devicePixelRatio / 15)), t4 = e4 % 2 == 1 ? 0.5 : 0; |
| 7786 | if (this._tmpCtx.lineWidth = e4, this._workAttributeData.isUnderlineColorDefault()) this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; |
| 7787 | else if (this._workAttributeData.isUnderlineColorRGB()) I = false, this._tmpCtx.strokeStyle = `rgb(${c.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`; |
| 7788 | else { |
| 7789 | I = false; |
| 7790 | let e5 = this._workAttributeData.getUnderlineColor(); |
| 7791 | this._config.drawBoldTextInBrightColors && this._workAttributeData.isBold() && e5 < 8 && (e5 += 8), this._tmpCtx.strokeStyle = this._getColorFromAnsiIndex(e5).css; |
| 7792 | } |
| 7793 | this._tmpCtx.beginPath(); |
| 7794 | const i4 = B, s3 = Math.ceil(B + this._config.deviceCharHeight) - t4 - (a2 ? 2 * e4 : 0), r2 = s3 + e4, n3 = s3 + 2 * e4; |
| 7795 | let l3 = this._workAttributeData.getUnderlineVariantOffset(); |
| 7796 | for (let a3 = 0; a3 < P; a3++) { |
| 7797 | this._tmpCtx.save(); |
| 7798 | const h3 = i4 + a3 * this._config.deviceCellWidth, c2 = i4 + (a3 + 1) * this._config.deviceCellWidth, d3 = h3 + this._config.deviceCellWidth / 2; |
| 7799 | switch (this._workAttributeData.extended.underlineStyle) { |
| 7800 | case 2: |
| 7801 | this._tmpCtx.moveTo(h3, s3), this._tmpCtx.lineTo(c2, s3), this._tmpCtx.moveTo(h3, n3), this._tmpCtx.lineTo(c2, n3); |
| 7802 | break; |
| 7803 | case 3: |
| 7804 | const i5 = e4 <= 1 ? n3 : Math.ceil(B + this._config.deviceCharHeight - e4 / 2) - t4, a4 = e4 <= 1 ? s3 : Math.ceil(B + this._config.deviceCharHeight + e4 / 2) - t4, _2 = new Path2D(); |
| 7805 | _2.rect(h3, s3, this._config.deviceCellWidth, n3 - s3), this._tmpCtx.clip(_2), this._tmpCtx.moveTo(h3 - this._config.deviceCellWidth / 2, r2), this._tmpCtx.bezierCurveTo(h3 - this._config.deviceCellWidth / 2, a4, h3, a4, h3, r2), this._tmpCtx.bezierCurveTo(h3, i5, d3, i5, d3, r2), this._tmpCtx.bezierCurveTo(d3, a4, c2, a4, c2, r2), this._tmpCtx.bezierCurveTo(c2, i5, c2 + this._config.deviceCellWidth / 2, i5, c2 + this._config.deviceCellWidth / 2, r2); |
| 7806 | break; |
| 7807 | case 4: |
| 7808 | const u3 = 0 === l3 ? 0 : l3 >= e4 ? 2 * e4 - l3 : e4 - l3; |
| 7809 | false == !(l3 >= e4) || 0 === u3 ? (this._tmpCtx.setLineDash([Math.round(e4), Math.round(e4)]), this._tmpCtx.moveTo(h3 + u3, s3), this._tmpCtx.lineTo(c2, s3)) : (this._tmpCtx.setLineDash([Math.round(e4), Math.round(e4)]), this._tmpCtx.moveTo(h3, s3), this._tmpCtx.lineTo(h3 + u3, s3), this._tmpCtx.moveTo(h3 + u3 + e4, s3), this._tmpCtx.lineTo(c2, s3)), l3 = (0, o.computeNextVariantOffset)(c2 - h3, e4, l3); |
| 7810 | break; |
| 7811 | case 5: |
| 7812 | const g2 = 0.6, v3 = 0.3, f2 = c2 - h3, p3 = Math.floor(g2 * f2), C2 = Math.floor(v3 * f2), m2 = f2 - p3 - C2; |
| 7813 | this._tmpCtx.setLineDash([p3, C2, m2]), this._tmpCtx.moveTo(h3, s3), this._tmpCtx.lineTo(c2, s3); |
| 7814 | break; |
no test coverage detected