summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java12
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java4
2 files changed, 11 insertions, 5 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 99d44cf1ea6c..7888095e8352 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -27,11 +27,13 @@ public class LOKitThread extends Thread {
}
private void tileRequest(ComposedTileLayer composedTileLayer, TileIdentifier tileId) {
- mLayerClient.beginDrawing();
- CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom);
- SubTile tile = new SubTile(image, tileId);
- composedTileLayer.addTile(tile);
- mLayerClient.endDrawing(mViewportMetrics);
+ if (composedTileLayer.isStillValid(tileId)) {
+ mLayerClient.beginDrawing();
+ CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom);
+ SubTile tile = new SubTile(image, tileId);
+ composedTileLayer.addTile(tile);
+ mLayerClient.endDrawing(mViewportMetrics);
+ }
}
/** Handle the geometry change + draw. */
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 221cd8dcbbea..3c6fb8267e81 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
@@ -201,4 +201,8 @@ public abstract class ComposedTileLayer extends Layer {
tile.beginTransaction();
tiles.add(tile);
}
+
+ public boolean isStillValid(TileIdentifier tileId) {
+ return RectF.intersects(currentViewport, tileId.getRect()) || currentViewport.contains(tileId.getRect());
+ }
} \ No newline at end of file