Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d034b31 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Consolidate data and algorithm of calculating rounded line (Step 1)

Change-Id: Ic6d72b5a34ddfbc55317fa651f78af6f50c9a284
parent 9b935084
Loading
Loading
Loading
Loading
+60 −60
Original line number Diff line number Diff line
@@ -144,12 +144,11 @@ final class GesturePreviewTrail {
        // Sweep angle of the trail arc at P2.
        public float a2;
        public RectF arc2 = new RectF();
    }

    private static final float RIGHT_ANGLE = (float)(Math.PI / 2.0d);
        private static final float RADIAN_TO_DEGREE = (float)(180.0d / Math.PI);
        private static final float RIGHT_ANGLE = (float)(Math.PI / 2.0d);

    private static boolean calculatePathPoints(final WorkingSet w) {
        public static boolean calculatePathPoints(final WorkingSet w) {
            final float dx = w.p2x - w.p1x;
            final float dy = w.p2y - w.p1y;
            // Distance of the points.
@@ -190,7 +189,7 @@ final class GesturePreviewTrail {
            return true;
        }

    private static void createPath(final Path path, final WorkingSet w) {
        public static void createPath(final Path path, final WorkingSet w) {
            path.rewind();
            // Trail cap at P1.
            path.moveTo(w.p1x, w.p1y);
@@ -207,6 +206,7 @@ final class GesturePreviewTrail {
            path.lineTo(w.p2ax, w.p2ay);
            path.close();
        }
    }

    private final WorkingSet mWorkingSet = new WorkingSet();
    private final Path mPath = new Path();
@@ -262,8 +262,8 @@ final class GesturePreviewTrail {
                    paint.setAlpha(alpha);
                    final float width = getWidth(elapsedTime, params);
                    w.r2 = width / 2.0f;
                    if (calculatePathPoints(w)) {
                        createPath(path, w);
                    if (WorkingSet.calculatePathPoints(w)) {
                        WorkingSet.createPath(path, w);
                        canvas.drawPath(path, paint);
                        outBoundsRect.union((int)w.p2x, (int)w.p2y);
                    }