diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-09 17:34:09 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-12 11:06:42 +0100 |
commit | 57ffd85cbd25a28c3f70e7414ee5192b65315012 (patch) | |
tree | 6b6aee25d6042a64f5a2802c30292eb39618ca83 /android | |
parent | 156411e1aa39108bdf47e39dd531484a7e7db92c (diff) |
android: react to tile invalidation request and invalidate tiles
Implement tile invalidation request in LOKitThread and pass the
request to ComposedTileLayer where it handles the invalidation
request by searching for the tiles that need to be invalidated
(intersect the invlidation rectangle).
Change-Id: I84e752486ff79e98cac1e74c6463b6748660cbed
Diffstat (limited to 'android')
3 files changed, 24 insertions, 1 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index b30e4f5a845e..98b4d034672b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -13,7 +13,7 @@ import org.mozilla.gecko.gfx.SubTile; import java.util.concurrent.PriorityBlockingQueue; -public class LOKitThread extends Thread { +public class LOKitThread extends Thread implements TileProvider.TileInvalidationCallback { private static final String LOGTAG = LOKitThread.class.getSimpleName(); private PriorityBlockingQueue<LOEvent> mEventQueue = new PriorityBlockingQueue<LOEvent>(); @@ -89,6 +89,7 @@ public class LOKitThread extends Thread { boolean isReady = mTileProvider.isReady(); if (isReady) { LOKitShell.showProgressSpinner(); + mTileProvider.registerInvalidationCallback(this); refresh(); LOKitShell.hideProgressSpinner(); } @@ -146,6 +147,12 @@ public class LOKitThread extends Thread { public void clearQueue() { mEventQueue.clear(); } + + @Override + public void invalidate(RectF rect) { + mLayerClient = mApplication.getLayerClient(); + mLayerClient.invalidateTiles(rect); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index cfff2844f5fd..c5e7f9d944e2 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -211,4 +211,15 @@ public abstract class ComposedTileLayer extends Layer { public boolean isStillValid(TileIdentifier tileId) { return RectF.intersects(currentViewport, tileId.getRect()) || currentViewport.contains(tileId.getRect()); } + + public void invalidateTiles(RectF rect) { + Log.i(LOGTAG, "invalidate: " + rect); + for (SubTile tile : tiles) { + if (RectF.intersects(rect, tile.id.getRect()) || rect.contains(tile.id.getRect())) { + tile.markForRemoval(); + LOKitShell.sendEvent(LOEventFactory.tileRequest(this, tile.id, true)); + Log.i(LOGTAG, "invalidate tile: " + tile.id); + } + } + } }
\ No newline at end of file diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 09120ec2c5e6..676e73c2638b 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -488,4 +488,9 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener { mLowResLayer.clearAndReset(); mRootLayer.clearAndReset(); } + + public void invalidateTiles(RectF rect) { + mLowResLayer.invalidateTiles(rect); + mRootLayer.invalidateTiles(rect); + } }
\ No newline at end of file |