danopdev / Perspective

Android application for correcting perspective in photos.
MIT License
27 stars 4 forks source link

java.lang.RuntimeException: Canvas: trying to draw too large bitmap. #5

Open ErrrorMaxx opened 9 months ago

ErrrorMaxx commented 9 months ago

When trying to load photo made by my phone (64MP, 6912x9216px), Perspective crashes with this error:

java.lang.RuntimeException: Canvas: trying to draw too large(254803968bytes) bitmap.
    at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
    at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
    at com.dan.perspective.TouchImageView.onDraw(Unknown Source:96)
    at com.dan.perspective.EditPerspectiveImageView.onDraw(Unknown Source:0)
    at android.view.View.draw(View.java:23354)
    at android.view.View.updateDisplayListIfDirty(View.java:22181)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(Unknown Source:30)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.updateDisplayListIfDirty(View.java:22172)
    at android.view.View.draw(View.java:23071)
    at android.view.ViewGroup.drawChild(ViewGroup.java:4619)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4380)
    at android.view.View.draw(View.java:23361)
    at com.android.internal.policy.DecorView.draw(DecorView.java:847)
    at android.view.View.updateDisplayListIfDirty(View.java:22181)
    at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:682)
    at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:688)
    at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:786)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:4890)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4589)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3792)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2519)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9516)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1326)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1334)
    at android.view.Choreographer.doCallbacks(Choreographer.java:967)
    at android.view.Choreographer.doFrame(Choreographer.java:881)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1309)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:204)
    at android.os.Looper.loop(Looper.java:291)
    at android.app.ActivityThread.main(ActivityThread.java:8129)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)

P.S. Android 13, F-Droid build

pempek commented 6 months ago

I believe I'm experiencing similar issue.

Whenever I try to open a 40MP image, the app immediately crashes.

Android 14, One UI 6.1, app v1.17; f-droid build.