正在查看: BetterTogether v3.0.0 应用的 LineChartRenderer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BetterTogether v3.0.0 应用的 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.formatter.ValueFormatter;
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 float[] mCirclesBuffer;
protected WeakReference<Bitmap> mDrawBitmap;
protected Path mGenerateFilledPathBuffer;
private 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 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 i10, int i11, Path path) {
float fillLinePosition = iLineDataSet.getFillFormatter().getFillLinePosition(iLineDataSet, this.mChart);
float phaseY = this.mAnimator.getPhaseY();
boolean z4 = iLineDataSet.getMode() == LineDataSet.Mode.STEPPED;
path.reset();
?? entryForIndex = iLineDataSet.getEntryForIndex(i10);
path.moveTo(entryForIndex.getX(), fillLinePosition);
path.lineTo(entryForIndex.getX(), entryForIndex.getY() * phaseY);
int i12 = i10 + 1;
Entry entry = null;
BaseEntry baseEntry = entryForIndex;
while (i12 <= i11) {
?? entryForIndex2 = iLineDataSet.getEntryForIndex(i12);
if (z4) {
path.lineTo(entryForIndex2.getX(), baseEntry.getY() * phaseY);
}
path.lineTo(entryForIndex2.getX(), entryForIndex2.getY() * phaseY);
i12++;
baseEntry = entryForIndex2;
entry = entryForIndex2;
}
if (entry != null) {
path.lineTo(entry.getX(), 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;
boolean z4 = false;
float f10 = 0.0f;
fArr[0] = 0.0f;
fArr[1] = 0.0f;
List dataSets = this.mChart.getLineData().getDataSets();
int i10 = 0;
while (i10 < dataSets.size()) {
ILineDataSet iLineDataSet = (ILineDataSet) dataSets.get(i10);
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 z10 = (!iLineDataSet.isDrawCircleHoleEnabled() || circleHoleRadius >= circleRadius || circleHoleRadius <= f10) ? z4 ? 1 : 0 : true;
boolean z11 = (z10 && iLineDataSet.getCircleHoleColor() == 1122867) ? true : z4 ? 1 : 0;
AnonymousClass1 anonymousClass1 = null;
if (this.mImageCaches.containsKey(iLineDataSet)) {
dataSetImageCache = this.mImageCaches.get(iLineDataSet);
} else {
dataSetImageCache = new DataSetImageCache(this, anonymousClass1);
this.mImageCaches.put(iLineDataSet, dataSetImageCache);
}
if (dataSetImageCache.init(iLineDataSet)) {
dataSetImageCache.fill(iLineDataSet, z10, z11);
}
BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
int i11 = xBounds.range;
int i12 = xBounds.min;
int i13 = i11 + i12;
?? r32 = z4;
while (i12 <= i13) {
?? entryForIndex = iLineDataSet.getEntryForIndex(i12);
if (entryForIndex == 0) {
break;
}
this.mCirclesBuffer[r32] = entryForIndex.getX();
this.mCirclesBuffer[1] = entryForIndex.getY() * phaseY;
transformer.pointValuesToPixel(this.mCirclesBuffer);
if (!this.mViewPortHandler.isInBoundsRight(this.mCirclesBuffer[r32])) {
break;
}
if (this.mViewPortHandler.isInBoundsLeft(this.mCirclesBuffer[r32]) && this.mViewPortHandler.isInBoundsY(this.mCirclesBuffer[1]) && (bitmap = dataSetImageCache.getBitmap(i12)) != null) {
float[] fArr2 = this.mCirclesBuffer;
canvas.drawBitmap(bitmap, fArr2[r32] - circleRadius, fArr2[1] - circleRadius, (Paint) null);
}
i12++;
r32 = 0;
}
}
i10++;
z4 = false;
f10 = 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 i10 = xBounds.min + 1;
T entryForIndex = iLineDataSet.getEntryForIndex(Math.max(i10 - 2, 0));
?? entryForIndex2 = iLineDataSet.getEntryForIndex(Math.max(i10 - 1, 0));
if (entryForIndex2 != 0) {
this.cubicPath.moveTo(entryForIndex2.getX(), entryForIndex2.getY() * phaseY);
int i11 = this.mXBounds.min + 1;
int i12 = -1;
Entry entry = entryForIndex2;
Entry entry2 = entryForIndex2;
Entry entry3 = entryForIndex;
while (true) {
BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
Entry entry4 = entry2;
if (i11 > xBounds2.range + xBounds2.min) {
break;
}
if (i12 != i11) {
entry4 = iLineDataSet.getEntryForIndex(i11);
}
int i13 = i11 + 1;
if (i13 < iLineDataSet.getEntryCount()) {
i11 = i13;
}
?? entryForIndex3 = iLineDataSet.getEntryForIndex(i11);
this.cubicPath.cubicTo(entry.getX() + ((entry4.getX() - entry3.getX()) * cubicIntensity), (entry.getY() + ((entry4.getY() - entry3.getY()) * cubicIntensity)) * phaseY, entry4.getX() - ((entryForIndex3.getX() - entry.getX()) * cubicIntensity), (entry4.getY() - ((entryForIndex3.getY() - entry.getY()) * cubicIntensity)) * phaseY, entry4.getX(), entry4.getY() * phaseY);
entry3 = entry;
entry = entry4;
entry2 = entryForIndex3;
int i14 = i11;
i11 = i13;
i12 = i14;
}
} 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).getX(), fillLinePosition);
path.lineTo(iLineDataSet.getEntryForIndex(xBounds.min).getX(), 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 t9 : this.mChart.getLineData().getDataSets()) {
if (t9.isVisible()) {
drawDataSet(canvas, t9);
}
}
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 i10 = AnonymousClass1.$SwitchMap$com$github$mikephil$charting$data$LineDataSet$Mode[iLineDataSet.getMode().ordinal()];
if (i10 == 3) {
drawCubicBezier(iLineDataSet);
} else if (i10 != 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.getX(), this.mAnimator.getPhaseY() * entryForXValue.getY());
highlight.setDraw((float) pixelForValues.f5310x, (float) pixelForValues.f5311y);
drawHighlightLines(canvas, (float) pixelForValues.f5310x, (float) pixelForValues.f5311y, 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.getX(), entryForIndex.getY() * phaseY);
int i10 = this.mXBounds.min + 1;
Entry entry = entryForIndex;
while (true) {
BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
if (i10 > xBounds2.range + xBounds2.min) {
break;
}
?? entryForIndex2 = iLineDataSet.getEntryForIndex(i10);
float x10 = ((entryForIndex2.getX() - entry.getX()) / 2.0f) + entry.getX();
this.cubicPath.cubicTo(x10, entry.getY() * phaseY, x10, entryForIndex2.getY() * phaseY, entryForIndex2.getX(), entryForIndex2.getY() * phaseY);
i10++;
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) {
int entryCount = iLineDataSet.getEntryCount();
boolean z4 = iLineDataSet.getMode() == LineDataSet.Mode.STEPPED;
int i10 = z4 ? 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 i11 = i10 * 2;
if (this.mLineBuffer.length <= i11) {
this.mLineBuffer = new float[i10 * 4];
}
int i12 = this.mXBounds.min;
while (true) {
BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
if (i12 > xBounds.range + xBounds.min) {
break;
}
?? entryForIndex = iLineDataSet.getEntryForIndex(i12);
if (entryForIndex != 0) {
this.mLineBuffer[0] = entryForIndex.getX();
this.mLineBuffer[1] = entryForIndex.getY() * phaseY;
if (i12 < this.mXBounds.max) {
?? entryForIndex2 = iLineDataSet.getEntryForIndex(i12 + 1);
if (entryForIndex2 == 0) {
break;
}
if (z4) {
this.mLineBuffer[2] = entryForIndex2.getX();
float[] fArr = this.mLineBuffer;
float f10 = fArr[1];
fArr[3] = f10;
fArr[4] = fArr[2];
fArr[5] = f10;
fArr[6] = entryForIndex2.getX();
this.mLineBuffer[7] = entryForIndex2.getY() * phaseY;
} else {
this.mLineBuffer[2] = entryForIndex2.getX();
this.mLineBuffer[3] = entryForIndex2.getY() * phaseY;
}
} else {
float[] fArr2 = this.mLineBuffer;
fArr2[2] = fArr2[0];
fArr2[3] = fArr2[1];
}
transformer.pointValuesToPixel(this.mLineBuffer);
if (!this.mViewPortHandler.isInBoundsRight(this.mLineBuffer[0])) {
break;
}
if (this.mViewPortHandler.isInBoundsLeft(this.mLineBuffer[2]) && (this.mViewPortHandler.isInBoundsTop(this.mLineBuffer[1]) || this.mViewPortHandler.isInBoundsBottom(this.mLineBuffer[3]))) {
this.mRenderPaint.setColor(iLineDataSet.getColor(i12));
canvas2.drawLines(this.mLineBuffer, 0, i11, this.mRenderPaint);
}
}
i12++;
}
} else {
int i13 = entryCount * i10;
if (this.mLineBuffer.length < Math.max(i13, i10) * 2) {
this.mLineBuffer = new float[Math.max(i13, i10) * 4];
}
if (iLineDataSet.getEntryForIndex(this.mXBounds.min) != 0) {
int i14 = this.mXBounds.min;
int i15 = 0;
while (true) {
BarLineScatterCandleBubbleRenderer.XBounds xBounds2 = this.mXBounds;
if (i14 > xBounds2.range + xBounds2.min) {
break;
}
?? entryForIndex3 = iLineDataSet.getEntryForIndex(i14 == 0 ? 0 : i14 - 1);
?? entryForIndex4 = iLineDataSet.getEntryForIndex(i14);
if (entryForIndex3 != 0 && entryForIndex4 != 0) {
int i16 = i15 + 1;
this.mLineBuffer[i15] = entryForIndex3.getX();
int i17 = i16 + 1;
this.mLineBuffer[i16] = entryForIndex3.getY() * phaseY;
if (z4) {
int i18 = i17 + 1;
this.mLineBuffer[i17] = entryForIndex4.getX();
int i19 = i18 + 1;
this.mLineBuffer[i18] = entryForIndex3.getY() * phaseY;
int i20 = i19 + 1;
this.mLineBuffer[i19] = entryForIndex4.getX();
i17 = i20 + 1;
this.mLineBuffer[i20] = entryForIndex3.getY() * phaseY;
}
int i21 = i17 + 1;
this.mLineBuffer[i17] = entryForIndex4.getX();
this.mLineBuffer[i21] = entryForIndex4.getY() * phaseY;
i15 = i21 + 1;
}
i14++;
}
if (i15 > 0) {
transformer.pointValuesToPixel(this.mLineBuffer);
int max = Math.max((this.mXBounds.range + 1) * i10, i10) * 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 i10;
int i11;
Path path = this.mGenerateFilledPathBuffer;
int i12 = xBounds.min;
int i13 = xBounds.range + i12;
int i14 = 0;
do {
i10 = (i14 * 128) + i12;
i11 = i10 + 128;
if (i11 > i13) {
i11 = i13;
}
if (i10 <= i11) {
generateFilledPath(iLineDataSet, i10, i11, path);
transformer.pathValueToPixel(path);
Drawable fillDrawable = iLineDataSet.getFillDrawable();
if (fillDrawable != null) {
drawFilledPath(canvas, path, fillDrawable);
} else {
drawFilledPath(canvas, path, iLineDataSet.getFillColor(), iLineDataSet.getFillAlpha());
}
}
i14++;
} while (i10 <= i11);
}
@Override
public void drawValue(Canvas canvas, String str, float f10, float f11, int i10) {
this.mValuePaint.setColor(i10);
canvas.drawText(str, f10, f11, this.mValuePaint);
}
@Override
public void drawValues(Canvas canvas) {
int i10;
ILineDataSet iLineDataSet;
Entry entry;
if (isDrawingValuesAllowed(this.mChart)) {
List<T> dataSets = this.mChart.getLineData().getDataSets();
for (int i11 = 0; i11 < dataSets.size(); i11++) {
ILineDataSet iLineDataSet2 = (ILineDataSet) dataSets.get(i11);
if (shouldDrawValues(iLineDataSet2) && iLineDataSet2.getEntryCount() >= 1) {
applyValueTextStyle(iLineDataSet2);
Transformer transformer = this.mChart.getTransformer(iLineDataSet2.getAxisDependency());
int circleRadius = (int) (iLineDataSet2.getCircleRadius() * 1.75f);
if (!iLineDataSet2.isDrawCirclesEnabled()) {
circleRadius /= 2;
}
int i12 = circleRadius;
this.mXBounds.set(this.mChart, iLineDataSet2);
float phaseX = this.mAnimator.getPhaseX();
float phaseY = this.mAnimator.getPhaseY();
BarLineScatterCandleBubbleRenderer.XBounds xBounds = this.mXBounds;
float[] generateTransformedValuesLine = transformer.generateTransformedValuesLine(iLineDataSet2, phaseX, phaseY, xBounds.min, xBounds.max);
ValueFormatter valueFormatter = iLineDataSet2.getValueFormatter();
MPPointF mPPointF = MPPointF.getInstance(iLineDataSet2.getIconsOffset());
mPPointF.f5312x = Utils.convertDpToPixel(mPPointF.f5312x);
mPPointF.f5313y = Utils.convertDpToPixel(mPPointF.f5313y);
int i13 = 0;
while (i13 < generateTransformedValuesLine.length) {
float f10 = generateTransformedValuesLine[i13];
float f11 = generateTransformedValuesLine[i13 + 1];
if (!this.mViewPortHandler.isInBoundsRight(f10)) {
break;
}
if (this.mViewPortHandler.isInBoundsLeft(f10) && this.mViewPortHandler.isInBoundsY(f11)) {
int i14 = i13 / 2;
Entry entryForIndex = iLineDataSet2.getEntryForIndex(this.mXBounds.min + i14);
if (iLineDataSet2.isDrawValuesEnabled()) {
entry = entryForIndex;
i10 = i12;
iLineDataSet = iLineDataSet2;
drawValue(canvas, valueFormatter.getPointLabel(entryForIndex), f10, f11 - i12, iLineDataSet2.getValueTextColor(i14));
} else {
entry = entryForIndex;
i10 = i12;
iLineDataSet = iLineDataSet2;
}
if (entry.getIcon() != null && iLineDataSet.isDrawIconsEnabled()) {
Drawable icon = entry.getIcon();
Utils.drawImage(canvas, icon, (int) (f10 + mPPointF.f5312x), (int) (f11 + mPPointF.f5313y), icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
}
} else {
i10 = i12;
iLineDataSet = iLineDataSet2;
}
i13 += 2;
iLineDataSet2 = iLineDataSet;
i12 = i10;
}
MPPointF.recycleInstance(mPPointF);
}
}
}
}
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();
}
public class DataSetImageCache {
private Bitmap[] circleBitmaps;
private Path mCirclePathBuffer;
private DataSetImageCache() {
this.mCirclePathBuffer = new Path();
}
public void fill(ILineDataSet iLineDataSet, boolean z4, boolean z10) {
int circleColorCount = iLineDataSet.getCircleColorCount();
float circleRadius = iLineDataSet.getCircleRadius();
float circleHoleRadius = iLineDataSet.getCircleHoleRadius();
for (int i10 = 0; i10 < circleColorCount; i10++) {
int i11 = (int) (circleRadius * 2.1d);
Bitmap createBitmap = Bitmap.createBitmap(i11, i11, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(createBitmap);
this.circleBitmaps[i10] = createBitmap;
LineChartRenderer.this.mRenderPaint.setColor(iLineDataSet.getCircleColor(i10));
if (z10) {
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 (z4) {
canvas.drawCircle(circleRadius, circleRadius, circleHoleRadius, LineChartRenderer.this.mCirclePaintInner);
}
}
}
}
public Bitmap getBitmap(int i10) {
Bitmap[] bitmapArr = this.circleBitmaps;
return bitmapArr[i10 % 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;
}
public DataSetImageCache(LineChartRenderer lineChartRenderer, AnonymousClass1 anonymousClass1) {
this();
}
}
}