Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit 7856b6c

Browse files
committed
Update PdfiumAndroid to 1.7.0
Update rendering code to directly use ARGB_8888 or RGB_565 format Update README and CHANGELOG Update version
1 parent 8c1090c commit 7856b6c

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.7.0-beta.1 (2017-07-05)
2+
* Updates PdfiumAndroid to 1.7.0 which reduces memory usage about twice and improves performance by using RGB 565 format (when not using `pdfView.setBestQuality(true)`)
3+
14
## 2.7.0-beta (2017-06-16)
25
* Update PdfiumAndroid to 1.6.1, which fixed font rendering (issue #253)
36
* Add `.spacing(int)` method to add spacing (in dp) between document pages

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Licensed under Apache License 2.0.
1818
* Add small rendering improvements
1919
* Fix rendering when duplicated pages are passed to `.pages(..)`
2020

21+
2.7.0-beta.1 updates PdfiumAndroid to 1.7.0 which reduces memory usage about twice and improves performance by using RGB 565 format (when not using `pdfView.setBestQuality(true)`)
22+
2123
This is beta release because of big number of small changes and something could go wrong (but I didn't notice)
2224

2325
## Changes in 2.0 API
@@ -33,7 +35,7 @@ This is beta release because of big number of small changes and something could
3335

3436
Add to _build.gradle_:
3537

36-
`compile 'com.github.barteksc:android-pdf-viewer:2.7.0-beta'` or `2.6.1` for more stable version
38+
`compile 'com.github.barteksc:android-pdf-viewer:2.7.0-beta.1'` or `2.6.1` for more stable version
3739

3840
Library is available in jcenter repository, probably it'll be in Maven Central soon.
3941

android-pdf-viewer/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ext {
1313
siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
1414
gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
1515

16-
libraryVersion = '2.7.0-beta'
16+
libraryVersion = '2.7.0-beta.1'
1717

1818
developerId = 'barteksc'
1919
developerName = 'Bartosz Schiller'
@@ -32,13 +32,13 @@ android {
3232
minSdkVersion 11
3333
targetSdkVersion 25
3434
versionCode 1
35-
versionName "2.7.0-beta"
35+
versionName "2.7.0-beta.1"
3636
}
3737

3838
}
3939

4040
dependencies {
41-
compile 'com.github.barteksc:pdfium-android:1.6.1'
41+
compile 'com.github.barteksc:pdfium-android:1.7.0'
4242
}
4343

4444
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/RenderingHandler.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private PagePart proceed(RenderingTask renderingTask) {
9393
int h = Math.round(renderingTask.height);
9494
Bitmap render;
9595
try {
96-
render = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
96+
render = Bitmap.createBitmap(w, h, renderingTask.bestQuality ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
9797
} catch (IllegalArgumentException e) {
9898
e.printStackTrace();
9999
return null;
@@ -103,15 +103,9 @@ private PagePart proceed(RenderingTask renderingTask) {
103103
roundedRenderBounds.left, roundedRenderBounds.top,
104104
roundedRenderBounds.width(), roundedRenderBounds.height(), renderingTask.annotationRendering);
105105

106-
if (!renderingTask.bestQuality) {
107-
Bitmap cpy = render.copy(Bitmap.Config.RGB_565, false);
108-
render.recycle();
109-
render = cpy;
110-
}
111-
112-
return new PagePart(renderingTask.userPage, renderingTask.page, render, //
113-
renderingTask.width, renderingTask.height, //
114-
renderingTask.bounds, renderingTask.thumbnail, //
106+
return new PagePart(renderingTask.userPage, renderingTask.page, render,
107+
renderingTask.width, renderingTask.height,
108+
renderingTask.bounds, renderingTask.thumbnail,
115109
renderingTask.cacheOrder);
116110
}
117111

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class Constants {
3535
public static class Cache {
3636

3737
/** The size of the cache (number of bitmaps kept) */
38-
public static int CACHE_SIZE = 150;
38+
public static int CACHE_SIZE = 120;
3939

4040
public static int THUMBNAILS_CACHE_SIZE = 6;
4141
}

0 commit comments

Comments
 (0)