Fixed glitch in clipping rects.
It's the Android's renderer's bug. When specifying exact clipping rects, they are clipping more than they should! So drawing a thin 1px line on the edge of a clipping rect fail. Instead of insetting by half the line width, inset by full line width.
This commit is contained in:
parent
49b4d1a96b
commit
70691bea41
4 changed files with 12 additions and 12 deletions
|
@ -270,7 +270,7 @@ public class XAxisRenderer extends AxisRenderer {
|
|||
|
||||
public RectF getGridClippingRect() {
|
||||
mGridClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mGridClippingRect.inset(-mAxis.getGridLineWidth() / 2.f, 0.f);
|
||||
mGridClippingRect.inset(-mAxis.getGridLineWidth(), 0.f);
|
||||
return mGridClippingRect;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class XAxisRenderer extends AxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mLimitLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mLimitLineClippingRect.inset(-l.getLineWidth() / 2.f, 0.f);
|
||||
mLimitLineClippingRect.inset(-l.getLineWidth(), 0.f);
|
||||
c.clipRect(mLimitLineClippingRect);
|
||||
|
||||
position[0] = l.getLimit();
|
||||
|
|
|
@ -165,7 +165,7 @@ public class XAxisRendererHorizontalBarChart extends XAxisRenderer {
|
|||
@Override
|
||||
public RectF getGridClippingRect() {
|
||||
mGridClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mGridClippingRect.inset(0.f, -mAxis.getGridLineWidth() / 2.f);
|
||||
mGridClippingRect.inset(0.f, -mAxis.getGridLineWidth());
|
||||
return mGridClippingRect;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class XAxisRendererHorizontalBarChart extends XAxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mLimitLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mLimitLineClippingRect.inset(0.f, -l.getLineWidth() / 2.f);
|
||||
mLimitLineClippingRect.inset(0.f, -l.getLineWidth());
|
||||
c.clipRect(mLimitLineClippingRect);
|
||||
|
||||
mLimitLinePaint.setStyle(Paint.Style.STROKE);
|
||||
|
|
|
@ -167,7 +167,7 @@ public class YAxisRenderer extends AxisRenderer {
|
|||
|
||||
public RectF getGridClippingRect() {
|
||||
mGridClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mGridClippingRect.inset(0.f, -mAxis.getGridLineWidth() / 2.f);
|
||||
mGridClippingRect.inset(0.f, -mAxis.getGridLineWidth());
|
||||
return mGridClippingRect;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class YAxisRenderer extends AxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mZeroLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mZeroLineClippingRect.inset(0.f, -mYAxis.getZeroLineWidth() / 2.f);
|
||||
mZeroLineClippingRect.inset(0.f, -mYAxis.getZeroLineWidth());
|
||||
c.clipRect(mZeroLineClippingRect);
|
||||
|
||||
// draw zero line
|
||||
|
@ -232,8 +232,8 @@ public class YAxisRenderer extends AxisRenderer {
|
|||
Path zeroLinePath = mDrawZeroLinePath;
|
||||
zeroLinePath.reset();
|
||||
|
||||
zeroLinePath.moveTo(mViewPortHandler.contentLeft(), (float) pos.y - 1);
|
||||
zeroLinePath.lineTo(mViewPortHandler.contentRight(), (float) pos.y - 1);
|
||||
zeroLinePath.moveTo(mViewPortHandler.contentLeft(), (float) pos.y);
|
||||
zeroLinePath.lineTo(mViewPortHandler.contentRight(), (float) pos.y);
|
||||
|
||||
// draw a path because lines don't support dashing on lower android versions
|
||||
c.drawPath(zeroLinePath, mZeroLinePaint);
|
||||
|
@ -272,7 +272,7 @@ public class YAxisRenderer extends AxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mLimitLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mLimitLineClippingRect.inset(0.f, -l.getLineWidth() / 2.f);
|
||||
mLimitLineClippingRect.inset(0.f, -l.getLineWidth());
|
||||
c.clipRect(mLimitLineClippingRect);
|
||||
|
||||
mLimitLinePaint.setStyle(Paint.Style.STROKE);
|
||||
|
|
|
@ -168,7 +168,7 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
@Override
|
||||
public RectF getGridClippingRect() {
|
||||
mGridClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mGridClippingRect.inset(-mAxis.getGridLineWidth() / 2.f, 0.f);
|
||||
mGridClippingRect.inset(-mAxis.getGridLineWidth(), 0.f);
|
||||
return mGridClippingRect;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mZeroLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mZeroLineClippingRect.inset(-mYAxis.getZeroLineWidth() / 2.f, 0.f);
|
||||
mZeroLineClippingRect.inset(-mYAxis.getZeroLineWidth(), 0.f);
|
||||
c.clipRect(mLimitLineClippingRect);
|
||||
|
||||
// draw zero line
|
||||
|
@ -242,7 +242,7 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
|
||||
int clipRestoreCount = c.save();
|
||||
mLimitLineClippingRect.set(mViewPortHandler.getContentRect());
|
||||
mLimitLineClippingRect.inset(-l.getLineWidth() / 2.f, 0.f);
|
||||
mLimitLineClippingRect.inset(-l.getLineWidth(), 0.f);
|
||||
c.clipRect(mLimitLineClippingRect);
|
||||
|
||||
pts[0] = l.getLimit();
|
||||
|
|
Loading…
Add table
Reference in a new issue