package androidx.compose.ui.text; import androidx.compose.ui.geometry.Offset; import androidx.compose.ui.geometry.Rect; import androidx.compose.ui.geometry.RectKt; import androidx.compose.ui.geometry.SizeKt; import androidx.compose.ui.graphics.Brush; import androidx.compose.ui.graphics.Canvas; import androidx.compose.ui.graphics.Color; import androidx.compose.ui.graphics.Shadow; import androidx.compose.ui.graphics.drawscope.DrawScope; import androidx.compose.ui.graphics.drawscope.DrawStyle; import androidx.compose.ui.graphics.drawscope.Fill; import androidx.compose.ui.text.style.TextDecoration; import androidx.compose.ui.text.style.TextForegroundStyle; import androidx.compose.ui.text.style.TextOverflow; import androidx.compose.ui.unit.IntSize; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; /* compiled from: TextPainter.kt */ @Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bÇ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b¨\u0006\t"}, d2 = {"Landroidx/compose/ui/text/TextPainter;", "", "()V", "paint", "", "canvas", "Landroidx/compose/ui/graphics/Canvas;", "textLayoutResult", "Landroidx/compose/ui/text/TextLayoutResult;", "ui-text_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class TextPainter { public static final int $stable = 0; public static final TextPainter INSTANCE = new TextPainter(); private TextPainter() { } public final void paint(Canvas canvas, TextLayoutResult textLayoutResult) { long m2665getBlack0d7_KjU; Intrinsics.checkNotNullParameter(canvas, "canvas"); Intrinsics.checkNotNullParameter(textLayoutResult, "textLayoutResult"); boolean z = textLayoutResult.getHasVisualOverflow() && !TextOverflow.m4817equalsimpl0(textLayoutResult.getLayoutInput().getOverflow(), TextOverflow.INSTANCE.m4826getVisiblegIe3tQ8()); if (z) { Rect m2440Recttz77jQw = RectKt.m2440Recttz77jQw(Offset.INSTANCE.m2416getZeroF1C5BW0(), SizeKt.Size(IntSize.m5043getWidthimpl(textLayoutResult.getSize()), IntSize.m5042getHeightimpl(textLayoutResult.getSize()))); canvas.save(); Canvas.m2612clipRectmtrdDE$default(canvas, m2440Recttz77jQw, 0, 2, null); } SpanStyle spanStyle = textLayoutResult.getLayoutInput().getStyle().getSpanStyle(); TextDecoration textDecoration = spanStyle.getTextDecoration(); if (textDecoration == null) { textDecoration = TextDecoration.INSTANCE.getNone(); } TextDecoration textDecoration2 = textDecoration; Shadow shadow = spanStyle.getShadow(); if (shadow == null) { shadow = Shadow.INSTANCE.getNone(); } Shadow shadow2 = shadow; Fill drawStyle = spanStyle.getDrawStyle(); if (drawStyle == null) { drawStyle = Fill.INSTANCE; } DrawStyle drawStyle2 = drawStyle; try { Brush brush = spanStyle.getBrush(); if (brush != null) { textLayoutResult.getMultiParagraph().m4306painthn5TExg(canvas, brush, (r17 & 4) != 0 ? Float.NaN : spanStyle.getTextForegroundStyle() != TextForegroundStyle.Unspecified.INSTANCE ? spanStyle.getTextForegroundStyle().getAlpha() : 1.0f, (r17 & 8) != 0 ? null : shadow2, (r17 & 16) != 0 ? null : textDecoration2, (r17 & 32) != 0 ? null : drawStyle2, (r17 & 64) != 0 ? DrawScope.INSTANCE.m3183getDefaultBlendMode0nO6VwU() : 0); } else { if (spanStyle.getTextForegroundStyle() != TextForegroundStyle.Unspecified.INSTANCE) { m2665getBlack0d7_KjU = spanStyle.getTextForegroundStyle().mo4684getColor0d7_KjU(); } else { m2665getBlack0d7_KjU = Color.INSTANCE.m2665getBlack0d7_KjU(); } textLayoutResult.getMultiParagraph().m4304paintLG529CI(canvas, (r14 & 2) != 0 ? Color.INSTANCE.m2675getUnspecified0d7_KjU() : m2665getBlack0d7_KjU, (r14 & 4) != 0 ? null : shadow2, (r14 & 8) != 0 ? null : textDecoration2, (r14 & 16) == 0 ? drawStyle2 : null, (r14 & 32) != 0 ? DrawScope.INSTANCE.m3183getDefaultBlendMode0nO6VwU() : 0); } } finally { if (z) { canvas.restore(); } } } }