package androidx.compose.ui.res; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.TypedValue; import androidx.compose.runtime.Composer; import androidx.compose.runtime.ComposerKt; import androidx.compose.runtime.ProvidableCompositionLocal; import androidx.compose.ui.graphics.AndroidImageBitmap_androidKt; import androidx.compose.ui.graphics.ImageBitmap; import androidx.compose.ui.platform.AndroidCompositionLocals_androidKt; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; /* compiled from: ImageResources.android.kt */ @Metadata(d1 = {"\u0000\u001a\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\u001a\u001c\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00042\b\b\u0001\u0010\u0005\u001a\u00020\u0006\u001a\u001b\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\b\b\u0001\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\u0010\u0007¨\u0006\b"}, d2 = {"imageResource", "Landroidx/compose/ui/graphics/ImageBitmap;", "Landroidx/compose/ui/graphics/ImageBitmap$Companion;", "res", "Landroid/content/res/Resources;", "id", "", "(Landroidx/compose/ui/graphics/ImageBitmap$Companion;ILandroidx/compose/runtime/Composer;I)Landroidx/compose/ui/graphics/ImageBitmap;", "ui_release"}, k = 2, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class ImageResources_androidKt { public static final ImageBitmap imageResource(ImageBitmap.Companion companion, Resources res, int i) { Intrinsics.checkNotNullParameter(companion, ""); Intrinsics.checkNotNullParameter(res, "res"); Drawable drawable = res.getDrawable(i, null); Intrinsics.checkNotNull(drawable, "null cannot be cast to non-null type android.graphics.drawable.BitmapDrawable"); Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); Intrinsics.checkNotNullExpressionValue(bitmap, "res.getDrawable(id, null…as BitmapDrawable).bitmap"); return AndroidImageBitmap_androidKt.asImageBitmap(bitmap); } public static final ImageBitmap imageResource(ImageBitmap.Companion companion, int i, Composer composer, int i2) { Intrinsics.checkNotNullParameter(companion, ""); composer.startReplaceableGroup(-304919470); ComposerKt.sourceInformation(composer, "C(imageResource)53@2046L7,54@2070L25,57@2238L54:ImageResources.android.kt#ccshc7"); if (ComposerKt.isTraceInProgress()) { ComposerKt.traceEventStart(-304919470, i2, -1, "androidx.compose.ui.res.imageResource (ImageResources.android.kt:52)"); } ProvidableCompositionLocal localContext = AndroidCompositionLocals_androidKt.getLocalContext(); ComposerKt.sourceInformationMarkerStart(composer, 2023513938, "CC:CompositionLocal.kt#9igjgp"); Object consume = composer.consume(localContext); ComposerKt.sourceInformationMarkerEnd(composer); Context context = (Context) consume; composer.startReplaceableGroup(-492369756); ComposerKt.sourceInformation(composer, "CC(remember):Composables.kt#9igjgp"); Object rememberedValue = composer.rememberedValue(); if (rememberedValue == Composer.INSTANCE.getEmpty()) { rememberedValue = new TypedValue(); composer.updateRememberedValue(rememberedValue); } composer.endReplaceableGroup(); TypedValue typedValue = (TypedValue) rememberedValue; context.getResources().getValue(i, typedValue, true); CharSequence charSequence = typedValue.string; Intrinsics.checkNotNull(charSequence); String obj = charSequence.toString(); composer.startReplaceableGroup(1157296644); ComposerKt.sourceInformation(composer, "CC(remember)P(1):Composables.kt#9igjgp"); boolean changed = composer.changed(obj); Object rememberedValue2 = composer.rememberedValue(); if (changed || rememberedValue2 == Composer.INSTANCE.getEmpty()) { Resources resources = context.getResources(); Intrinsics.checkNotNullExpressionValue(resources, "context.resources"); rememberedValue2 = imageResource(companion, resources, i); composer.updateRememberedValue(rememberedValue2); } composer.endReplaceableGroup(); ImageBitmap imageBitmap = (ImageBitmap) rememberedValue2; if (ComposerKt.isTraceInProgress()) { ComposerKt.traceEventEnd(); } composer.endReplaceableGroup(); return imageBitmap; } }