diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2013-12-18 15:09:08 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2013-12-18 15:12:29 +0000 |
commit | e87dc713a74d9d0ab18931e8dd9633ea80767fc3 (patch) | |
tree | eacf5090f4f7fa1bd97e5ad9b4bd813f19cd9e5d /platform/android/src/com/artifex/mupdfdemo/PageView.java | |
parent | 2f264787e9dac0fdcbadfe431f549f18b4d3aafb (diff) | |
download | mupdf-e87dc713a74d9d0ab18931e8dd9633ea80767fc3.tar.xz |
Android: a few improvements to the view handling
While scrolling, avoid some overheads to do with image scaling that
need updating only on a zoom-level change
Remove a pointless invalidate call.
Avoid calls to removeViewInLayout and removeAllViewsInLayout that
were being made in functions not called from onLayout
Diffstat (limited to 'platform/android/src/com/artifex/mupdfdemo/PageView.java')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/PageView.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/PageView.java b/platform/android/src/com/artifex/mupdfdemo/PageView.java index cc00e004..3e30d1e5 100644 --- a/platform/android/src/com/artifex/mupdfdemo/PageView.java +++ b/platform/android/src/com/artifex/mupdfdemo/PageView.java @@ -539,9 +539,11 @@ public abstract class PageView extends ViewGroup { int h = bottom-top; if (mEntire != null) { - mEntireMat.setScale(w/(float)mSize.x, h/(float)mSize.y); - mEntire.setImageMatrix(mEntireMat); - mEntire.invalidate(); + if (mEntire.getWidth() != w || mEntire.getHeight() != h) { + mEntireMat.setScale(w/(float)mSize.x, h/(float)mSize.y); + mEntire.setImageMatrix(mEntireMat); + mEntire.invalidate(); + } mEntire.layout(0, 0, w, h); } @@ -631,7 +633,6 @@ public abstract class PageView extends ViewGroup { // Calling requestLayout here doesn't lead to a later call to layout. No idea // why, but apparently others have run into the problem. mPatch.layout(mPatchArea.left, mPatchArea.top, mPatchArea.right, mPatchArea.bottom); - invalidate(); } }; |