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

Commit 32047b7c authored by Todd Lee's avatar Todd Lee
Browse files

Origin transitions with uniform scaling

Bug: b/378975686
Bug: b/384712088
Test: presubmits + manual UX verificaiton on launches
Flag: NONE exempt change for UX spec impl

Change-Id: I4eac230809a26c9431095a81e07895b4139bacf8
parent 429bd452
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -209,30 +209,32 @@ public class ViewUIComponent implements UIComponent {
        if (mVisibleOverride) {
            Rect renderBounds = getBounds();
            canvas.translate(renderBounds.left, renderBounds.top);
            canvas.scale(
                    (float) renderBounds.width() / realBounds.width(),
                    (float) renderBounds.height() / realBounds.height());

            float cornerRadius = (float) Math.min(renderBounds.width(), renderBounds.height()) / 2;

            if (mEnableBackgroundDimming) {
                // draw backing layer for background dimming using bounds/radius
                mPaint.setColor(Color.BLACK);
                mPaint.setStyle(Paint.Style.FILL);
                // TODO: use corner radius for drawing
                canvas.drawRoundRect(
                        renderBounds.left,
                        renderBounds.top,
                        renderBounds.right,
                        renderBounds.bottom,
                        renderBounds.width() / 2,
                        renderBounds.height() / 2,
                        0,
                        0,
                        renderBounds.width(),
                        renderBounds.height(),
                        cornerRadius,
                        cornerRadius,
                        mPaint);
            }

            canvas.scale(
                    (float) renderBounds.width() / realBounds.width(),
                    (float) renderBounds.height() / realBounds.height());

            if (mView.getClipToOutline()) {
                mView.getOutlineProvider().getOutline(mView, mClippingOutline);
                mClippingPath.reset();
                RectF rect = new RectF(0, 0, mView.getWidth(), mView.getHeight());
                final float cornerRadius = mClippingOutline.getRadius();
                cornerRadius = mClippingOutline.getRadius();
                mClippingPath.addRoundRect(rect, cornerRadius, cornerRadius, Path.Direction.CW);
                mClippingPath.close();
                canvas.clipPath(mClippingPath);