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

Commit eeb3091a authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Density-dependent painting in PointerLocationView" into...

Merge "Merge "Density-dependent painting in PointerLocationView" into udc-qpr-dev am: 50e5693d am: 60ccd84a"
parents 308a975c 3177f804
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ public class PointerLocationView extends View implements InputDeviceListener,
    @UnsupportedAppUsage
    private boolean mPrintCoords = true;

    private float mDensity;

    public PointerLocationView(Context c) {
        super(c);
        setFocusableInTouchMode(true);
@@ -357,19 +359,20 @@ public class PointerLocationView extends View implements InputDeviceListener,

                // Draw current touch ellipse.
                mPaint.setARGB(255, pressureLevel, 255 - pressureLevel, 128);
                drawOval(canvas, ps.mCoords.x, ps.mCoords.y, ps.mCoords.touchMajor,
                        ps.mCoords.touchMinor, ps.mCoords.orientation, mPaint);
                drawOval(canvas, ps.mCoords.x, ps.mCoords.y, ps.mCoords.touchMajor * mDensity,
                        ps.mCoords.touchMinor * mDensity, ps.mCoords.orientation, mPaint);

                // Draw current tool ellipse.
                mPaint.setARGB(255, pressureLevel, 128, 255 - pressureLevel);
                drawOval(canvas, ps.mCoords.x, ps.mCoords.y, ps.mCoords.toolMajor,
                        ps.mCoords.toolMinor, ps.mCoords.orientation, mPaint);
                drawOval(canvas, ps.mCoords.x, ps.mCoords.y, ps.mCoords.toolMajor * mDensity,
                        ps.mCoords.toolMinor * mDensity, ps.mCoords.orientation, mPaint);

                // Draw the orientation arrow.
                float arrowSize = ps.mCoords.toolMajor * 0.7f;
                if (arrowSize < 20) {
                    arrowSize = 20;
                }
                arrowSize *= mDensity;
                mPaint.setARGB(255, pressureLevel, 255, 0);
                float orientationVectorX = (float) (Math.sin(ps.mCoords.orientation)
                        * arrowSize);
@@ -398,7 +401,7 @@ public class PointerLocationView extends View implements InputDeviceListener,
                canvas.drawCircle(
                        ps.mCoords.x + orientationVectorX * tiltScale,
                        ps.mCoords.y + orientationVectorY * tiltScale,
                        3.0f, mPaint);
                        3.0f * mDensity, mPaint);

                // Draw the current bounding box
                if (ps.mHasBoundingBox) {
@@ -1003,10 +1006,10 @@ public class PointerLocationView extends View implements InputDeviceListener,

    // Compute size by display density.
    private void configureDensityDependentFactors() {
        final float density = getResources().getDisplayMetrics().density;
        mTextPaint.setTextSize(10 * density);
        mPaint.setStrokeWidth(1 * density);
        mCurrentPointPaint.setStrokeWidth(1 * density);
        mPathPaint.setStrokeWidth(1 * density);
        mDensity = getResources().getDisplayMetrics().density;
        mTextPaint.setTextSize(10 * mDensity);
        mPaint.setStrokeWidth(1 * mDensity);
        mCurrentPointPaint.setStrokeWidth(1 * mDensity);
        mPathPaint.setStrokeWidth(1 * mDensity);
    }
}