导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - LineChartRenderer.java 源代码

正在查看: Perplexity v2.48.1 应用的 LineChartRenderer.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.github.mikephil.charting.renderer;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import com.github.mikephil.charting.animation.ChartAnimator;
import com.github.mikephil.charting.data.BaseEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.renderer.BarLineScatterCandleBubbleRenderer;
import com.github.mikephil.charting.utils.MPPointD;
import com.github.mikephil.charting.utils.MPPointF;
import com.github.mikephil.charting.utils.Transformer;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.ViewPortHandler;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;

public class LineChartRenderer extends LineRadarRenderer {
    protected Path cubicFillPath;
    protected Path cubicPath;
    protected Canvas mBitmapCanvas;
    protected Bitmap.Config mBitmapConfig;
    protected LineDataProvider mChart;
    protected Paint mCirclePaintInner;
    private final float[] mCirclesBuffer;
    protected WeakReference<Bitmap> mDrawBitmap;
    protected Path mGenerateFilledPathBuffer;
    private final HashMap<IDataSet, DataSetImageCache> mImageCaches;
    private float[] mLineBuffer;

    public static class AnonymousClass1 {
        static final int[] $SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode;

        static {
            int[] iArr = new int[LineDataSet.Mode.values().length];
            $SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode = iArr;
            try {
                iArr[LineDataSet.Mode.LINEAR.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode[LineDataSet.Mode.STEPPED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode[LineDataSet.Mode.CUBIC_BEZIER.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode[LineDataSet.Mode.HORIZONTAL_BEZIER.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public class DataSetImageCache {
        private Bitmap[] circleBitmaps;
        private final Path mCirclePathBuffer;

        public DataSetImageCache(LineChartRenderer lineChartRenderer, int i) {
            this();
        }

        public void fill(ILineDataSet iLineDataSet, boolean z, boolean z2) {
            int circleColorCount = iLineDataSet.getCircleColorCount();
            float circleRadius = iLineDataSet.getCircleRadius();
            float circleHoleRadius = iLineDataSet.getCircleHoleRadius();
            for (int i = 0; i < circleColorCount; i++) {
                int i2 = (int) (circleRadius * 2.1d);
                Bitmap createBitmap = Bitmap.createBitmap(i2, i2, Bitmap.Config.ARGB_4444);
                Canvas canvas = new Canvas(createBitmap);
                this.circleBitmaps[i] = createBitmap;
                LineChartRenderer.this.mRenderPaint.setColor(iLineDataSet.getCircleColor(i));
                if (z2) {
                    this.mCirclePathBuffer.reset();
                    this.mCirclePathBuffer.addCircle(circleRadius, circleRadius, circleRadius, Path.Direction.CW);
                    this.mCirclePathBuffer.addCircle(circleRadius, circleRadius, circleHoleRadius, Path.Direction.CCW);
                    canvas.drawPath(this.mCirclePathBuffer, LineChartRenderer.this.mRenderPaint);
                } else {
                    canvas.drawCircle(circleRadius, circleRadius, circleRadius, LineChartRenderer.this.mRenderPaint);
                    if (z) {
                        canvas.drawCircle(circleRadius, circleRadius, circleHoleRadius, LineChartRenderer.this.mCirclePaintInner);
                    }
                }
            }
        }

        public Bitmap getBitmap(int i) {
            Bitmap[] bitmapArr = this.circleBitmaps;
            return bitmapArr[i % bitmapArr.length];
        }

        public boolean init(ILineDataSet iLineDataSet) {
            int circleColorCount = iLineDataSet.getCircleColorCount();
            Bitmap[] bitmapArr = this.circleBitmaps;
            if (bitmapArr == null) {
                this.circleBitmaps = new Bitmap[circleColorCount];
                return true;
            }
            if (bitmapArr.length == circleColorCount) {
                return false;
            }
            this.circleBitmaps = new Bitmap[circleColorCount];
            return true;
        }

        private DataSetImageCache() {
            this.mCirclePathBuffer = new Path();
        }
    }

    public LineChartRenderer(LineDataProvider lineDataProvider, ChartAnimator chartAnimator, ViewPortHandler viewPortHandler) {
        super(chartAnimator, viewPortHandler);
        this.mBitmapConfig = Bitmap.Config.ARGB_8888;
        this.cubicPath = new Path();
        this.cubicFillPath = new Path();
        this.mLineBuffer = new float[4];
        this.mGenerateFilledPathBuffer = new Path();
        this.mImageCaches = new HashMap<>();
        this.mCirclesBuffer = new float[2];
        this.mChart = lineDataProvider;
        Paint paint = new Paint(1);
        this.mCirclePaintInner = paint;
        paint.setStyle(Paint.Style.FILL);
        this.mCirclePaintInner.setColor(-1);
    }

    private void generateFilledPath(ILineDataSet iLineDataSet, int i, int i2, Path path) {
        float fillLinePosition = iLineDataSet.getFillFormatter().getFillLinePosition(iLineDataSet, this.mChart);
        float phaseY = this.mAnimator.getPhaseY();
        boolean z = iLineDataSet.getMode() == LineDataSet.Mode.STEPPED;
        path.reset();
        ?? entryForIndex = iLineDataSet.getEntryForIndex(i);
        path.moveTo(entryForIndex.get_x(), fillLinePosition);
        path.lineTo(entryForIndex.get_x(), entryForIndex.get_y() * phaseY);
        int i3 = i + 1;
        Entry entry = null;
        BaseEntry baseEntry = entryForIndex;
        while (i3 <= i2) {
            ?? entryForIndex2 = iLineDataSet.getEntryForIndex(i3);
            if (entryForIndex2 != 0) {
                if (z) {
                    path.lineTo(entryForIndex2.get_x(), baseEntry.get_y() * phaseY);
                }
                path.lineTo(entryForIndex2.get_x(), entryForIndex2.get_y() * phaseY);
                baseEntry = entryForIndex2;
            }
            i3++;
            baseEntry = baseEntry;
            entry = entryForIndex2;
        }
        if (entry != null) {
            path.lineTo(entry.get_x(), fillLinePosition);
        }
        path.close();
    }

    public void drawCircles(Canvas canvas) {
        DataSetImageCache dataSetImageCache;
        Bitmap bitmap;
        this.mRenderPaint.setStyle(Paint.Style.FILL);
        float phaseY = this.mAnimator.getPhaseY();
        float[] fArr = this.mCirclesBuffer;
        int i = 0;
        float f = 0.0f;
        fArr[0] = 0.0f;
        fArr[1] = 0.0f;
        List<T> dataSets = this.mChart.getLineData().getDataSets();
        int i2 = 0;
        while (i2 < dataSets.size()) {
            ILineDataSet iLineDataSet = (ILineDataSet) dataSets.get(i2);
            if (iLineDataSet.isVisible() && iLineDataSet.isDrawCirclesEnabled() && iLineDataSet.getEntryCount() != 0) {
                this.mCirclePaintInner.setColor(iLineDataSet.getCircleHoleColor());
                Transformer transformer = this.mChart.getTransformer(iLineDataSet.getAxisDependency());
                this.mXBounds.set(this.mChart, iLineDataSet);
                float circleRadius = iLineDataSet.getCircleRadius();
                float circleHoleRadius = iLineDataSet.getCircleHoleRadius();
                boolean z = (!iLineDataSet.isDrawCircleHoleEnabled() || circleHoleRadius >= circleRadius || circleHoleRadius <= f) ? i : 1;
                boolean z2 = (z == 0 || iLineDataSet.getCircleHoleColor() != 1122867) ? i : 1;
                if (this.mImageCaches.containsKey(iLineDataSet)) {
                    dataSetImageCache = this.mImageCaches.get(iLineDataSet);
                } else {
                    DataSetImageCache dataSetImageCache2 = new DataSetImageCache(this, i);
                    this.mImageCaches.put(iLineDataSet, dataSetImageCache2);
                    dataSetImageCache = dataSetImageCache2;
                }
                if (dataSetImageCache.init(iLineDataSet)) {
                    dataSetImageCache.fill(iLineDataSet, z, z2);
                }
                BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
                int i3 = xBounds.range;
                int i4 = xBounds.min;
                int i5 = i3 + i4;
                while (i4 <= i5) {
                    ?? entryForIndex = iLineDataSet.getEntryForIndex(i4);
                    if (entryForIndex == 0) {
                        break;
                    }
                    this.mCirclesBuffer[i] = entryForIndex.get_x();
                    this.mCirclesBuffer[1] = entryForIndex.get_y() * phaseY;
                    transformer.pointValuesToPixel(this.mCirclesBuffer);
                    if (!this.mViewPortHandler.isInBoundsRight(this.mCirclesBuffer[i])) {
                        break;
                    }
                    if (this.mViewPortHandler.isInBoundsLeft(this.mCirclesBuffer[i]) && this.mViewPortHandler.isInBoundsY(this.mCirclesBuffer[1]) && (bitmap = dataSetImageCache.getBitmap(i4)) != null) {
                        float[] fArr2 = this.mCirclesBuffer;
                        canvas.drawBitmap(bitmap, fArr2[i] - circleRadius, fArr2[1] - circleRadius, (Paint) null);
                    }
                    i4++;
                    i = 0;
                }
            }
            i2++;
            i = 0;
            f = 0.0f;
        }
    }

    public void drawCubicBezier(ILineDataSet iLineDataSet) {
        float phaseY = this.mAnimator.getPhaseY();
        Transformer transformer = this.mChart.getTransformer(iLineDataSet.getAxisDependency());
        this.mXBounds.set(this.mChart, iLineDataSet);
        float cubicIntensity = iLineDataSet.getCubicIntensity();
        this.cubicPath.reset();
        BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
        if (xBounds.range >= 1) {
            int i = xBounds.min;
            T entryForIndex = iLineDataSet.getEntryForIndex(Math.max(i - 1, 0));
            ?? entryForIndex2 = iLineDataSet.getEntryForIndex(Math.max(i, 0));
            if (entryForIndex2 != 0) {
                this.cubicPath.moveTo(entryForIndex2.get_x(), entryForIndex2.get_y() * phaseY);
                int i2 = this.mXBounds.min + 1;
                int i3 = -1;
                Entry entry = entryForIndex2;
                Entry entry2 = entryForIndex2;
                Entry entry3 = entryForIndex;
                while (true) {
                    BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
                    Entry entry4 = entry2;
                    if (i2 > xBounds2.range + xBounds2.min) {
                        break;
                    }
                    if (i3 != i2) {
                        entry4 = iLineDataSet.getEntryForIndex(i2);
                    }
                    int i4 = i2 + 1;
                    if (i4 < iLineDataSet.getEntryCount()) {
                        i2 = i4;
                    }
                    ?? entryForIndex3 = iLineDataSet.getEntryForIndex(i2);
                    this.cubicPath.cubicTo(entry.get_x() + ((entry4.get_x() - entry3.get_x()) * cubicIntensity), (entry.get_y() + ((entry4.get_y() - entry3.get_y()) * cubicIntensity)) * phaseY, entry4.get_x() - ((entryForIndex3.get_x() - entry.get_x()) * cubicIntensity), (entry4.get_y() - ((entryForIndex3.get_y() - entry.get_y()) * cubicIntensity)) * phaseY, entry4.get_x(), entry4.get_y() * phaseY);
                    int i5 = i2;
                    i2 = i4;
                    i3 = i5;
                    entry3 = entry;
                    entry = entry4;
                    entry2 = entryForIndex3;
                }
            } else {
                return;
            }
        }
        if (iLineDataSet.isDrawFilledEnabled()) {
            this.cubicFillPath.reset();
            this.cubicFillPath.addPath(this.cubicPath);
            drawCubicFill(this.mBitmapCanvas, iLineDataSet, this.cubicFillPath, transformer, this.mXBounds);
        }
        this.mRenderPaint.setColor(iLineDataSet.getColor());
        this.mRenderPaint.setStyle(Paint.Style.STROKE);
        transformer.pathValueToPixel(this.cubicPath);
        this.mBitmapCanvas.drawPath(this.cubicPath, this.mRenderPaint);
        this.mRenderPaint.setPathEffect(null);
    }

    public void drawCubicFill(Canvas canvas, ILineDataSet iLineDataSet, Path path, Transformer transformer, BarLineScatterCandleBubbleRenderer.XBounds xBounds) {
        float fillLinePosition = iLineDataSet.getFillFormatter().getFillLinePosition(iLineDataSet, this.mChart);
        path.lineTo(iLineDataSet.getEntryForIndex(xBounds.min + xBounds.range).get_x(), fillLinePosition);
        path.lineTo(iLineDataSet.getEntryForIndex(xBounds.min).get_x(), fillLinePosition);
        path.close();
        transformer.pathValueToPixel(path);
        Drawable fillDrawable = iLineDataSet.getFillDrawable();
        if (fillDrawable != null) {
            drawFilledPath(canvas, path, fillDrawable);
        } else {
            drawFilledPath(canvas, path, iLineDataSet.getFillColor(), iLineDataSet.getFillAlpha());
        }
    }

    @Override
    public void drawData(Canvas canvas) {
        int chartWidth = (int) this.mViewPortHandler.getChartWidth();
        int chartHeight = (int) this.mViewPortHandler.getChartHeight();
        WeakReference<Bitmap> weakReference = this.mDrawBitmap;
        Bitmap bitmap = weakReference == null ? null : weakReference.get();
        if (bitmap == null || bitmap.getWidth() != chartWidth || bitmap.getHeight() != chartHeight) {
            if (chartWidth <= 0 || chartHeight <= 0) {
                return;
            }
            bitmap = Bitmap.createBitmap(chartWidth, chartHeight, this.mBitmapConfig);
            this.mDrawBitmap = new WeakReference<>(bitmap);
            this.mBitmapCanvas = new Canvas(bitmap);
        }
        bitmap.eraseColor(0);
        for (T t : this.mChart.getLineData().getDataSets()) {
            if (t.isVisible()) {
                drawDataSet(canvas, t);
            }
        }
        canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.mRenderPaint);
    }

    public void drawDataSet(Canvas canvas, ILineDataSet iLineDataSet) {
        if (iLineDataSet.getEntryCount() < 1) {
            return;
        }
        this.mRenderPaint.setStrokeWidth(iLineDataSet.getLineWidth());
        this.mRenderPaint.setPathEffect(iLineDataSet.getDashPathEffect());
        int i = AnonymousClass1.$SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode[iLineDataSet.getMode().ordinal()];
        if (i == 3) {
            drawCubicBezier(iLineDataSet);
        } else if (i != 4) {
            drawLinear(canvas, iLineDataSet);
        } else {
            drawHorizontalBezier(iLineDataSet);
        }
        this.mRenderPaint.setPathEffect(null);
    }

    @Override
    public void drawExtras(Canvas canvas) {
        drawCircles(canvas);
    }

    @Override
    public void drawHighlighted(Canvas canvas, Highlight[] highlightArr) {
        LineData lineData = this.mChart.getLineData();
        for (Highlight highlight : highlightArr) {
            ILineDataSet iLineDataSet = (ILineDataSet) lineData.getDataSetByIndex(highlight.getDataSetIndex());
            if (iLineDataSet != null && iLineDataSet.isHighlightEnabled()) {
                ?? entryForXValue = iLineDataSet.getEntryForXValue(highlight.getX(), highlight.getY());
                if (isInBoundsX(entryForXValue, iLineDataSet)) {
                    MPPointD pixelForValues = this.mChart.getTransformer(iLineDataSet.getAxisDependency()).getPixelForValues(entryForXValue.get_x(), this.mAnimator.getPhaseY() * entryForXValue.get_y());
                    highlight.setDraw((float) pixelForValues.x, (float) pixelForValues.y);
                    drawHighlightLines(canvas, (float) pixelForValues.x, (float) pixelForValues.y, iLineDataSet);
                }
            }
        }
    }

    public void drawHorizontalBezier(ILineDataSet iLineDataSet) {
        float phaseY = this.mAnimator.getPhaseY();
        Transformer transformer = this.mChart.getTransformer(iLineDataSet.getAxisDependency());
        this.mXBounds.set(this.mChart, iLineDataSet);
        this.cubicPath.reset();
        BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
        if (xBounds.range >= 1) {
            ?? entryForIndex = iLineDataSet.getEntryForIndex(xBounds.min);
            this.cubicPath.moveTo(entryForIndex.get_x(), entryForIndex.get_y() * phaseY);
            int i = this.mXBounds.min + 1;
            Entry entry = entryForIndex;
            while (true) {
                BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
                if (i > xBounds2.range + xBounds2.min) {
                    break;
                }
                ?? entryForIndex2 = iLineDataSet.getEntryForIndex(i);
                float _xVar = ((entryForIndex2.get_x() - entry.get_x()) / 2.0f) + entry.get_x();
                this.cubicPath.cubicTo(_xVar, entry.get_y() * phaseY, _xVar, entryForIndex2.get_y() * phaseY, entryForIndex2.get_x(), entryForIndex2.get_y() * phaseY);
                i++;
                entry = entryForIndex2;
            }
        }
        if (iLineDataSet.isDrawFilledEnabled()) {
            this.cubicFillPath.reset();
            this.cubicFillPath.addPath(this.cubicPath);
            drawCubicFill(this.mBitmapCanvas, iLineDataSet, this.cubicFillPath, transformer, this.mXBounds);
        }
        this.mRenderPaint.setColor(iLineDataSet.getColor());
        this.mRenderPaint.setStyle(Paint.Style.STROKE);
        transformer.pathValueToPixel(this.cubicPath);
        this.mBitmapCanvas.drawPath(this.cubicPath, this.mRenderPaint);
        this.mRenderPaint.setPathEffect(null);
    }

    public void drawLinear(Canvas canvas, ILineDataSet iLineDataSet) {
        char c;
        char c2;
        int entryCount = iLineDataSet.getEntryCount();
        boolean isDrawSteppedEnabled = iLineDataSet.isDrawSteppedEnabled();
        char c3 = 4;
        char c4 = 2;
        int i = isDrawSteppedEnabled ? 4 : 2;
        Transformer transformer = this.mChart.getTransformer(iLineDataSet.getAxisDependency());
        float phaseY = this.mAnimator.getPhaseY();
        this.mRenderPaint.setStyle(Paint.Style.STROKE);
        Canvas canvas2 = iLineDataSet.isDashedLineEnabled() ? this.mBitmapCanvas : canvas;
        this.mXBounds.set(this.mChart, iLineDataSet);
        if (iLineDataSet.isDrawFilledEnabled() && entryCount > 0) {
            drawLinearFill(canvas, iLineDataSet, transformer, this.mXBounds);
        }
        if (iLineDataSet.getColors().size() > 1) {
            int i2 = i * 2;
            if (this.mLineBuffer.length <= i2) {
                this.mLineBuffer = new float[i * 4];
            }
            BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
            int i3 = xBounds.min;
            int i4 = xBounds.range + i3;
            while (i3 < i4) {
                ?? entryForIndex = iLineDataSet.getEntryForIndex(i3);
                if (entryForIndex == 0) {
                    c = c3;
                    c2 = c4;
                } else {
                    this.mLineBuffer[0] = entryForIndex.get_x();
                    this.mLineBuffer[1] = entryForIndex.get_y() * phaseY;
                    if (i3 < this.mXBounds.max) {
                        ?? entryForIndex2 = iLineDataSet.getEntryForIndex(i3 + 1);
                        if (entryForIndex2 == 0) {
                            break;
                        }
                        if (isDrawSteppedEnabled) {
                            this.mLineBuffer[c4] = entryForIndex2.get_x();
                            float[] fArr = this.mLineBuffer;
                            float f = fArr[1];
                            fArr[3] = f;
                            fArr[c3] = fArr[c4];
                            fArr[5] = f;
                            fArr[6] = entryForIndex2.get_x();
                            this.mLineBuffer[7] = entryForIndex2.get_y() * phaseY;
                        } else {
                            this.mLineBuffer[c4] = entryForIndex2.get_x();
                            this.mLineBuffer[3] = entryForIndex2.get_y() * phaseY;
                        }
                    } else {
                        float[] fArr2 = this.mLineBuffer;
                        fArr2[c4] = fArr2[0];
                        fArr2[3] = fArr2[1];
                    }
                    float[] fArr3 = this.mLineBuffer;
                    float f2 = fArr3[0];
                    float f3 = fArr3[1];
                    c = c3;
                    float f4 = fArr3[i2 - 2];
                    c2 = c4;
                    float f5 = fArr3[i2 - 1];
                    if (f2 != f4 || f3 != f5) {
                        transformer.pointValuesToPixel(fArr3);
                        if (!this.mViewPortHandler.isInBoundsRight(f2)) {
                            break;
                        }
                        if (this.mViewPortHandler.isInBoundsLeft(f4) && this.mViewPortHandler.isInBoundsTop(Math.max(f3, f5)) && this.mViewPortHandler.isInBoundsBottom(Math.min(f3, f5))) {
                            this.mRenderPaint.setColor(iLineDataSet.getColor(i3));
                            canvas2.drawLines(this.mLineBuffer, 0, i2, this.mRenderPaint);
                        }
                    }
                }
                i3++;
                c3 = c;
                c4 = c2;
            }
        } else {
            int i5 = entryCount * i;
            if (this.mLineBuffer.length < Math.max(i5, i) * 2) {
                this.mLineBuffer = new float[Math.max(i5, i) * 4];
            }
            if (iLineDataSet.getEntryForIndex(this.mXBounds.min) != 0) {
                int i6 = this.mXBounds.min;
                int i7 = 0;
                while (true) {
                    BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
                    if (i6 > xBounds2.range + xBounds2.min) {
                        break;
                    }
                    ?? entryForIndex3 = iLineDataSet.getEntryForIndex(i6 == 0 ? 0 : i6 - 1);
                    ?? entryForIndex4 = iLineDataSet.getEntryForIndex(i6);
                    if (entryForIndex3 != 0 && entryForIndex4 != 0) {
                        this.mLineBuffer[i7] = entryForIndex3.get_x();
                        int i8 = i7 + 2;
                        this.mLineBuffer[i7 + 1] = entryForIndex3.get_y() * phaseY;
                        if (isDrawSteppedEnabled) {
                            this.mLineBuffer[i8] = entryForIndex4.get_x();
                            this.mLineBuffer[i7 + 3] = entryForIndex3.get_y() * phaseY;
                            this.mLineBuffer[i7 + 4] = entryForIndex4.get_x();
                            i8 = i7 + 6;
                            this.mLineBuffer[i7 + 5] = entryForIndex3.get_y() * phaseY;
                        }
                        this.mLineBuffer[i8] = entryForIndex4.get_x();
                        this.mLineBuffer[i8 + 1] = entryForIndex4.get_y() * phaseY;
                        i7 = i8 + 2;
                    }
                    i6++;
                }
                if (i7 > 0) {
                    transformer.pointValuesToPixel(this.mLineBuffer);
                    int max = Math.max((this.mXBounds.range + 1) * i, i) * 2;
                    this.mRenderPaint.setColor(iLineDataSet.getColor());
                    canvas2.drawLines(this.mLineBuffer, 0, max, this.mRenderPaint);
                }
            }
        }
        this.mRenderPaint.setPathEffect(null);
    }

    public void drawLinearFill(Canvas canvas, ILineDataSet iLineDataSet, Transformer transformer, BarLineScatterCandleBubbleRenderer.XBounds xBounds) {
        int i;
        int min;
        int i2;
        int i3;
        Path path = this.mGenerateFilledPathBuffer;
        int i4 = xBounds.min;
        int i5 = xBounds.range + i4;
        int i6 = 0;
        do {
            i = (i6 * 128) + i4;
            min = Math.min(i + 128, i5);
            if (i <= min) {
                Drawable fillDrawable = iLineDataSet.getFillDrawable();
                if (fillDrawable != null) {
                    i2 = Math.max(0, i - 1);
                    i3 = Math.min(i5, min + 1);
                } else {
                    i2 = i;
                    i3 = min;
                }
                generateFilledPath(iLineDataSet, i2, i3, path);
                transformer.pathValueToPixel(path);
                if (fillDrawable != null) {
                    drawFilledPath(canvas, path, fillDrawable);
                } else {
                    drawFilledPath(canvas, path, iLineDataSet.getFillColor(), iLineDataSet.getFillAlpha());
                }
            }
            i6++;
        } while (i <= min);
    }

    @Override
    public void drawValues(Canvas canvas) {
        int i;
        int i2;
        int i3;
        LineChartRenderer lineChartRenderer = this;
        if (lineChartRenderer.isDrawingValuesAllowed(lineChartRenderer.mChart)) {
            List<T> dataSets = lineChartRenderer.mChart.getLineData().getDataSets();
            int i4 = 0;
            LineChartRenderer lineChartRenderer2 = lineChartRenderer;
            while (i4 < dataSets.size()) {
                ILineDataSet iLineDataSet = (ILineDataSet) dataSets.get(i4);
                if (iLineDataSet.getEntryCount() != 0 && lineChartRenderer2.shouldDrawValues(iLineDataSet) && iLineDataSet.getEntryCount() >= 1) {
                    lineChartRenderer2.applyValueTextStyle(iLineDataSet);
                    Transformer transformer = lineChartRenderer2.mChart.getTransformer(iLineDataSet.getAxisDependency());
                    int circleRadius = (int) (iLineDataSet.getCircleRadius() * 1.75f);
                    if (!iLineDataSet.isDrawCirclesEnabled()) {
                        circleRadius /= 2;
                    }
                    lineChartRenderer2.mXBounds.set(lineChartRenderer2.mChart, iLineDataSet);
                    float phaseX = lineChartRenderer2.mAnimator.getPhaseX();
                    float phaseY = lineChartRenderer2.mAnimator.getPhaseY();
                    BarLineScatterCandleBubbleRenderer.XBounds xBounds = lineChartRenderer2.mXBounds;
                    float[] generateTransformedValuesLine = transformer.generateTransformedValuesLine(iLineDataSet, phaseX, phaseY, xBounds.min, xBounds.max);
                    MPPointF mPPointF = MPPointF.getInstance(iLineDataSet.getIconsOffset());
                    mPPointF.x = Utils.convertDpToPixel(mPPointF.x);
                    mPPointF.y = Utils.convertDpToPixel(mPPointF.y);
                    int i5 = 0;
                    LineChartRenderer lineChartRenderer3 = lineChartRenderer2;
                    while (i5 < generateTransformedValuesLine.length) {
                        float f = generateTransformedValuesLine[i5];
                        float f2 = generateTransformedValuesLine[i5 + 1];
                        if (!lineChartRenderer3.mViewPortHandler.isInBoundsRight(f)) {
                            break;
                        }
                        if (lineChartRenderer3.mViewPortHandler.isInBoundsLeft(f) && lineChartRenderer3.mViewPortHandler.isInBoundsY(f2)) {
                            int i6 = i5 / 2;
                            Entry entryForIndex = iLineDataSet.getEntryForIndex(lineChartRenderer3.mXBounds.min + i6);
                            if (entryForIndex != null) {
                                if (iLineDataSet.isDrawValuesEnabled()) {
                                    i2 = circleRadius;
                                    lineChartRenderer3.drawValue(canvas, iLineDataSet.getValueFormatter(), entryForIndex.get_y(), entryForIndex, i4, f, f2 - circleRadius, iLineDataSet.getValueTextColor(i6));
                                } else {
                                    i2 = circleRadius;
                                }
                                i3 = i4;
                                if (entryForIndex.getIcon() != null && iLineDataSet.isDrawIconsEnabled()) {
                                    Drawable icon = entryForIndex.getIcon();
                                    Utils.drawImage(canvas, icon, (int) (f + mPPointF.x), (int) (f2 + mPPointF.y), icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
                                }
                                i5 += 2;
                                lineChartRenderer3 = this;
                                i4 = i3;
                                circleRadius = i2;
                            }
                        }
                        i2 = circleRadius;
                        i3 = i4;
                        i5 += 2;
                        lineChartRenderer3 = this;
                        i4 = i3;
                        circleRadius = i2;
                    }
                    i = i4;
                    MPPointF.recycleInstance(mPPointF);
                } else {
                    i = i4;
                }
                i4 = i + 1;
                lineChartRenderer2 = this;
            }
        }
    }

    public Bitmap.Config getBitmapConfig() {
        return this.mBitmapConfig;
    }

    @Override
    public void initBuffers() {
    }

    public void releaseBitmap() {
        Canvas canvas = this.mBitmapCanvas;
        if (canvas != null) {
            canvas.setBitmap(null);
            this.mBitmapCanvas = null;
        }
        WeakReference<Bitmap> weakReference = this.mDrawBitmap;
        if (weakReference != null) {
            Bitmap bitmap = weakReference.get();
            if (bitmap != null) {
                bitmap.recycle();
            }
            this.mDrawBitmap.clear();
            this.mDrawBitmap = null;
        }
    }

    public void setBitmapConfig(Bitmap.Config config) {
        this.mBitmapConfig = config;
        releaseBitmap();
    }
}