use of org.ebookdroid.common.bitmaps.Bitmaps in project LibreraReader by foobnix.
the class PageTreeNode method decodeComplete.
@Override
public void decodeComplete(final CodecPage codecPage, final BitmapRef bitmap, final Rect bitmapBounds, final RectF croppedPageBounds) {
try {
if (bitmap == null || bitmapBounds == null) {
page.base.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
stopDecodingThisNode(null);
}
});
return;
}
final Bitmaps bitmaps = holder.reuse(fullId, bitmap, bitmapBounds);
final Runnable r = new Runnable() {
@Override
public void run() {
// long t0 = System.currentTimeMillis();
holder.setBitmap(bitmaps);
stopDecodingThisNode(null);
final IViewController dc = page.base.getDocumentController();
if (dc instanceof AbstractViewController) {
EventPool.newEventChildLoaded((AbstractViewController) dc, PageTreeNode.this, bitmapBounds).process();
}
// System.out.println("decodeComplete(): " + (System.currentTimeMillis() - t0) + " ms");
}
};
page.base.getActivity().runOnUiThread(r);
} catch (final OutOfMemoryError ex) {
ex.printStackTrace();
BitmapManager.clear("PageTreeNode OutOfMemoryError: ");
page.base.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
stopDecodingThisNode(null);
}
});
} finally {
BitmapManager.release(bitmap);
}
}
use of org.ebookdroid.common.bitmaps.Bitmaps in project LibreraReader by foobnix.
the class DocumentModel method recyclePages.
public void recyclePages() {
if (LengthUtils.isNotEmpty(pages)) {
final List<Bitmaps> bitmapsToRecycle = new ArrayList<Bitmaps>();
for (final Page page : pages) {
page.recycle(bitmapsToRecycle);
}
BitmapManager.release(bitmapsToRecycle);
BitmapManager.release();
}
pages = EMPTY_PAGES;
}
Aggregations