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

Commit a45ee5a8 authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Round mSegRectF and mPointRectF coordinates to pixel size.

Check before and after screenshots with "Digital Color Meter" on Mac,
making sure that pixels correspond to the pixels on the phone.

Flag: android.app.api_rich_ongoing
Fix: 384788572
Test: Post ProgressStyle notification described in the bug
Change-Id: Ic5fad5275c56646407afd426ed593213f6cc9378
parent 74714d5c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ public final class NotificationProgressDrawable extends Drawable {
        final float centerY = (float) getBounds().centerY();

        final int numParts = mParts.size();
        final float pointTop = Math.round(centerY - pointRadius);
        final float pointBottom = Math.round(centerY + pointRadius);
        for (int iPart = 0; iPart < numParts; iPart++) {
            final DrawablePart part = mParts.get(iPart);
            final float start = left + part.mStart;
@@ -146,12 +148,13 @@ public final class NotificationProgressDrawable extends Drawable {

                mFillPaint.setColor(segment.mColor);

                mSegRectF.set(start, centerY - radiusY, end, centerY + radiusY);
                mSegRectF.set(Math.round(start), Math.round(centerY - radiusY), Math.round(end),
                        Math.round(centerY + radiusY));
                canvas.drawRoundRect(mSegRectF, cornerRadius, cornerRadius, mFillPaint);
            } else if (part instanceof DrawablePoint point) {
                // TODO: b/367804171 - actually use a vector asset for the default point
                //  rather than drawing it as a box?
                mPointRectF.set(start, centerY - pointRadius, end, centerY + pointRadius);
                mPointRectF.set(Math.round(start), pointTop, Math.round(end), pointBottom);
                final float inset = mState.mPointRectInset;
                final float cornerRadius = mState.mPointRectCornerRadius;
                mPointRectF.inset(inset, inset);