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

Commit 96890564 authored by Chris Craik's avatar Chris Craik
Browse files

Replace native crash with IAE when calling picture.draw() w/ a HW canvas

bug:17397958
Change-Id: I75f942db0e604f9fd6ab31e6c81f718c0f57b16a
parent f634c08b
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -799,28 +799,6 @@ class GLES20Canvas extends HardwareCanvas {
        // TODO: Implement rendering
    }

    @Override
    public void drawPicture(Picture picture, Rect dst) {
        save();
        translate(dst.left, dst.top);
        if (picture.getWidth() > 0 && picture.getHeight() > 0) {
            scale(dst.width() / picture.getWidth(), dst.height() / picture.getHeight());
        }
        drawPicture(picture);
        restore();
    }

    @Override
    public void drawPicture(Picture picture, RectF dst) {
        save();
        translate(dst.left, dst.top);
        if (picture.getWidth() > 0 && picture.getHeight() > 0) {
            scale(dst.width() / picture.getWidth(), dst.height() / picture.getHeight());
        }
        drawPicture(picture);
        restore();
    }

    @Override
    public void drawPoint(float x, float y, Paint paint) {
        float[] point = getPointStorage();
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ public class Canvas {
     */
    public void setBitmap(@Nullable Bitmap bitmap) {
        if (isHardwareAccelerated()) {
            throw new RuntimeException("Can't set a bitmap device on a GL canvas");
            throw new RuntimeException("Can't set a bitmap device on a HW accelerated canvas");
        }

        if (bitmap == null) {
+5 −0
Original line number Diff line number Diff line
@@ -122,6 +122,11 @@ public class Picture {
     * @param canvas  The picture is drawn to this canvas
     */
    public void draw(Canvas canvas) {
        if (canvas.isHardwareAccelerated()) {
            throw new IllegalArgumentException(
                    "Picture playback is only supported on software canvas.");
        }

        if (mRecordingCanvas != null) {
            endRecording();
        }