diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-02 12:52:34 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-02 12:52:34 +0000 |
commit | 1c9c3e37d89d3f515ceab47e8d00f1b4d95bad41 (patch) | |
tree | 913095ec0df5a006e53a9f5dff765b5960f100a7 /platform | |
parent | 7b49feba3ae71a766cdab64bd648e49723f6c952 (diff) | |
download | mupdf-1c9c3e37d89d3f515ceab47e8d00f1b4d95bad41.tar.xz |
Bug 694753: Android: Recompute the patch on PageView.update()
In some cases freshly-created annotations could fail to appear because the HQ patch was
being left in place even when zoomed fully in, and when in that state, the patch was not
updated. The bug was usually hidden by an onLayout call being triggered with an out-
of-date patch, which causes the HQ patch to be removed. The bug is fixed by having
addHq remove the patch when fully zoomed out. Since now addHq may sometimes add
the patch and sometimes remove it, I've renamed it to updateHq.
Correctness of this fix has not been checked because I was unable to trigger the bad
behaviour on my test device.
Diffstat (limited to 'platform')
4 files changed, 12 insertions, 7 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFReaderView.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFReaderView.java index 9cab70b7..a8f41fb2 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFReaderView.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFReaderView.java @@ -240,7 +240,7 @@ public class MuPDFReaderView extends ReaderView { protected void onSettle(View v) { // When the layout has settled ask the page to render // in HQ - ((MuPDFView) v).addHq(false); + ((MuPDFView) v).updateHq(false); } protected void onUnsettle(View v) { diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java index 02a083e1..7d41a9b9 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java @@ -137,7 +137,7 @@ public class MuPDFReflowView extends WebView implements MuPDFView { public void update() { } - public void addHq(boolean update) { + public void updateHq(boolean update) { } public void removeHq() { diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFView.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFView.java index f57f7eb8..ec3d3d9a 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFView.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFView.java @@ -26,7 +26,7 @@ public interface MuPDFView { public boolean saveDraw(); public void setChangeReporter(Runnable reporter); public void update(); - public void addHq(boolean update); + public void updateHq(boolean update); public void removeHq(); public void releaseResources(); public void releaseBitmaps(); diff --git a/platform/android/src/com/artifex/mupdfdemo/PageView.java b/platform/android/src/com/artifex/mupdfdemo/PageView.java index 3e30d1e5..d835016f 100644 --- a/platform/android/src/com/artifex/mupdfdemo/PageView.java +++ b/platform/android/src/com/artifex/mupdfdemo/PageView.java @@ -573,10 +573,15 @@ public abstract class PageView extends ViewGroup { } } - public void addHq(boolean update) { + public void updateHq(boolean update) { Rect viewArea = new Rect(getLeft(),getTop(),getRight(),getBottom()); - // If the viewArea's size matches the unzoomed size, there is no need for an hq patch - if (viewArea.width() != mSize.x || viewArea.height() != mSize.y) { + if (viewArea.width() == mSize.x || viewArea.height() == mSize.y) { + // If the viewArea's size matches the unzoomed size, there is no need for an hq patch + if (mPatch != null) { + mPatch.setImageBitmap(null); + mPatch.invalidate(); + } + } else { Point patchViewSize = new Point(viewArea.width(), viewArea.height()); Rect patchArea = new Rect(0, 0, mParentSize.x, mParentSize.y); @@ -667,7 +672,7 @@ public abstract class PageView extends ViewGroup { mDrawEntire.execute(); - addHq(true); + updateHq(true); } public void removeHq() { |