SunakshiGautam / ebookdroid

Automatically exported from code.google.com/p/ebookdroid
0 stars 0 forks source link

Null pointer exception while draw on devices with hardware acceleration #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It is Android bug. More information is here: 
code.google.com/p/android/issues/detail?id=24830

06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328): 
java.lang.NullPointerException
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:611)
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:90)
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
org.ebookdroid.common.bitmaps.Bitmaps.draw(Bitmaps.java:238)
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
org.ebookdroid.core.PageTreeNode$BitmapHolder.drawBitmap(PageTreeNode.java:261)
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
org.ebookdroid.core.EventDraw.process(EventDraw.java:119)
06-13 18:51:30.731: E/EBookDroid.BitmapManager(11328):  at 
org.ebookdroid.core.PageTree.process(PageTree.java:53)

...

To work around bug just replace:

canvas.drawBitmap(ref.bitmap, null, MathUtils.round(r), paint.bitmapPaint); 

with:

canvas.drawBitmap(ref.bitmap, new Rect(0, 0, ref.bitmap.getWidth(), 
ref.bitmap.getHeight()), MathUtils.round(r), paint.bitmapPaint);

at: 
http://code.google.com/p/ebookdroid/source/browse/trunk/src/org/ebookdroid/commo
n/bitmaps/Bitmaps.java#238

Original issue reported on code.google.com by NKuznet...@gmail.com on 13 Jun 2012 at 1:29

GoogleCodeExporter commented 9 years ago
Fixed both in trunk and 1.4.x branch.

Original comment by Alexander.V.Kasatkin@gmail.com on 13 Jun 2012 at 1:49