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

Commit 1046a23a authored by nicolasroard's avatar nicolasroard
Browse files

Fix ANR in image editor

bug:7275425
Change-Id: I01a89579e17a0e4fc0817b61c7fda48ca54d0afa
parent 45e666c6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -25,9 +25,8 @@ public class ImageFilterGradient extends ImageFilter {
    @Override
    public ImageFilter clone() throws CloneNotSupportedException {
        ImageFilterGradient filter = (ImageFilterGradient) super.clone();
        for (int i = 0; i < mColors.length; i++) {
            filter.addColor(mColors[i], mPositions[i]);
        }
        System.arraycopy(mColors, 0, filter.mColors, 0, mColors.length);
        System.arraycopy(mPositions, 0, filter.mPositions, 0, mPositions.length);
        return filter;
    }

+7 −7
Original line number Diff line number Diff line
@@ -89,12 +89,19 @@ public class ImageStraighten extends ImageShow {

    public void setActionUp() {
        mMode = MODES.UP;
        updatePreset();
    }

    public void setNoAction() {
        mMode = MODES.NONE;
    }

    private void updatePreset() {
        ImagePreset copy = new ImagePreset(getImagePreset());
        copy.setStraightenRotation(mImageRotation, mImageRotationZoomFactor);
        setImagePreset(copy);
    }

    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getActionMasked()) {
            case (MotionEvent.ACTION_DOWN):
@@ -232,13 +239,6 @@ public class ImageStraighten extends ImageShow {

        mImageRotationZoomFactor = (float) (rw / boundsRect.width());

        ImagePreset copy = new ImagePreset(getImagePreset());
        Log.v(LOGTAG, "creating a new image preset with rotation " + mImageRotation
                + " and zoom factor: " + mImageRotationZoomFactor);

        copy.setStraightenRotation(mImageRotation, mImageRotationZoomFactor);
        setImagePreset(copy);

        if (mMode == MODES.MOVE) {
            canvas.save();
            canvas.clipPath(path);