[Libreoffice-commits] core.git: 2 commits - android/experimental
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Fri Jul 4 10:57:43 PDT 2014
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java | 12 -
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 87 +---------
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 57 ++++--
android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java | 27 ++-
android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java | 4
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java | 7
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java | 27 ---
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java | 24 --
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java | 1
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java | 6
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java | 3
11 files changed, 93 insertions(+), 162 deletions(-)
New commits:
commit ff6aac4167dc72c6546ebfa43f9ede81247c1741
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Jul 4 19:31:54 2014 +0200
LOAndroid3: Simplify begin/endDrawing calls, remove JSON metadata
Change-Id: Ie8aadd20095eeea05110032ac026a6027771aab8
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
index 9d0dec7..e4f6b08 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
@@ -18,7 +18,7 @@ public class LOKitShell {
public static int getDpi() {
DisplayMetrics metrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
- return (int) metrics.density * 200;
+ return (int) metrics.density * 160;
}
public static ByteBuffer allocateDirectBuffer(int size) {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 7539d71..63bc72b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -8,6 +8,7 @@ import android.graphics.Rect;
import android.util.JsonWriter;
import android.util.Log;
+import org.mozilla.gecko.gfx.FloatSize;
import org.mozilla.gecko.gfx.SubTile;
import org.mozilla.gecko.gfx.ViewportMetrics;
@@ -18,8 +19,10 @@ import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
public class LOKitThread extends Thread {
- private static final String LOGTAG = "GeckoThread";
+ private static final String LOGTAG = LOKitThread.class.getSimpleName();
+
private static final int TILE_SIZE = 256;
+ private LibreOfficeMainActivity mApplication;
private TileProvider mTileProvider;
public ConcurrentLinkedQueue<LOEvent> gEvents = new ConcurrentLinkedQueue<LOEvent>();
@@ -29,90 +32,34 @@ public class LOKitThread extends Thread {
}
private boolean draw() throws InterruptedException {
- final LibreOfficeMainActivity application = LibreOfficeMainActivity.mAppContext;
-
- if (mTileProvider == null)
- mTileProvider = new LOKitTileProvider(application.getLayerController());
-
int pageWidth = mTileProvider.getPageWidth();
int pageHeight = mTileProvider.getPageHeight();
- String metadata = createJson(0, 0, pageWidth, pageHeight, pageWidth, pageHeight, 0, 0, 1.0);
mViewportMetrics = new ViewportMetrics();
+ mViewportMetrics.setPageSize(new FloatSize(pageWidth, pageHeight));
- boolean shouldContinue = application.getLayerClient().beginDrawing(pageWidth, pageHeight, TILE_SIZE, TILE_SIZE, metadata);
+ boolean shouldContinue = mApplication.getLayerClient().beginDrawing(mViewportMetrics);
if (!shouldContinue) {
return false;
}
- Log.i(LOGTAG, "Filling tiles..");
-
for (SubTile tile : mTileProvider.getTileIterator()) {
- application.getLayerClient().addTile(tile);
+ mApplication.getLayerClient().addTile(tile);
}
- Log.i(LOGTAG, "End Draw");
-
- application.getLayerClient().endDrawing(0, 0, pageWidth, pageHeight);
+ mApplication.getLayerClient().endDrawing();
return true;
}
- private String createJson(ViewportMetrics viewportMetrics) {
- return createJson(
- (int) viewportMetrics.getOrigin().x,
- (int) viewportMetrics.getOrigin().y,
- (int) viewportMetrics.getSize().width,
- (int) viewportMetrics.getSize().height,
- (int) viewportMetrics.getPageSize().width,
- (int) viewportMetrics.getPageSize().height,
- (int) viewportMetrics.getViewportOffset().x,
- (int) viewportMetrics.getViewportOffset().y,
- viewportMetrics.getZoomFactor());
- }
-
- private String createJson(int x, int y, int width, int height, int pageWidth, int pageHeight, int offsetX, int offsetY, double zoom) {
- try {
- StringWriter stringWriter = new StringWriter();
- JsonWriter writer = new JsonWriter(stringWriter);
- writer.beginObject();
- writer.name("x").value(x);
- writer.name("y").value(y);
- writer.name("width").value(width);
- writer.name("height").value(height);
- writer.name("pageWidth").value(pageWidth);
- writer.name("pageHeight").value(pageHeight);
- writer.name("offsetX").value(offsetX);
- writer.name("offsetY").value(offsetY);
- writer.name("zoom").value(zoom);
- writer.name("backgroundColor").value("rgb(255,255,255)");
- writer.endObject();
- writer.close();
- return stringWriter.toString();
- } catch (IOException ex) {
- }
- return null;
- }
-
- private short convertTo16Bit(int color) {
- int r = Color.red(color) >> 3, g = Color.green(color) >> 2, b = Color.blue(color) >> 3;
- int c = ((r << 11) | (g << 5) | b);
- // Swap endianness.
- return (short) ((c >> 8) | ((c & 0xff) << 8));
+ private void initialize() {
+ mApplication = LibreOfficeMainActivity.mAppContext;
+ mTileProvider = new LOKitTileProvider(mApplication.getLayerController());
}
- private Bitmap convert(Bitmap bitmap, Bitmap.Config config) {
- Bitmap convertedBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), config);
- Canvas canvas = new Canvas(convertedBitmap);
- Paint paint = new Paint();
- paint.setColor(Color.BLACK);
- canvas.drawBitmap(bitmap, 0, 0, paint);
- return convertedBitmap;
- }
-
-
public void run() {
+ initialize();
try {
boolean drawn = false;
while (true) {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index e43e401..32bfe30 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -88,8 +88,8 @@ public class LOKitTileProvider implements TileProvider {
ByteBuffer buffer = ByteBuffer.allocateDirect(TILE_SIZE * TILE_SIZE * 4);
Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE, TILE_SIZE, Bitmap.Config.ARGB_8888);
- mDocument.paintTile(buffer, TILE_SIZE, TILE_SIZE, (int) Math.round(mPositionWidth), (int) Math.round(mPositionHeight), (int) Math.round(mTileWidth + pixelToTwip(1, mDPI)), (int) Math.round(mTileHeight+ pixelToTwip(1, mDPI)));
-
+ mDocument.paintTile(buffer, TILE_SIZE, TILE_SIZE,
+ (int) Math.round(mPositionWidth), (int) Math.round(mPositionHeight), (int) Math.round(mTileWidth + pixelToTwip(1, mDPI)), (int) Math.round(mTileHeight+ pixelToTwip(1, mDPI)));
bitmap.copyPixelsFromBuffer(buffer);
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 c196cf8..d7fe6b3 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
@@ -89,7 +89,7 @@ public abstract class GeckoLayerClient implements GeckoEventListener {
protected abstract boolean setupLayer();
- protected abstract void updateLayerAfterDraw(Rect updatedRect);
+ protected abstract void updateLayerAfterDraw();
protected abstract IntSize getBufferSize();
@@ -109,38 +109,23 @@ public abstract class GeckoLayerClient implements GeckoEventListener {
sendResizeEventIfNecessary();
}
- public boolean beginDrawing(int width, int height, int tileWidth, int tileHeight, String metadata) {
- Log.e(LOGTAG, "### beginDrawing " + width + " " + height + " " + tileWidth + " " + tileHeight);
-
+ public boolean beginDrawing(ViewportMetrics viewportMetrics) {
if (setupLayer()) {
Log.e(LOGTAG, "### Cancelling due to layer setup");
return false;
}
-
- try {
- JSONObject viewportObject = new JSONObject(metadata);
- mNewGeckoViewport = new ViewportMetrics(viewportObject);
- Log.e(LOGTAG, "### beginDrawing new Gecko viewport " + mNewGeckoViewport);
- } catch (JSONException e) {
- Log.e(LOGTAG, "Aborting draw, bad viewport description: " + metadata);
- return false;
- }
-
+ mNewGeckoViewport = viewportMetrics;
mTileLayer.beginTransaction();
+
return true;
}
- /*
- * TODO: Would be cleaner if this took an android.graphics.Rect instead, but that would require
- * a little more JNI magic.
- */
- public void endDrawing(int x, int y, int width, int height) {
+ public void endDrawing() {
synchronized (mLayerController) {
try {
updateViewport(!mUpdateViewportOnEndDraw);
mUpdateViewportOnEndDraw = false;
- Rect rect = new Rect(x, y, x + width, y + height);
- updateLayerAfterDraw(rect);
+ updateLayerAfterDraw();
} finally {
mTileLayer.endTransaction();
}
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
index 58e6263..e09e727 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
@@ -105,25 +105,9 @@ public class GeckoSoftwareLayerClient extends GeckoLayerClient {
}
@Override
- public boolean beginDrawing(int width, int height, int tileWidth, int tileHeight, String metadata) {
- boolean shouldContinue = super.beginDrawing(width, height, tileWidth, tileHeight, metadata);
-
- if (!shouldContinue) {
- return shouldContinue;
- }
-
- // If the window size has changed, reallocate the buffer to match.
- if (mBufferSize.width != width || mBufferSize.height != height) {
- mBufferSize = new IntSize(width, height);
- }
-
- return shouldContinue;
- }
-
- @Override
- protected void updateLayerAfterDraw(Rect updatedRect) {
+ protected void updateLayerAfterDraw() {
if (mTileLayer instanceof MultiTileLayer) {
- ((MultiTileLayer)mTileLayer).invalidate(updatedRect);
+ ((MultiTileLayer)mTileLayer).invalidate();
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java
index 4078653..b70c88e 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java
@@ -195,6 +195,7 @@ public abstract class Layer {
* update is complete.
*/
protected boolean performUpdates(RenderContext context) {
+
if (mNewOrigin != null) {
mOrigin = mNewOrigin;
mNewOrigin = null;
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
index 56ff5ec..65f4e79 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
@@ -53,8 +53,6 @@ import java.util.ArrayList;
/**
* Encapsulates the logic needed to draw a layer made of multiple tiles.
- * <p/>
- * TODO: Support repeating.
*/
public class MultiTileLayer extends Layer {
private static final String LOGTAG = "GeckoMultiTileLayer";
commit 81df594b4fbb147d3e4b3cb31ae27ff7f66d83b4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Jul 4 18:47:50 2014 +0200
LOAndroid3: use device DPI, push more resp. to TileProvider
Change-Id: I603bf2697d9afbac7a9cb4eae9d1c0da92bb9e93
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
index 9dde790..9d0dec7 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
@@ -17,15 +17,8 @@ public class LOKitShell {
private static final String LOGTAG = LOKitShell.class.getSimpleName();
public static int getDpi() {
- return 96;
- }
-
- public static int getScreenDepth() {
- return 24;
- }
-
- public static float computeRenderIntegrity() {
- return 0.0f;
+ DisplayMetrics metrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
+ return (int) metrics.density * 200;
}
public static ByteBuffer allocateDirectBuffer(int size) {
@@ -44,7 +37,6 @@ public class LOKitShell {
return directBuffer;
}
-
public static void freeDirectBuffer(ByteBuffer buffer) {
if (buffer == null) {
return;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 9082575..7539d71 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -8,6 +8,7 @@ import android.graphics.Rect;
import android.util.JsonWriter;
import android.util.Log;
+import org.mozilla.gecko.gfx.SubTile;
import org.mozilla.gecko.gfx.ViewportMetrics;
import java.io.IOException;
@@ -47,15 +48,8 @@ public class LOKitThread extends Thread {
Log.i(LOGTAG, "Filling tiles..");
- int x = 0;
- int y = 0;
- for (Bitmap bitmap : mTileProvider.getTileIterator()) {
- application.getLayerClient().addTile(bitmap, x, y);
- x += TILE_SIZE;
- if (x > pageWidth) {
- x = 0;
- y += TILE_SIZE;
- }
+ for (SubTile tile : mTileProvider.getTileIterator()) {
+ application.getLayerClient().addTile(tile);
}
Log.i(LOGTAG, "End Draw");
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 4b6d8fa..e43e401 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -3,6 +3,8 @@ package org.libreoffice;
import android.graphics.Bitmap;
import android.util.Log;
+import org.mozilla.gecko.gfx.BufferedCairoImage;
+import org.mozilla.gecko.gfx.CairoImage;
import org.mozilla.gecko.gfx.LayerController;
import java.nio.ByteBuffer;
@@ -11,6 +13,7 @@ import java.util.Iterator;
import org.libreoffice.kit.LibreOfficeKit;
import org.libreoffice.kit.Office;
import org.libreoffice.kit.Document;
+import org.mozilla.gecko.gfx.SubTile;
public class LOKitTileProvider implements TileProvider {
private final LayerController mLayerController;
@@ -20,8 +23,19 @@ public class LOKitTileProvider implements TileProvider {
public final Office mOffice;
public final Document mDocument;
+ private double mDPI;
+
+ private double twipToPixel(double input, double dpi) {
+ return input / 1440.0 * dpi;
+ }
+
+ private double pixelToTwip(double input, double dpi) {
+ return (input / dpi) * 1440.0;
+ }
+
public LOKitTileProvider(LayerController layerController) {
- this.mLayerController = layerController;
+ mLayerController = layerController;
+ mDPI = (double) LOKitShell.getDpi();
LibreOfficeKit.putenv("SAL_LOG=+WARN+INFO-INFO.legacy.osl-INFO.i18nlangtag");
LibreOfficeKit.init(LibreOfficeMainActivity.mAppContext);
@@ -32,62 +46,69 @@ public class LOKitTileProvider implements TileProvider {
@Override
public int getPageWidth() {
- return (int) (mDocument.getDocumentWidth() / 1440.0 * LOKitShell.getDpi());
+ return (int) twipToPixel(mDocument.getDocumentWidth(), mDPI);
}
@Override
public int getPageHeight() {
- return (int) (mDocument.getDocumentHeight() / 1440.0 * LOKitShell.getDpi());
+ return (int) twipToPixel(mDocument.getDocumentHeight(), mDPI);
}
public TileIterator getTileIterator() {
return new LoKitTileIterator();
}
- public class LoKitTileIterator implements TileIterator, Iterator<Bitmap> {
+ public class LoKitTileIterator implements TileIterator, Iterator<SubTile> {
private final double mTileWidth;
private final double mTileHeight;
- private boolean mShouldContinue = true;
-
private double mPositionWidth = 0;
private double mPositionHeight = 0;
+ private int mX = 0;
+ private int mY = 0;
private double mPageWidth;
private double mPageHeight;
public LoKitTileIterator() {
- mTileWidth = (TILE_SIZE / (double) LOKitShell.getDpi()) * 1440.0;
- mTileHeight = (TILE_SIZE / (double) LOKitShell.getDpi()) * 1440.0;
+ mTileWidth = pixelToTwip(TILE_SIZE, mDPI);
+ mTileHeight = pixelToTwip(TILE_SIZE, mDPI);
+
mPageWidth = mDocument.getDocumentWidth();
mPageHeight = mDocument.getDocumentHeight();
}
@Override
public boolean hasNext() {
- return mShouldContinue;
+ return mPositionHeight <= mPageHeight;
}
@Override
- public Bitmap next() {
+ public SubTile next() {
ByteBuffer buffer = ByteBuffer.allocateDirect(TILE_SIZE * TILE_SIZE * 4);
Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE, TILE_SIZE, Bitmap.Config.ARGB_8888);
- mDocument.paintTile(buffer, TILE_SIZE, TILE_SIZE, (int) mPositionWidth, (int) mPositionHeight, (int) mTileWidth, (int) mTileHeight);
+ mDocument.paintTile(buffer, TILE_SIZE, TILE_SIZE, (int) Math.round(mPositionWidth), (int) Math.round(mPositionHeight), (int) Math.round(mTileWidth + pixelToTwip(1, mDPI)), (int) Math.round(mTileHeight+ pixelToTwip(1, mDPI)));
+
+
+ bitmap.copyPixelsFromBuffer(buffer);
+
+ CairoImage image = new BufferedCairoImage(bitmap);
+ SubTile tile = new SubTile(image, mX, mY);
+ tile.beginTransaction();
mPositionWidth += mTileWidth;
+ mX += TILE_SIZE;
if (mPositionWidth > mPageWidth) {
mPositionHeight += mTileHeight;
- mPositionWidth = 0;
- }
+ mY += TILE_SIZE;
- if (mPositionHeight > mPageHeight || mPositionHeight > 20000) {
- mShouldContinue = false;
+ mPositionWidth = 0;
+ mX = 0;
}
- bitmap.copyPixelsFromBuffer(buffer);
- return bitmap;
+ return tile;
}
@Override
@@ -96,7 +117,7 @@ public class LOKitTileProvider implements TileProvider {
}
@Override
- public Iterator<Bitmap> iterator() {
+ public Iterator<SubTile> iterator() {
return this;
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
index 04ebfb4..ab535a9 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
@@ -3,13 +3,17 @@ package org.libreoffice;
import android.graphics.Bitmap;
import org.apache.http.MethodNotSupportedException;
+import org.mozilla.gecko.gfx.BufferedCairoImage;
+import org.mozilla.gecko.gfx.CairoImage;
import org.mozilla.gecko.gfx.LayerController;
+import org.mozilla.gecko.gfx.SubTile;
import java.util.Iterator;
import java.util.List;
public class MockTileProvider implements TileProvider {
private final LayerController layerController;
+ private static final int TILE_SIZE = 256;
public MockTileProvider(LayerController layerController) {
this.layerController = layerController;
@@ -29,11 +33,14 @@ public class MockTileProvider implements TileProvider {
return new MockTileIterator(layerController);
}
- public class MockTileIterator implements TileIterator, Iterator<Bitmap> {
+ public class MockTileIterator implements TileIterator, Iterator<SubTile> {
private final LayerController layerController;
private int tileNumber = 1;
+ private int x = 0;
+ private int y = 0;
+
public MockTileIterator(LayerController layerController) {
this.layerController = layerController;
}
@@ -44,11 +51,23 @@ public class MockTileProvider implements TileProvider {
}
@Override
- public Bitmap next() {
+ public SubTile next() {
String imageName = "d" + tileNumber;
tileNumber++;
Bitmap bitmap = layerController.getDrawable(imageName);
- return bitmap;
+
+ CairoImage image = new BufferedCairoImage(bitmap);
+ SubTile tile = new SubTile(image, x, y);
+ tile.beginTransaction();
+
+ x += TILE_SIZE;
+
+ if (x > getPageWidth()) {
+ x = 0;
+ y += TILE_SIZE;
+ }
+
+ return tile;
}
@Override
@@ -57,7 +76,7 @@ public class MockTileProvider implements TileProvider {
}
@Override
- public Iterator<Bitmap> iterator() {
+ public Iterator<SubTile> iterator() {
return this;
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java
index 68c39e5..b091561 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java
@@ -1,6 +1,6 @@
package org.libreoffice;
-import android.graphics.Bitmap;
+import org.mozilla.gecko.gfx.SubTile;
-public interface TileIterator extends Iterable<Bitmap> {
+public interface TileIterator extends Iterable<SubTile> {
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index a405fdf..dbaa040 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -1,13 +1,8 @@
package org.libreoffice;
-import android.graphics.Bitmap;
-
-import java.util.List;
-
-public interface TileProvider {
+public interface TileProvider {
int getPageWidth();
-
int getPageHeight();
TileIterator getTileIterator();
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
index 42bc0b6..58e6263 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
@@ -139,9 +139,9 @@ public class GeckoSoftwareLayerClient extends GeckoLayerClient {
return TILE_SIZE;
}
- public void addTile(Bitmap bitmap, int x, int y) {
+ public void addTile(SubTile tile) {
if (mTileLayer instanceof MultiTileLayer) {
- ((MultiTileLayer)mTileLayer).addTile(bitmap, x, y);
+ ((MultiTileLayer)mTileLayer).addTile(tile);
}
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
index a958a54..56ff5ec 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
@@ -241,9 +241,7 @@ public class MultiTileLayer extends Layer {
return validRegion;
}
- public void addTile(Bitmap bitmap, int x, int y) {
- SubTile tile = new SubTile(new BufferedCairoImage(bitmap), x,y);
- tile.beginTransaction();
+ public void addTile(SubTile tile) {
mTiles.add(tile);
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
index 0c40c3c..b2464bc 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
@@ -1,8 +1,5 @@
package org.mozilla.gecko.gfx;
-/**
-* Created by quikee on 29.6.2014.
-*/
public class SubTile extends SingleTileLayer {
public int x;
public int y;
More information about the Libreoffice-commits
mailing list