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

Commit fb2b30bf authored by Jorge Ruesga's avatar Jorge Ruesga
Browse files

trebuchet: ensure crop bounds



Ensure that crop rect is not bigger than original bitmap size

Change-Id: Ifb2b261411a75c9792d34b925e3ff3d3c2bde59d
JIRA: BUGDUMP-3529433
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 92bdfc02
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -698,10 +698,10 @@ public class WallpaperCropActivity extends Activity {
                            // Adjust the width
                            roundedTrueCrop.right = roundedTrueCrop.left + fullSize.getWidth();
                        }
                        if (roundedTrueCrop.right > fullSize.getWidth()) {
                        if (roundedTrueCrop.right >= fullSize.getWidth()) {
                            // Adjust the left value
                            int adjustment = roundedTrueCrop.left -
                                    Math.max(0, roundedTrueCrop.right - roundedTrueCrop.width());
                            int adjustment = Math.max(0,
                                    roundedTrueCrop.right - fullSize.getWidth());
                            roundedTrueCrop.left -= adjustment;
                            roundedTrueCrop.right -= adjustment;
                        }
@@ -709,10 +709,10 @@ public class WallpaperCropActivity extends Activity {
                            // Adjust the height
                            roundedTrueCrop.bottom = roundedTrueCrop.top + fullSize.getHeight();
                        }
                        if (roundedTrueCrop.bottom > fullSize.getHeight()) {
                        if (roundedTrueCrop.bottom >= fullSize.getHeight()) {
                            // Adjust the top value
                            int adjustment = roundedTrueCrop.top -
                                    Math.max(0, roundedTrueCrop.bottom - roundedTrueCrop.height());
                            int adjustment = Math.max(0,
                                    roundedTrueCrop.bottom - fullSize.getHeight());
                            roundedTrueCrop.top -= adjustment;
                            roundedTrueCrop.bottom -= adjustment;
                        }