summaryrefslogtreecommitdiff
path: root/android/experimental
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-07-28 08:36:43 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-08-03 22:42:18 +0200
commit3086d7114d8dbb744e87cca966426d50c0cbfdd6 (patch)
tree0d36018e58127e3ae088d0643fd3f613b76c6c52 /android/experimental
parent0e6b06aae0432d5580762469a7f090c8c360da1e (diff)
LOAndroid3: extract some repeated access to local variables
Change-Id: I1bf6f23247da73eeccde569f220095d0e1716d0a
Diffstat (limited to 'android/experimental')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index c418b4c40c7a..58339bfa1554 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -5,6 +5,7 @@ import android.graphics.RectF;
import android.util.Log;
import org.mozilla.gecko.gfx.FloatSize;
+import org.mozilla.gecko.gfx.GeckoLayerClient;
import org.mozilla.gecko.gfx.SubTile;
import org.mozilla.gecko.gfx.ViewportMetrics;
@@ -32,10 +33,13 @@ public class LOKitThread extends Thread {
mViewportMetrics = new ViewportMetrics();
mViewportMetrics.setPageSize(new FloatSize(pageWidth, pageHeight));
- RectF viewport = mApplication.getLayerController().getViewportMetrics().getClampedViewport();
- float zoomFactor = mApplication.getLayerController().getViewportMetrics().getZoomFactor();
+ GeckoLayerClient layerClient = mApplication.getLayerClient();
+ ViewportMetrics metrics = mApplication.getLayerController().getViewportMetrics();
- boolean shouldContinue = mApplication.getLayerClient().beginDrawing(mViewportMetrics);
+ RectF viewport = metrics.getClampedViewport();
+ float zoomFactor = metrics.getZoomFactor();
+
+ boolean shouldContinue = layerClient.beginDrawing(mViewportMetrics);
if (!shouldContinue) {
return false;
@@ -53,12 +57,12 @@ public class LOKitThread extends Thread {
Math.round(maxY / zoomFactor));
ArrayList<SubTile> removeTiles = new ArrayList<SubTile>();
- for (SubTile tile : mApplication.getLayerClient().getTiles()) {
+ for (SubTile tile : layerClient.getTiles()) {
if (!rect.intersects(tile.x, tile.y, tile.x + TILE_SIZE, tile.y + TILE_SIZE)) {
removeTiles.add(tile);
}
}
- mApplication.getLayerClient().getTiles().removeAll(removeTiles);
+ layerClient.getTiles().removeAll(removeTiles);
for (int y = minY; y <= maxY; y+=TILE_SIZE) {
for (int x = minX; x <= maxX; x+=TILE_SIZE) {
@@ -69,19 +73,19 @@ public class LOKitThread extends Thread {
continue;
}
boolean contains = false;
- for (SubTile tile : mApplication.getLayerClient().getTiles()) {
+ for (SubTile tile : layerClient.getTiles()) {
if (tile.x == x && tile.y == y) {
contains = true;
}
}
if (!contains) {
SubTile tile = mTileProvider.createTile(x, y);
- mApplication.getLayerClient().addTile(tile);
+ layerClient.addTile(tile);
}
}
}
- mApplication.getLayerClient().endDrawing();
+ layerClient.endDrawing();
return true;
}