[Libreoffice-commits] .: android/experimental
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 20 03:11:23 PST 2012
android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 33 +++++-----
1 file changed, 17 insertions(+), 16 deletions(-)
New commits:
commit a1d9caffa38b8acdf241feb94a2f8b66dfd5ea9a
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Nov 20 11:48:47 2012 +0100
android: move toolkit and dummySmallDevice to bootstrapContext as well
Change-Id: I4b6ce49aa5e6d391e832dc1023e47d694a480948
diff --git a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
index 3837a04..9dc7540 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -127,8 +127,6 @@ public class DocumentLoader
private static final int PAGECACHE_SIZE = PAGECACHE_PLUSMINUS*2 + 1;
BootstrapContext bootstrapContext;
- XToolkitExperimental toolkit;
- XDevice dummySmallDevice;
Object doc;
int pageCount;
XRenderable renderable;
@@ -607,7 +605,7 @@ public class DocumentLoader
renderProps[0].Value = new Boolean(true);
renderProps[1] = new PropertyValue();
renderProps[1].Name = "RenderDevice";
- renderProps[1].Value = dummySmallDevice;
+ renderProps[1].Value = bootstrapContext.dummySmallDevice;
renderProps[2] = new PropertyValue();
renderProps[2].Name = "View";
renderProps[2].Value = new MyXController();
@@ -634,7 +632,7 @@ public class DocumentLoader
XDevice device;
if (pageWidth == 0) {
// Huh?
- device = toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(), 1, 1, 0, 0, wrapped_bb);
+ device = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(), 1, 1, 0, 0, wrapped_bb);
} else {
// Scale so that it fits our device which has a resolution of
@@ -684,7 +682,7 @@ public class DocumentLoader
Log.i(TAG, "Rendering page " + number + " level=" + level + " scale=" + scaleNumerator + "/" + scaleDenominator + ", offset=(" + xOffset + ", " + yOffset + ")");
- device = toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(),
+ device = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(),
scaleNumerator, scaleDenominator,
-xOffset, -yOffset,
wrapped_bb);
@@ -817,25 +815,15 @@ public class DocumentLoader
long t1 = System.currentTimeMillis();
Log.i(TAG, "Loading took " + ((t1-t0)-bootstrapContext.timingOverhead) + " ms");
- Object toolkitService = bootstrapContext.mcf.createInstanceWithContext
- ("com.sun.star.awt.Toolkit", bootstrapContext.componentContext);
- toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
-
renderable = (XRenderable) UnoRuntime.queryInterface(XRenderable.class, doc);
- // Set up dummySmallDevice and use it to find out the number
- // of pages ("renderers").
- ByteBuffer smallbb = ByteBuffer.allocateDirect(SMALLSIZE*SMALLSIZE*4);
- long wrapped_smallbb = Bootstrap.new_byte_buffer_wrapper(smallbb);
- dummySmallDevice = toolkit.createScreenCompatibleDeviceUsingBuffer(SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, wrapped_smallbb);
-
PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter";
renderProps[0].Value = new Boolean(true);
renderProps[1] = new PropertyValue();
renderProps[1].Name = "RenderDevice";
- renderProps[1].Value = dummySmallDevice;
+ renderProps[1].Value = bootstrapContext.dummySmallDevice;
renderProps[2] = new PropertyValue();
renderProps[2].Name = "View";
renderProps[2].Value = new MyXController();
@@ -863,6 +851,8 @@ public class DocumentLoader
public XComponentContext componentContext;
public XMultiComponentFactory mcf;
public XComponentLoader componentLoader;
+ public XToolkitExperimental toolkit;
+ public XDevice dummySmallDevice;
}
static void dumpUNOObject(String objectName, Object object)
@@ -973,6 +963,17 @@ public class DocumentLoader
bootstrapContext.componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop);
Log.i(TAG, "componentLoader is" + (bootstrapContext.componentLoader!=null ? " not" : "") + " null");
+
+ Object toolkitService = bootstrapContext.mcf.createInstanceWithContext
+ ("com.sun.star.awt.Toolkit", bootstrapContext.componentContext);
+ bootstrapContext.toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
+
+ // Set up dummySmallDevice and use it to find out the number
+ // of pages ("renderers").
+ ByteBuffer smallbb = ByteBuffer.allocateDirect(SMALLSIZE*SMALLSIZE*4);
+ long wrapped_smallbb = Bootstrap.new_byte_buffer_wrapper(smallbb);
+ bootstrapContext.dummySmallDevice = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, wrapped_smallbb);
+
}
catch (Exception e)
{
More information about the Libreoffice-commits
mailing list