正在查看: Perplexity v2.48.1 应用的 PieChartRenderer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Perplexity v2.48.1 应用的 PieChartRenderer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.github.mikephil.charting.renderer;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import com.github.mikephil.charting.animation.ChartAnimator;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.IValueFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IPieDataSet;
import com.github.mikephil.charting.utils.MPPointF;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.ViewPortHandler;
import e.q;
import java.lang.ref.WeakReference;
import java.util.List;
public class PieChartRenderer extends DataRenderer {
protected Canvas mBitmapCanvas;
private RectF mCenterTextLastBounds;
private CharSequence mCenterTextLastValue;
private StaticLayout mCenterTextLayout;
private TextPaint mCenterTextPaint;
protected PieChart mChart;
protected WeakReference<Bitmap> mDrawBitmap;
protected Path mDrawCenterTextPathBuffer;
protected RectF mDrawHighlightedRectF;
private Paint mEntryLabelsPaint;
private Path mHoleCirclePath;
protected Paint mHolePaint;
private RectF mInnerRectBuffer;
private Path mPathBuffer;
private RectF[] mRectBuffer;
protected Paint mRoundedCornerPaint;
protected Paint mTransparentCirclePaint;
protected Paint mValueLinePaint;
public PieChartRenderer(PieChart pieChart, ChartAnimator chartAnimator, ViewPortHandler viewPortHandler) {
super(chartAnimator, viewPortHandler);
this.mCenterTextLastBounds = new RectF();
this.mRectBuffer = new RectF[]{new RectF(), new RectF(), new RectF()};
this.mPathBuffer = new Path();
this.mInnerRectBuffer = new RectF();
this.mHoleCirclePath = new Path();
this.mDrawCenterTextPathBuffer = new Path();
this.mDrawHighlightedRectF = new RectF();
this.mChart = pieChart;
Paint paint = new Paint(1);
this.mHolePaint = paint;
paint.setColor(-1);
Paint paint2 = this.mHolePaint;
Paint.Style style = Paint.Style.FILL;
paint2.setStyle(style);
Paint paint3 = new Paint(1);
this.mTransparentCirclePaint = paint3;
paint3.setColor(-1);
this.mTransparentCirclePaint.setStyle(style);
this.mTransparentCirclePaint.setAlpha(105);
TextPaint textPaint = new TextPaint(1);
this.mCenterTextPaint = textPaint;
textPaint.setColor(-16777216);
this.mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12.0f));
this.mValuePaint.setTextSize(Utils.convertDpToPixel(13.0f));
this.mValuePaint.setColor(-1);
Paint paint4 = this.mValuePaint;
Paint.Align align = Paint.Align.CENTER;
paint4.setTextAlign(align);
Paint paint5 = new Paint(1);
this.mEntryLabelsPaint = paint5;
paint5.setColor(-1);
this.mEntryLabelsPaint.setTextAlign(align);
this.mEntryLabelsPaint.setTextSize(Utils.convertDpToPixel(13.0f));
Paint paint6 = new Paint(1);
this.mValueLinePaint = paint6;
Paint.Style style2 = Paint.Style.STROKE;
paint6.setStyle(style2);
Paint paint7 = new Paint(1);
this.mRoundedCornerPaint = paint7;
paint7.setStyle(style2);
this.mRoundedCornerPaint.setAntiAlias(true);
}
public float calculateMinimumRadiusForSpacedSlice(MPPointF mPPointF, float f, float f2, float f3, float f4, float f5, float f6) {
double d = (f5 + f6) * 0.017453292f;
float cos = (((float) Math.cos(d)) * f) + mPPointF.x;
float sin = (((float) Math.sin(d)) * f) + mPPointF.y;
double d2 = ((f6 / 2.0f) + f5) * 0.017453292f;
float cos2 = (((float) Math.cos(d2)) * f) + mPPointF.x;
float sin2 = (((float) Math.sin(d2)) * f) + mPPointF.y;
return (float) ((f - ((float) (Math.tan(((180.0d - f2) / 2.0d) * 0.017453292519943295d) * (Math.sqrt(Math.pow(sin - f4, 2.0d) + Math.pow(cos - f3, 2.0d)) / 2.0d)))) - Math.sqrt(Math.pow(sin2 - ((sin + f4) / 2.0f), 2.0d) + Math.pow(cos2 - ((cos + f3) / 2.0f), 2.0d)));
}
public void drawCenterText(Canvas canvas) {
float radius;
CharSequence centerText = this.mChart.getCenterText();
if (!this.mChart.isDrawCenterTextEnabled() || centerText == null) {
return;
}
MPPointF centerCircleBox = this.mChart.getCenterCircleBox();
MPPointF centerTextOffset = this.mChart.getCenterTextOffset();
float f = centerCircleBox.x + centerTextOffset.x;
float f2 = centerCircleBox.y + centerTextOffset.y;
if (!this.mChart.isDrawHoleEnabled() || this.mChart.isDrawSlicesUnderHoleEnabled()) {
radius = this.mChart.getRadius();
} else {
radius = (this.mChart.getHoleRadius() / 100.0f) * this.mChart.getRadius();
}
RectF[] rectFArr = this.mRectBuffer;
RectF rectF = rectFArr[0];
rectF.left = f - radius;
rectF.top = f2 - radius;
rectF.right = f + radius;
rectF.bottom = f2 + radius;
RectF rectF2 = rectFArr[1];
rectF2.set(rectF);
float centerTextRadiusPercent = this.mChart.getCenterTextRadiusPercent() / 100.0f;
if (centerTextRadiusPercent > 0.0d) {
rectF2.inset((rectF2.width() - (rectF2.width() * centerTextRadiusPercent)) / 2.0f, (rectF2.height() - (rectF2.height() * centerTextRadiusPercent)) / 2.0f);
}
if (!centerText.equals(this.mCenterTextLastValue) || !rectF2.equals(this.mCenterTextLastBounds)) {
this.mCenterTextLastBounds.set(rectF2);
this.mCenterTextLastValue = centerText;
this.mCenterTextLayout = new StaticLayout(centerText, 0, centerText.length(), this.mCenterTextPaint, (int) Math.max(Math.ceil(this.mCenterTextLastBounds.width()), 1.0d), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
}
float height = this.mCenterTextLayout.getHeight();
canvas.save();
Path path = this.mDrawCenterTextPathBuffer;
path.reset();
path.addOval(rectF, Path.Direction.CW);
canvas.clipPath(path);
canvas.translate(rectF2.left, ((rectF2.height() - height) / 2.0f) + rectF2.top);
this.mCenterTextLayout.draw(canvas);
canvas.restore();
MPPointF.recycleInstance(centerCircleBox);
MPPointF.recycleInstance(centerTextOffset);
}
@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, Bitmap.Config.ARGB_4444);
this.mDrawBitmap = new WeakReference<>(bitmap);
this.mBitmapCanvas = new Canvas(bitmap);
}
bitmap.eraseColor(0);
for (IPieDataSet iPieDataSet : ((PieData) this.mChart.getData()).getDataSets()) {
if (iPieDataSet.isVisible() && iPieDataSet.getEntryCount() > 0) {
drawDataSet(canvas, iPieDataSet);
}
}
}
public void drawDataSet(android.graphics.Canvas r37, com.github.mikephil.charting.interfaces.datasets.IPieDataSet r38) {
throw new UnsupportedOperationException("Method not decompiled: com.github.mikephil.charting.renderer.PieChartRenderer.drawDataSet(android.graphics.Canvas, com.github.mikephil.charting.interfaces.datasets.IPieDataSet):void");
}
public void drawEntryLabel(Canvas canvas, String str, float f, float f2) {
canvas.drawText(str, f, f2, this.mEntryLabelsPaint);
}
@Override
public void drawExtras(Canvas canvas) {
drawHole(canvas);
canvas.drawBitmap(this.mDrawBitmap.get(), 0.0f, 0.0f, (Paint) null);
drawCenterText(canvas);
}
@Override
public void drawHighlighted(Canvas canvas, Highlight[] highlightArr) {
IPieDataSet dataSetByIndex;
int i;
float f;
float f2;
float f3;
float f4;
float f5;
float f6;
float f7;
RectF rectF;
float f8;
float f9;
float f10;
Highlight[] highlightArr2 = highlightArr;
boolean z = this.mChart.isDrawHoleEnabled() && !this.mChart.isDrawSlicesUnderHoleEnabled();
if (z && this.mChart.isDrawRoundedSlicesEnabled()) {
return;
}
float phaseX = this.mAnimator.getPhaseX();
float phaseY = this.mAnimator.getPhaseY();
float rotationAngle = this.mChart.getRotationAngle();
float[] drawAngles = this.mChart.getDrawAngles();
float[] absoluteAngles = this.mChart.getAbsoluteAngles();
MPPointF centerCircleBox = this.mChart.getCenterCircleBox();
float radius = this.mChart.getRadius();
float f11 = 0.0f;
float holeRadius = z ? (this.mChart.getHoleRadius() / 100.0f) * radius : 0.0f;
RectF rectF2 = this.mDrawHighlightedRectF;
rectF2.set(0.0f, 0.0f, 0.0f, 0.0f);
int i2 = 0;
while (i2 < highlightArr2.length) {
int x = (int) highlightArr2[i2].getX();
float f12 = f11;
if (x < drawAngles.length && (dataSetByIndex = ((PieData) this.mChart.getData()).getDataSetByIndex(highlightArr2[i2].getDataSetIndex())) != null && dataSetByIndex.isHighlightEnabled()) {
int entryCount = dataSetByIndex.getEntryCount();
int i3 = 0;
for (int i4 = 0; i4 < entryCount; i4++) {
if (Math.abs(dataSetByIndex.getEntryForIndex(i4).get_y()) > Utils.FLOAT_EPSILON) {
i3++;
}
}
float f13 = x == 0 ? f12 : absoluteAngles[x - 1] * phaseX;
float sliceSpace = i3 <= 1 ? f12 : dataSetByIndex.getSliceSpace();
float f14 = drawAngles[x];
float f15 = radius;
float selectionShift = dataSetByIndex.getSelectionShift();
float f16 = holeRadius;
float f17 = f15 + selectionShift;
i = i2;
rectF2.set(this.mChart.getCircleBox());
float f18 = -selectionShift;
rectF2.inset(f18, f18);
boolean z2 = sliceSpace > f12 && f14 <= 180.0f;
Integer highlightColor = dataSetByIndex.getHighlightColor();
if (highlightColor == null) {
highlightColor = Integer.valueOf(dataSetByIndex.getColor(x));
}
this.mRenderPaint.setColor(highlightColor.intValue());
float f19 = i3 == 1 ? f12 : sliceSpace / (f15 * 0.017453292f);
float f20 = i3 == 1 ? f12 : sliceSpace / (f17 * 0.017453292f);
float f21 = (((f19 / 2.0f) + f13) * phaseY) + rotationAngle;
float f22 = (f14 - f19) * phaseY;
float f23 = f22 < f12 ? f12 : f22;
float f24 = (((f20 / 2.0f) + f13) * phaseY) + rotationAngle;
float f25 = (f14 - f20) * phaseY;
if (f25 < f12) {
f25 = f12;
}
this.mPathBuffer.reset();
if (f23 < 360.0f || f23 % 360.0f > Utils.FLOAT_EPSILON) {
f = f23;
f2 = f13;
f3 = sliceSpace;
double d = f24 * 0.017453292f;
this.mPathBuffer.moveTo((((float) Math.cos(d)) * f17) + centerCircleBox.x, (((float) Math.sin(d)) * f17) + centerCircleBox.y);
this.mPathBuffer.arcTo(rectF2, f24, f25);
} else {
f = f23;
this.mPathBuffer.addCircle(centerCircleBox.x, centerCircleBox.y, f17, Path.Direction.CW);
f2 = f13;
f3 = sliceSpace;
}
if (z2) {
double d2 = f21 * 0.017453292f;
float cos = (((float) Math.cos(d2)) * f15) + centerCircleBox.x;
float sin = (((float) Math.sin(d2)) * f15) + centerCircleBox.y;
f4 = f12;
f5 = f15;
f6 = f16;
rectF = rectF2;
f7 = f21;
f8 = calculateMinimumRadiusForSpacedSlice(centerCircleBox, f5, f14 * phaseY, cos, sin, f7, f);
} else {
f4 = f12;
f5 = f15;
f6 = f16;
f7 = f21;
rectF = rectF2;
f8 = f4;
}
RectF rectF3 = this.mInnerRectBuffer;
float f26 = centerCircleBox.x;
f12 = f4;
float f27 = centerCircleBox.y;
f9 = f5;
rectF3.set(f26 - f6, f27 - f6, f26 + f6, f27 + f6);
if (z && (f6 > f12 || z2)) {
if (z2) {
if (f8 < f12) {
f8 = -f8;
}
f10 = Math.max(f6, f8);
} else {
f10 = f6;
}
float f28 = (i3 == 1 || f10 == f12) ? f12 : f3 / (f10 * 0.017453292f);
float f29 = (((f28 / 2.0f) + f2) * phaseY) + rotationAngle;
float f30 = (f14 - f28) * phaseY;
if (f30 < f12) {
f30 = f12;
}
float f31 = f29 + f30;
if (f23 < 360.0f || f % 360.0f > Utils.FLOAT_EPSILON) {
double d3 = f31 * 0.017453292f;
this.mPathBuffer.lineTo((((float) Math.cos(d3)) * f10) + centerCircleBox.x, (f10 * ((float) Math.sin(d3))) + centerCircleBox.y);
this.mPathBuffer.arcTo(this.mInnerRectBuffer, f31, -f30);
} else {
this.mPathBuffer.addCircle(centerCircleBox.x, centerCircleBox.y, f10, Path.Direction.CCW);
}
} else if (f % 360.0f > Utils.FLOAT_EPSILON) {
if (z2) {
double d4 = ((f / 2.0f) + f7) * 0.017453292f;
this.mPathBuffer.lineTo((((float) Math.cos(d4)) * f8) + centerCircleBox.x, (f8 * ((float) Math.sin(d4))) + centerCircleBox.y);
} else {
this.mPathBuffer.lineTo(centerCircleBox.x, centerCircleBox.y);
}
}
this.mPathBuffer.close();
this.mBitmapCanvas.drawPath(this.mPathBuffer, this.mRenderPaint);
} else {
f9 = radius;
f6 = holeRadius;
rectF = rectF2;
i = i2;
}
i2 = i + 1;
f11 = f12;
highlightArr2 = highlightArr;
holeRadius = f6;
rectF2 = rectF;
radius = f9;
}
MPPointF.recycleInstance(centerCircleBox);
}
public void drawHole(Canvas canvas) {
if (!this.mChart.isDrawHoleEnabled() || this.mBitmapCanvas == null) {
return;
}
float radius = this.mChart.getRadius();
float holeRadius = (this.mChart.getHoleRadius() / 100.0f) * radius;
MPPointF centerCircleBox = this.mChart.getCenterCircleBox();
if (Color.alpha(this.mHolePaint.getColor()) > 0) {
this.mBitmapCanvas.drawCircle(centerCircleBox.x, centerCircleBox.y, holeRadius, this.mHolePaint);
}
if (Color.alpha(this.mTransparentCirclePaint.getColor()) > 0 && this.mChart.getTransparentCircleRadius() > this.mChart.getHoleRadius()) {
int alpha = this.mTransparentCirclePaint.getAlpha();
float transparentCircleRadius = (this.mChart.getTransparentCircleRadius() / 100.0f) * radius;
this.mTransparentCirclePaint.setAlpha((int) (this.mAnimator.getPhaseY() * this.mAnimator.getPhaseX() * alpha));
this.mHoleCirclePath.reset();
this.mHoleCirclePath.addCircle(centerCircleBox.x, centerCircleBox.y, transparentCircleRadius, Path.Direction.CW);
this.mHoleCirclePath.addCircle(centerCircleBox.x, centerCircleBox.y, holeRadius, Path.Direction.CCW);
this.mBitmapCanvas.drawPath(this.mHoleCirclePath, this.mTransparentCirclePaint);
this.mTransparentCirclePaint.setAlpha(alpha);
}
MPPointF.recycleInstance(centerCircleBox);
}
public void drawRoundedSlices(Canvas canvas) {
float f;
float f2;
if (this.mChart.isDrawRoundedSlicesEnabled()) {
IPieDataSet dataSet = ((PieData) this.mChart.getData()).getDataSet();
if (dataSet.isVisible()) {
float phaseX = this.mAnimator.getPhaseX();
float phaseY = this.mAnimator.getPhaseY();
MPPointF centerCircleBox = this.mChart.getCenterCircleBox();
float radius = this.mChart.getRadius();
float holeRadius = (radius - ((this.mChart.getHoleRadius() * radius) / 100.0f)) / 2.0f;
float[] drawAngles = this.mChart.getDrawAngles();
float rotationAngle = this.mChart.getRotationAngle();
int i = 0;
while (i < dataSet.getEntryCount()) {
float f3 = drawAngles[i];
if (Math.abs(dataSet.getEntryForIndex(i).get_y()) > Utils.FLOAT_EPSILON) {
double radians = Math.toRadians((rotationAngle + f3) * phaseY);
double d = radius - holeRadius;
f = phaseX;
f2 = phaseY;
float cos = (float) (centerCircleBox.x + (Math.cos(radians) * d));
float sin = (float) ((Math.sin(radians) * d) + centerCircleBox.y);
this.mRenderPaint.setColor(dataSet.getColor(i));
this.mBitmapCanvas.drawCircle(cos, sin, holeRadius, this.mRenderPaint);
} else {
f = phaseX;
f2 = phaseY;
}
rotationAngle += f3 * f;
i++;
phaseX = f;
phaseY = f2;
}
MPPointF.recycleInstance(centerCircleBox);
}
}
}
@Override
public void drawValues(Canvas canvas) {
List<IPieDataSet> list;
int i;
float f;
float[] fArr;
float[] fArr2;
float f2;
float f3;
boolean isDrawValuesEnabled;
PieDataSet.ValuePosition valuePosition;
PieDataSet.ValuePosition valuePosition2;
float f4;
float f5;
float f6;
float f7;
float f8;
float f9;
boolean z;
String str;
IPieDataSet iPieDataSet;
float f10;
MPPointF mPPointF;
int i2;
IValueFormatter iValueFormatter;
PieEntry pieEntry;
float f11;
int i3;
float f12;
int i4;
PieChartRenderer pieChartRenderer = this;
MPPointF centerCircleBox = pieChartRenderer.mChart.getCenterCircleBox();
float radius = pieChartRenderer.mChart.getRadius();
float rotationAngle = pieChartRenderer.mChart.getRotationAngle();
float[] drawAngles = pieChartRenderer.mChart.getDrawAngles();
float[] absoluteAngles = pieChartRenderer.mChart.getAbsoluteAngles();
float phaseX = pieChartRenderer.mAnimator.getPhaseX();
float phaseY = pieChartRenderer.mAnimator.getPhaseY();
float f13 = 100.0f;
float holeRadius = (radius - ((pieChartRenderer.mChart.getHoleRadius() * radius) / 100.0f)) / 2.0f;
float holeRadius2 = pieChartRenderer.mChart.getHoleRadius() / 100.0f;
float f14 = (radius / 10.0f) * 3.6f;
if (pieChartRenderer.mChart.isDrawHoleEnabled()) {
f14 = (radius - (radius * holeRadius2)) / 2.0f;
if (!pieChartRenderer.mChart.isDrawSlicesUnderHoleEnabled() && pieChartRenderer.mChart.isDrawRoundedSlicesEnabled()) {
rotationAngle = (float) (((holeRadius * 360.0f) / (radius * 6.283185307179586d)) + rotationAngle);
}
}
float f15 = rotationAngle;
float f16 = radius - f14;
PieData pieData = (PieData) pieChartRenderer.mChart.getData();
List<IPieDataSet> dataSets = pieData.getDataSets();
float yValueSum = pieData.getYValueSum();
boolean isDrawEntryLabelsEnabled = pieChartRenderer.mChart.isDrawEntryLabelsEnabled();
canvas.save();
float convertDpToPixel = Utils.convertDpToPixel(5.0f);
int i5 = 0;
int i6 = 0;
while (i6 < dataSets.size()) {
IPieDataSet iPieDataSet2 = dataSets.get(i6);
if (iPieDataSet2.getEntryCount() != 0 && ((isDrawValuesEnabled = iPieDataSet2.isDrawValuesEnabled()) || isDrawEntryLabelsEnabled)) {
PieDataSet.ValuePosition xValuePosition = iPieDataSet2.getXValuePosition();
PieDataSet.ValuePosition yValuePosition = iPieDataSet2.getYValuePosition();
pieChartRenderer.applyValueTextStyle(iPieDataSet2);
float convertDpToPixel2 = Utils.convertDpToPixel(4.0f) + Utils.calcTextHeight(pieChartRenderer.mValuePaint, "Q");
IValueFormatter valueFormatter = iPieDataSet2.getValueFormatter();
int entryCount = iPieDataSet2.getEntryCount();
boolean isUseValueColorForLineEnabled = iPieDataSet2.isUseValueColorForLineEnabled();
int valueLineColor = iPieDataSet2.getValueLineColor();
f3 = f13;
int i7 = i5;
pieChartRenderer.mValueLinePaint.setStrokeWidth(Utils.convertDpToPixel(iPieDataSet2.getValueLineWidth()));
float sliceSpace = pieChartRenderer.getSliceSpace(iPieDataSet2);
MPPointF mPPointF2 = MPPointF.getInstance(iPieDataSet2.getIconsOffset());
list = dataSets;
mPPointF2.x = Utils.convertDpToPixel(mPPointF2.x);
mPPointF2.y = Utils.convertDpToPixel(mPPointF2.y);
int i8 = 0;
while (i8 < entryCount) {
PieEntry entryForIndex = iPieDataSet2.getEntryForIndex(i8);
MPPointF mPPointF3 = mPPointF2;
float f17 = ((((drawAngles[i7] - ((sliceSpace / (f16 * 0.017453292f)) / 2.0f)) / 2.0f) + (i7 == 0 ? 0.0f : absoluteAngles[i7 - 1] * phaseX)) * phaseY) + f15;
int i9 = entryCount;
float _yVar = pieChartRenderer.mChart.isUsePercentValuesEnabled() ? (entryForIndex.get_y() / yValueSum) * f3 : entryForIndex.get_y();
String label = entryForIndex.getLabel();
float[] fArr3 = drawAngles;
float[] fArr4 = absoluteAngles;
double d = f17 * 0.017453292f;
float cos = (float) Math.cos(d);
float sin = (float) Math.sin(d);
boolean z2 = isDrawEntryLabelsEnabled && xValuePosition == PieDataSet.ValuePosition.OUTSIDE_SLICE;
boolean z3 = isDrawValuesEnabled && yValuePosition == PieDataSet.ValuePosition.OUTSIDE_SLICE;
boolean z4 = isDrawEntryLabelsEnabled && xValuePosition == PieDataSet.ValuePosition.INSIDE_SLICE;
boolean z5 = isDrawValuesEnabled && yValuePosition == PieDataSet.ValuePosition.INSIDE_SLICE;
if (z2 || z3) {
float valueLinePart1Length = iPieDataSet2.getValueLinePart1Length();
float valueLinePart2Length = iPieDataSet2.getValueLinePart2Length();
valuePosition = xValuePosition;
float valueLinePart1OffsetPercentage = iPieDataSet2.getValueLinePart1OffsetPercentage() / f3;
valuePosition2 = yValuePosition;
if (pieChartRenderer.mChart.isDrawHoleEnabled()) {
float f18 = radius * holeRadius2;
f4 = q.a(radius, f18, valueLinePart1OffsetPercentage, f18);
} else {
f4 = valueLinePart1OffsetPercentage * radius;
}
if (iPieDataSet2.isValueLineVariableLength()) {
f5 = f4;
f6 = valueLinePart2Length * f16 * ((float) Math.abs(Math.sin(d)));
} else {
f5 = f4;
f6 = valueLinePart2Length * f16;
}
float f19 = centerCircleBox.x;
float f20 = (f5 * cos) + f19;
float f21 = centerCircleBox.y;
float f22 = (f5 * sin) + f21;
float f23 = (valueLinePart1Length + 1.0f) * f16;
float f24 = (f23 * cos) + f19;
float f25 = f21 + (f23 * sin);
double d2 = f17 % 360.0d;
if (d2 < 90.0d || d2 > 270.0d) {
f7 = f24 + f6;
Paint paint = pieChartRenderer.mValuePaint;
Paint.Align align = Paint.Align.LEFT;
paint.setTextAlign(align);
if (z2) {
pieChartRenderer.mEntryLabelsPaint.setTextAlign(align);
}
f8 = f7 + convertDpToPixel;
} else {
f7 = f24 - f6;
Paint paint2 = pieChartRenderer.mValuePaint;
Paint.Align align2 = Paint.Align.RIGHT;
paint2.setTextAlign(align2);
if (z2) {
pieChartRenderer.mEntryLabelsPaint.setTextAlign(align2);
}
f8 = f7 - convertDpToPixel;
}
float f26 = f8;
float f27 = f7;
int color = isUseValueColorForLineEnabled ? iPieDataSet2.getColor(i8) : valueLineColor != 1122867 ? valueLineColor : 1122867;
if (color != 1122867) {
pieChartRenderer.mValueLinePaint.setColor(color);
f9 = radius;
iPieDataSet = iPieDataSet2;
z = z2;
str = label;
f10 = sin;
mPPointF = mPPointF3;
i2 = valueLineColor;
canvas.drawLine(f20, f22, f24, f25, pieChartRenderer.mValueLinePaint);
canvas.drawLine(f24, f25, f27, f25, pieChartRenderer.mValueLinePaint);
} else {
f9 = radius;
z = z2;
str = label;
iPieDataSet = iPieDataSet2;
f10 = sin;
mPPointF = mPPointF3;
i2 = valueLineColor;
}
if (z && z3) {
iValueFormatter = valueFormatter;
pieEntry = entryForIndex;
f11 = _yVar;
i3 = i6;
f12 = phaseX;
i4 = i8;
pieChartRenderer.drawValue(canvas, iValueFormatter, f11, pieEntry, 0, f26, f25, iPieDataSet.getValueTextColor(i8));
if (i4 < pieData.getEntryCount() && str != null) {
pieChartRenderer.drawEntryLabel(canvas, str, f26, f25 + convertDpToPixel2);
}
} else {
iValueFormatter = valueFormatter;
pieEntry = entryForIndex;
f11 = _yVar;
i3 = i6;
f12 = phaseX;
i4 = i8;
if (z) {
if (i4 < pieData.getEntryCount() && str != null) {
pieChartRenderer.drawEntryLabel(canvas, str, f26, (convertDpToPixel2 / 2.0f) + f25);
}
} else if (z3) {
pieChartRenderer.drawValue(canvas, iValueFormatter, f11, pieEntry, 0, f26, (convertDpToPixel2 / 2.0f) + f25, iPieDataSet.getValueTextColor(i4));
}
}
} else {
valuePosition = xValuePosition;
valuePosition2 = yValuePosition;
f9 = radius;
pieEntry = entryForIndex;
f11 = _yVar;
str = label;
iPieDataSet = iPieDataSet2;
f10 = sin;
f12 = phaseX;
iValueFormatter = valueFormatter;
mPPointF = mPPointF3;
i2 = valueLineColor;
i4 = i8;
i3 = i6;
}
if (z4 || z5) {
float f28 = (f16 * cos) + centerCircleBox.x;
float f29 = (f16 * f10) + centerCircleBox.y;
pieChartRenderer.mValuePaint.setTextAlign(Paint.Align.CENTER);
if (z4 && z5) {
pieChartRenderer.drawValue(canvas, iValueFormatter, f11, pieEntry, 0, f28, f29, iPieDataSet.getValueTextColor(i4));
if (i4 < pieData.getEntryCount() && str != null) {
pieChartRenderer.drawEntryLabel(canvas, str, f28, f29 + convertDpToPixel2);
}
} else if (z4) {
if (i4 < pieData.getEntryCount() && str != null) {
pieChartRenderer.drawEntryLabel(canvas, str, f28, (convertDpToPixel2 / 2.0f) + f29);
}
} else if (z5) {
pieChartRenderer.drawValue(canvas, iValueFormatter, f11, pieEntry, 0, f28, f29 + (convertDpToPixel2 / 2.0f), iPieDataSet.getValueTextColor(i4));
}
}
IValueFormatter iValueFormatter2 = iValueFormatter;
if (pieEntry.getIcon() != null && iPieDataSet.isDrawIconsEnabled()) {
Drawable icon = pieEntry.getIcon();
float f30 = mPPointF.y;
Utils.drawImage(canvas, icon, (int) (((f16 + f30) * cos) + centerCircleBox.x), (int) (((f16 + f30) * f10) + centerCircleBox.y + mPPointF.x), icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
}
i7++;
i8 = i4 + 1;
pieChartRenderer = this;
iPieDataSet2 = iPieDataSet;
mPPointF2 = mPPointF;
i6 = i3;
phaseX = f12;
entryCount = i9;
drawAngles = fArr3;
absoluteAngles = fArr4;
yValuePosition = valuePosition2;
xValuePosition = valuePosition;
radius = f9;
valueFormatter = iValueFormatter2;
valueLineColor = i2;
}
i = i6;
f = radius;
fArr = drawAngles;
fArr2 = absoluteAngles;
f2 = phaseX;
MPPointF.recycleInstance(mPPointF2);
i5 = i7;
} else {
list = dataSets;
i = i6;
f = radius;
fArr = drawAngles;
fArr2 = absoluteAngles;
f2 = phaseX;
f3 = f13;
}
i6 = i + 1;
pieChartRenderer = this;
f13 = f3;
dataSets = list;
phaseX = f2;
drawAngles = fArr;
absoluteAngles = fArr2;
radius = f;
}
MPPointF.recycleInstance(centerCircleBox);
canvas.restore();
}
public TextPaint getPaintCenterText() {
return this.mCenterTextPaint;
}
public Paint getPaintEntryLabels() {
return this.mEntryLabelsPaint;
}
public Paint getPaintHole() {
return this.mHolePaint;
}
public Paint getPaintTransparentCircle() {
return this.mTransparentCirclePaint;
}
public float getRoundedCornerRadius() {
return this.mRoundedCornerPaint.getStrokeWidth();
}
public float getSliceSpace(IPieDataSet iPieDataSet) {
if (iPieDataSet.isAutomaticallyDisableSliceSpacingEnabled() && iPieDataSet.getSliceSpace() / this.mViewPortHandler.getSmallestContentExtension() > (iPieDataSet.getYMin() / ((PieData) this.mChart.getData()).getYValueSum()) * 2.0f) {
return 0.0f;
}
return iPieDataSet.getSliceSpace();
}
@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 setRoundedCornerRadius(float f) {
this.mRoundedCornerPaint.setStrokeWidth(f);
}
}