diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2014-12-15 21:49:51 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2014-12-15 22:02:01 +0900 |
commit | 8daef3639af1d83616d455aa6f9f7757afd64d4f (patch) | |
tree | 0e05af4d622ace51858a4cd50213ce737e6b3c45 /android/experimental | |
parent | abc818facad0479a8af05e634b5375aa4abbfd35 (diff) |
android: skip tiles that are already outside of viewport
Change-Id: I65f286797b459f30885560577a4dcb3d1108c0bf
Diffstat (limited to 'android/experimental')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 12 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java | 4 |
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 |