From cf17525277e09bc64bd71048d7b1572d3b2e69c5 Mon Sep 17 00:00:00 2001 From: yccheok Date: Mon, 22 Jul 2013 15:28:21 +0000 Subject: [PATCH] Ensure bars are not sharing same instance of path. --- HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java b/HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java index 6a56c20..8988b61 100644 --- a/HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java +++ b/HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java @@ -50,7 +50,6 @@ public class BarGraph extends View { private ArrayList points = new ArrayList(); private Paint p = new Paint(); - private Path path = new Path(); private Rect r; private boolean showBarText = true; private int indexSelected = -1; @@ -118,12 +117,11 @@ public void onDraw(Canvas ca) { r = new Rect(); - path.reset(); - int count = 0; for (Bar p : points) { r.set((int)((padding*2)*count + padding + barWidth*count), (int)(getHeight()-bottomPadding-(usableHeight*(p.getValue()/maxValue))), (int)((padding*2)*count + padding + barWidth*(count+1)), (int)(getHeight()-bottomPadding)); + Path path = new Path(); path.addRect(new RectF(r.left-selectPadding, r.top-selectPadding, r.right+selectPadding, r.bottom+selectPadding), Path.Direction.CW); p.setPath(path); p.setRegion(new Region(r.left-selectPadding, r.top-selectPadding, r.right+selectPadding, r.bottom+selectPadding));