Kaydet (Commit) 6ca57cb2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: fix thumbnail() to produce a valid bitmap

Change-Id: I578ac9482f334765c71a66421a3fa2dfb85e22b3
üst 58f5e531
......@@ -122,9 +122,6 @@ public class LOKitTileProvider implements TileProvider {
@Override
public Bitmap thumbnail() {
ByteBuffer buffer = ByteBuffer.allocateDirect(TILE_SIZE * TILE_SIZE * 4);
Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE, TILE_SIZE, Bitmap.Config.ARGB_8888);
int widthPixel = getPageWidth();
int heightPixel = getPageHeight();
......@@ -138,8 +135,14 @@ public class LOKitTileProvider implements TileProvider {
widthPixel = (int) (heightPixel * ratio);
}
ByteBuffer buffer = ByteBuffer.allocateDirect(widthPixel * heightPixel * 4);
mDocument.paintTile(buffer, widthPixel, heightPixel, 0, 0, (int) mWidthTwip, (int) mHeightTwip);
Bitmap bitmap = Bitmap.createBitmap(widthPixel, heightPixel, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(buffer);
if (bitmap == null) {
Log.w(LOGTAG, "Thumbnail not created!");
}
return bitmap;
}
......
......@@ -63,7 +63,7 @@ public class MockTileProvider implements TileProvider {
@Override
public Bitmap thumbnail() {
return null;
return layerController.getDrawable("dummy_page");
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment