Skip to content

Commit fce2ec4

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Fix 6656710: center dot pattern in GlowPadView" into jb-dev
2 parents 0e302bc + 94754ef commit fce2ec4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/java/com/android/internal/widget/multiwaveview/PointCloud.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,25 @@ private float interp(float min, float max, float f) {
202202

203203
public void draw(Canvas canvas) {
204204
ArrayList<Point> points = mPointCloud;
205-
final float cx = mDrawable != null ? (-mDrawable.getIntrinsicWidth() / 2) : 0;
206-
final float cy = mDrawable != null ? (-mDrawable.getIntrinsicHeight() / 2) : 0;
207205
canvas.save(Canvas.MATRIX_SAVE_FLAG);
208206
canvas.scale(mScale, mScale, mCenterX, mCenterY);
209207
for (int i = 0; i < points.size(); i++) {
210208
Point point = points.get(i);
211209
final float pointSize = interp(MAX_POINT_SIZE, MIN_POINT_SIZE,
212210
point.radius / mOuterRadius);
213-
final float px = point.x + cx + mCenterX;
214-
final float py = point.y + cy + mCenterY;
211+
final float px = point.x + mCenterX;
212+
final float py = point.y + mCenterY;
215213
int alpha = getAlphaForPoint(point);
216214

217215
if (alpha == 0) continue;
218216

219217
if (mDrawable != null) {
220218
canvas.save(Canvas.MATRIX_SAVE_FLAG);
221-
float s = pointSize / MAX_POINT_SIZE;
219+
final float cx = mDrawable.getIntrinsicWidth() * 0.5f;
220+
final float cy = mDrawable.getIntrinsicHeight() * 0.5f;
221+
final float s = pointSize / MAX_POINT_SIZE;
222222
canvas.scale(s, s, px, py);
223-
canvas.translate(px, py);
223+
canvas.translate(px - cx, py - cy);
224224
mDrawable.setAlpha(alpha);
225225
mDrawable.draw(canvas);
226226
canvas.restore();

0 commit comments

Comments
 (0)