package com.ss.android.ugc.aweme.editSticker.model;

import X.2HN;
import X.AnonymousClass6T0;
import X.M12;
import android.os.Parcel;
import android.os.Parcelable;
import com.bytedance.covode.number.Covode;
import com.google.gson.a.c;
import java.io.Serializable;

public class EffectTextModel implements Parcelable, Serializable {
    public static final Parcelable.Creator<EffectTextModel> CREATOR = new AnonymousClass6T0();
    @c(LIZ = "cover_frame_index")
    public Integer coverFrameIndex;
    @c(LIZ = "cover_select_from")
    public String coverSelectedFrom;
    @c(LIZ = "create_aweme_cover_info")
    public CreateAwemeCoverInfo createAwemeCoverInfo;
    @c(LIZ = "has_cover_text")
    public boolean hasCoverText;
    @c(LIZ = "text_sticker")
    public StickerItemModel textSticker;

    static {
        Covode.recordClassIndex(73524);
    }

    public EffectTextModel() {
        this(false, (StickerItemModel) null, (CreateAwemeCoverInfo) null, (String) null, (Integer) null, 31, (2HN) null);
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i) {
        M12.LIZ(parcel);
        parcel.writeInt(this.hasCoverText ? 1 : 0);
        parcel.writeParcelable(this.textSticker, i);
        CreateAwemeCoverInfo createAwemeCoverInfo2 = this.createAwemeCoverInfo;
        if (createAwemeCoverInfo2 != null) {
            parcel.writeInt(1);
            createAwemeCoverInfo2.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        parcel.writeString(this.coverSelectedFrom);
        Integer num = this.coverFrameIndex;
        if (num != null) {
            parcel.writeInt(1);
            parcel.writeInt(num.intValue());
            return;
        }
        parcel.writeInt(0);
    }

    public final Integer getCoverFrameIndex() {
        return this.coverFrameIndex;
    }

    public final String getCoverSelectedFrom() {
        return this.coverSelectedFrom;
    }

    public final CreateAwemeCoverInfo getCreateAwemeCoverInfo() {
        return this.createAwemeCoverInfo;
    }

    public final boolean getHasCoverText() {
        return this.hasCoverText;
    }

    public final StickerItemModel getTextSticker() {
        return this.textSticker;
    }

    public final void reset() {
        this.hasCoverText = false;
        this.textSticker = null;
        this.createAwemeCoverInfo = null;
    }

    public final boolean isCoverTextValid() {
        StickerItemModel stickerItemModel;
        String str;
        if (!this.hasCoverText || (stickerItemModel = this.textSticker) == null || (str = stickerItemModel.path) == null || str.length() == 0) {
            return false;
        }
        return true;
    }

    public final void setCoverFrameIndex(Integer num) {
        this.coverFrameIndex = num;
    }

    public final void setCoverSelectedFrom(String str) {
        this.coverSelectedFrom = str;
    }

    public final void setCreateAwemeCoverInfo(CreateAwemeCoverInfo createAwemeCoverInfo2) {
        this.createAwemeCoverInfo = createAwemeCoverInfo2;
    }

    public final void setHasCoverText(boolean z) {
        this.hasCoverText = z;
    }

    public final void setTextSticker(StickerItemModel stickerItemModel) {
        this.textSticker = stickerItemModel;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:24:0x00f9, code lost:
        if (r8 == null) goto L_0x00fb;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final android.graphics.Bitmap mergeCoverText(android.graphics.Bitmap r14) {
        /*
            r13 = this;
            r12 = 6851(0x1ac3, float:9.6E-42)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r12)
            X.M12.LIZ(r14)
            boolean r0 = r13.hasCoverText
            if (r0 == 0) goto L_0x011a
            com.ss.android.ugc.aweme.editSticker.model.StickerItemModel r3 = r13.textSticker
            if (r3 == 0) goto L_0x011a
            int r2 = r14.getWidth()     // Catch:{ Exception -> 0x011a }
            java.lang.String r0 = r3.path     // Catch:{ Exception -> 0x011a }
            X.Cwu r4 = X.C34016Tv.LIZ(r0)     // Catch:{ Exception -> 0x011a }
            int r1 = r14.getWidth()     // Catch:{ Exception -> 0x011a }
            int r0 = r14.getHeight()     // Catch:{ Exception -> 0x011a }
            r11 = 0
            if (r1 <= r0) goto L_0x003d
            java.lang.Object r0 = r4.getSecond()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            int r1 = r0.intValue()     // Catch:{ Exception -> 0x011a }
            java.lang.Object r0 = r4.getFirst()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            int r0 = r0.intValue()     // Catch:{ Exception -> 0x011a }
            if (r1 <= r0) goto L_0x003d
            r1 = 1
            goto L_0x003e
        L_0x003d:
            r1 = 0
        L_0x003e:
            java.lang.Object r0 = r4.getFirst()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            int r0 = r0.intValue()     // Catch:{ Exception -> 0x011a }
            java.lang.String r7 = ""
            if (r0 == 0) goto L_0x0100
            java.lang.Object r0 = r4.getSecond()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            int r0 = r0.intValue()     // Catch:{ Exception -> 0x011a }
            if (r0 == 0) goto L_0x0100
            if (r1 == 0) goto L_0x0100
            float r1 = (float) r2     // Catch:{ Exception -> 0x011a }
            java.lang.Object r0 = r4.getSecond()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            int r0 = r0.intValue()     // Catch:{ Exception -> 0x011a }
            float r0 = (float) r0     // Catch:{ Exception -> 0x011a }
            float r1 = r1 * r0
            java.lang.Object r0 = r4.getFirst()     // Catch:{ Exception -> 0x011a }
            java.lang.Number r0 = (java.lang.Number) r0     // Catch:{ Exception -> 0x011a }
            float r0 = r0.floatValue()     // Catch:{ Exception -> 0x011a }
            float r1 = r1 / r0
            int r1 = (int) r1     // Catch:{ Exception -> 0x011a }
            java.lang.String r0 = r3.path     // Catch:{ Exception -> 0x011a }
            kotlin.h.b.n.LIZIZ(r0, r7)     // Catch:{ Exception -> 0x011a }
            android.graphics.Bitmap r10 = X.C34016Tv.LIZ((java.lang.String) r0, (int) r2, (int) r1)     // Catch:{ Exception -> 0x011a }
            if (r10 == 0) goto L_0x00fb
            android.graphics.Paint r9 = new android.graphics.Paint     // Catch:{ Exception -> 0x011a }
            r1 = 2
            r9.<init>(r1)     // Catch:{ Exception -> 0x011a }
            android.graphics.Paint r4 = new android.graphics.Paint     // Catch:{ Exception -> 0x011a }
            r4.<init>()     // Catch:{ Exception -> 0x011a }
            r0 = -16777216(0xffffffffff000000, float:-1.7014118E38)
            r4.setColor(r0)     // Catch:{ Exception -> 0x011a }
            int r3 = r10.getWidth()     // Catch:{ Exception -> 0x011a }
            int r2 = r10.getHeight()     // Catch:{ Exception -> 0x011a }
            android.graphics.Bitmap$Config r0 = r10.getConfig()     // Catch:{ Exception -> 0x011a }
            android.graphics.Bitmap r8 = android.graphics.Bitmap.createBitmap(r3, r2, r0)     // Catch:{ Exception -> 0x011a }
            android.graphics.Canvas r6 = new android.graphics.Canvas     // Catch:{ Exception -> 0x011a }
            r6.<init>(r8)     // Catch:{ Exception -> 0x011a }
            android.graphics.Rect r5 = new android.graphics.Rect     // Catch:{ Exception -> 0x011a }
            int r2 = r10.getWidth()     // Catch:{ Exception -> 0x011a }
            int r0 = r10.getHeight()     // Catch:{ Exception -> 0x011a }
            r5.<init>(r11, r11, r2, r0)     // Catch:{ Exception -> 0x011a }
            r6.drawRect(r5, r4)     // Catch:{ Exception -> 0x011a }
            int r2 = r14.getHeight()     // Catch:{ Exception -> 0x011a }
            int r0 = r10.getHeight()     // Catch:{ Exception -> 0x011a }
            if (r2 >= r0) goto L_0x00f3
            int r0 = r14.getHeight()     // Catch:{ Exception -> 0x011a }
            float r2 = (float) r0     // Catch:{ Exception -> 0x011a }
            int r0 = r14.getWidth()     // Catch:{ Exception -> 0x011a }
            float r0 = (float) r0     // Catch:{ Exception -> 0x011a }
            float r2 = r2 / r0
            int r0 = r10.getWidth()     // Catch:{ Exception -> 0x011a }
            float r0 = (float) r0     // Catch:{ Exception -> 0x011a }
            float r2 = r2 * r0
            int r0 = (int) r2     // Catch:{ Exception -> 0x011a }
            int r4 = r10.getHeight()     // Catch:{ Exception -> 0x011a }
            int r4 = r4 - r0
            int r4 = r4 / r1
            android.graphics.Rect r3 = new android.graphics.Rect     // Catch:{ Exception -> 0x011a }
            int r1 = r14.getWidth()     // Catch:{ Exception -> 0x011a }
            int r0 = r14.getHeight()     // Catch:{ Exception -> 0x011a }
            r3.<init>(r11, r11, r1, r0)     // Catch:{ Exception -> 0x011a }
            android.graphics.Rect r2 = new android.graphics.Rect     // Catch:{ Exception -> 0x011a }
            int r1 = r10.getWidth()     // Catch:{ Exception -> 0x011a }
            int r0 = r10.getHeight()     // Catch:{ Exception -> 0x011a }
            int r0 = r0 - r4
            r2.<init>(r11, r4, r1, r0)     // Catch:{ Exception -> 0x011a }
            r6.drawBitmap(r14, r3, r2, r9)     // Catch:{ Exception -> 0x011a }
        L_0x00f3:
            r6.drawBitmap(r10, r5, r5, r9)     // Catch:{ Exception -> 0x011a }
            kotlin.h.b.n.LIZIZ(r8, r7)     // Catch:{ Exception -> 0x011a }
            if (r8 != 0) goto L_0x00fc
        L_0x00fb:
            r8 = r14
        L_0x00fc:
            X.C38016dr.LIZ((android.graphics.Bitmap) r10)     // Catch:{ Exception -> 0x011a }
            goto L_0x0119
        L_0x0100:
            java.lang.String r1 = r3.path     // Catch:{ Exception -> 0x011a }
            kotlin.h.b.n.LIZIZ(r1, r7)     // Catch:{ Exception -> 0x011a }
            int r0 = r14.getHeight()     // Catch:{ Exception -> 0x011a }
            android.graphics.Bitmap r1 = X.C34016Tv.LIZ((java.lang.String) r1, (int) r2, (int) r0)     // Catch:{ Exception -> 0x011a }
            android.graphics.Bitmap r0 = X.C38016dr.LIZ((android.graphics.Bitmap) r14, (android.graphics.Bitmap) r1)     // Catch:{ Exception -> 0x011a }
            X.C38016dr.LIZ((android.graphics.Bitmap) r1)     // Catch:{ Exception -> 0x011a }
            kotlin.h.b.n.LIZIZ(r0, r7)     // Catch:{ Exception -> 0x011a }
            r14 = r0
            goto L_0x011a
        L_0x0119:
            r14 = r8
        L_0x011a:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r12)
            return r14
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.editSticker.model.EffectTextModel.mergeCoverText(android.graphics.Bitmap):android.graphics.Bitmap");
    }

    public EffectTextModel(boolean z, StickerItemModel stickerItemModel, CreateAwemeCoverInfo createAwemeCoverInfo2, String str, Integer num) {
        this.hasCoverText = z;
        this.textSticker = stickerItemModel;
        this.createAwemeCoverInfo = createAwemeCoverInfo2;
        this.coverSelectedFrom = str;
        this.coverFrameIndex = num;
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public /* synthetic */ EffectTextModel(boolean z, StickerItemModel stickerItemModel, CreateAwemeCoverInfo createAwemeCoverInfo2, String str, Integer num, int i, 2HN r13) {
        this((i & 1) != 0 ? false : z, (i & 2) != 0 ? null : stickerItemModel, (i & 4) != 0 ? null : createAwemeCoverInfo2, (i & 8) != 0 ? null : str, (i & 16) == 0 ? num : null);
    }
}
