CameraKit / blurkit-android

The missing Android blurring library. Fast blur-behind layout that parallels iOS.
MIT License
3.72k stars 309 forks source link

x + width must be <= bitmap.width() #27

Closed MaSiYuan closed 5 years ago

MaSiYuan commented 6 years ago

FATAL EXCEPTION: main Process: com.test.app, PID: 24005 java.lang.IllegalArgumentException: x + width must be <= bitmap.width() at android.graphics.Bitmap.createBitmap(Bitmap.java:891) at android.graphics.Bitmap.createBitmap(Bitmap.java:858) at com.wonderkiln.blurkit.BlurLayout.blur(BlurLayout.java:169) at com.wonderkiln.blurkit.BlurLayout.invalidate(BlurLayout.java:88) at com.wonderkiln.blurkit.BlurLayout$1.doFrame(BlurLayout.java:77) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:924) at android.view.Choreographer.doCallbacks(Choreographer.java:735) at android.view.Choreographer.doFrame(Choreographer.java:664) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:912) at android.os.Handler.handleCallback(Handler.java:761) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:6531) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

ghost commented 6 years ago

Same here

ghost commented 6 years ago

rightOffset = x + getWidth() - rightOffset <= screenWidth() ? rightOffset : screenWidth() + getWidth() - x;

This solves the error!!!

MaSiYuan commented 6 years ago

thank you @gtaricsi

nimrodbens commented 6 years ago

@MaSiYuan does this happen to you after you no longer need the blur view?

ghost commented 6 years ago

@nimrodbens it happened to me after rotating screen and enabling blur again

nimrodbens commented 6 years ago

I'm just throwing out guesses here but did you call invalidate() after the screen was rotated? maybe also call pauseBlur() before you rotate the screen and then invalidate() and startBlur() afterwards. it is for sure sounds like a problem with the different widths and heights of the different screen orientations.

PavelSynek commented 6 years ago

@gtaricsi Thanks, it works!