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

Commit 106e75a0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "PointerIcon: Ensure bitmap size and hotspot are scaled consistently"...

Merge "PointerIcon: Ensure bitmap size and hotspot are scaled consistently" into main am: 4c88a552

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3445279



Change-Id: If4464ea667ac285c9f3e6b23ae7c9c5b7e278a99
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 30603c65 4c88a552
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -514,10 +514,14 @@ public final class PointerIcon implements Parcelable {
            final TypedArray a = resources.obtainAttributes(
                    parser, com.android.internal.R.styleable.PointerIcon);
            bitmapRes = a.getResourceId(com.android.internal.R.styleable.PointerIcon_bitmap, 0);
            hotSpotX = a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotX, 0)
                    * pointerScale;
            hotSpotY = a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotY, 0)
                    * pointerScale;
            // Cast the hotspot dimensions to int before scaling to match the scaling logic of
            // the bitmap, whose intrinsic size is also an int before it is scaled.
            final int unscaledHotSpotX =
                    (int) a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotX, 0);
            final int unscaledHotSpotY =
                    (int) a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotY, 0);
            hotSpotX = unscaledHotSpotX * pointerScale;
            hotSpotY = unscaledHotSpotY * pointerScale;
            a.recycle();
        } catch (Exception ex) {
            throw new IllegalArgumentException("Exception parsing pointer icon resource.", ex);