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

Commit 6cfb081c authored by Ruben Brunk's avatar Ruben Brunk
Browse files

G+ crop overlay shadows. Aspect ratios.

Bug: 8597538

Change-Id: I9a7225a125bef7e11d6bf420bf1fa55e7f22c909
parent e51f236b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.gallery3d.filtershow.crop;

import android.graphics.Canvas;
@@ -91,6 +92,15 @@ public abstract class CropDrawingUtils {
        }
    }

    public static void drawShadows(Canvas canvas, Paint p, RectF innerBounds, RectF outerBounds) {
        canvas.drawRect(outerBounds.left, outerBounds.top, innerBounds.right, innerBounds.top, p);
        canvas.drawRect(innerBounds.right, outerBounds.top, outerBounds.right, innerBounds.bottom,
                p);
        canvas.drawRect(innerBounds.left, innerBounds.bottom, outerBounds.right,
                outerBounds.bottom, p);
        canvas.drawRect(outerBounds.left, innerBounds.top, innerBounds.left, outerBounds.bottom, p);
    }

    public static Matrix getBitmapToDisplayMatrix(RectF imageBounds, RectF displayBounds) {
        Matrix m = new Matrix();
        CropDrawingUtils.setBitmapToDisplayMatrix(m, imageBounds, displayBounds);
+2 −2
Original line number Diff line number Diff line
@@ -194,9 +194,9 @@ public class CropMath {
        float finalW = origW;
        float finalH = origH;
        if (origA < a) {
            finalH = origH / a;
            finalH = origW / a;
        } else {
            finalW = origW * a;
            finalW = origH * a;
        }
        float centX = r.centerX();
        float centY = r.centerY();
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public class CropObject {
            throw new IllegalArgumentException("bad edge selected");
            // return false;
        }
        if ((mFixAspectRatio && !checkCorner(edge)) && !checkBlock(edge)) {
        if ((mFixAspectRatio && !checkCorner(edge)) && !checkBlock(edge) && edge != MOVE_NONE) {
            // temporary
            throw new IllegalArgumentException("bad corner selected");
            // return false;