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

Commit def8a371 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Replace native crash with IAE when calling picture.draw() w/ a HW canvas" into lmp-dev

parents 0edfd0be 96890564
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();
        }