Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
81df594b
Kaydet (Commit)
81df594b
authored
Tem 04, 2014
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
LOAndroid3: use device DPI, push more resp. to TileProvider
Change-Id: I603bf2697d9afbac7a9cb4eae9d1c0da92bb9e93
üst
27e86fe6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
57 deletions
+73
-57
LOKitShell.java
...ental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+2
-10
LOKitThread.java
...ntal/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+3
-9
LOKitTileProvider.java
...OAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+39
-18
MockTileProvider.java
...LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
+23
-4
TileIterator.java
...tal/LOAndroid3/src/java/org/libreoffice/TileIterator.java
+2
-2
TileProvider.java
...tal/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+1
-6
GeckoSoftwareLayerClient.java
.../java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
+2
-2
MultiTileLayer.java
...droid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
+1
-3
SubTile.java
...al/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
+0
-3
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
Dosyayı görüntüle @
81df594b
...
@@ -17,15 +17,8 @@ public class LOKitShell {
...
@@ -17,15 +17,8 @@ public class LOKitShell {
private
static
final
String
LOGTAG
=
LOKitShell
.
class
.
getSimpleName
();
private
static
final
String
LOGTAG
=
LOKitShell
.
class
.
getSimpleName
();
public
static
int
getDpi
()
{
public
static
int
getDpi
()
{
return
96
;
DisplayMetrics
metrics
=
LibreOfficeMainActivity
.
mAppContext
.
getResources
().
getDisplayMetrics
();
}
return
(
int
)
metrics
.
density
*
200
;
public
static
int
getScreenDepth
()
{
return
24
;
}
public
static
float
computeRenderIntegrity
()
{
return
0.0f
;
}
}
public
static
ByteBuffer
allocateDirectBuffer
(
int
size
)
{
public
static
ByteBuffer
allocateDirectBuffer
(
int
size
)
{
...
@@ -44,7 +37,6 @@ public class LOKitShell {
...
@@ -44,7 +37,6 @@ public class LOKitShell {
return
directBuffer
;
return
directBuffer
;
}
}
public
static
void
freeDirectBuffer
(
ByteBuffer
buffer
)
{
public
static
void
freeDirectBuffer
(
ByteBuffer
buffer
)
{
if
(
buffer
==
null
)
{
if
(
buffer
==
null
)
{
return
;
return
;
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
Dosyayı görüntüle @
81df594b
...
@@ -8,6 +8,7 @@ import android.graphics.Rect;
...
@@ -8,6 +8,7 @@ import android.graphics.Rect;
import
android.util.JsonWriter
;
import
android.util.JsonWriter
;
import
android.util.Log
;
import
android.util.Log
;
import
org.mozilla.gecko.gfx.SubTile
;
import
org.mozilla.gecko.gfx.ViewportMetrics
;
import
org.mozilla.gecko.gfx.ViewportMetrics
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -47,15 +48,8 @@ public class LOKitThread extends Thread {
...
@@ -47,15 +48,8 @@ public class LOKitThread extends Thread {
Log
.
i
(
LOGTAG
,
"Filling tiles.."
);
Log
.
i
(
LOGTAG
,
"Filling tiles.."
);
int
x
=
0
;
for
(
SubTile
tile
:
mTileProvider
.
getTileIterator
())
{
int
y
=
0
;
application
.
getLayerClient
().
addTile
(
tile
);
for
(
Bitmap
bitmap
:
mTileProvider
.
getTileIterator
())
{
application
.
getLayerClient
().
addTile
(
bitmap
,
x
,
y
);
x
+=
TILE_SIZE
;
if
(
x
>
pageWidth
)
{
x
=
0
;
y
+=
TILE_SIZE
;
}
}
}
Log
.
i
(
LOGTAG
,
"End Draw"
);
Log
.
i
(
LOGTAG
,
"End Draw"
);
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
Dosyayı görüntüle @
81df594b
...
@@ -3,6 +3,8 @@ package org.libreoffice;
...
@@ -3,6 +3,8 @@ package org.libreoffice;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.util.Log
;
import
android.util.Log
;
import
org.mozilla.gecko.gfx.BufferedCairoImage
;
import
org.mozilla.gecko.gfx.CairoImage
;
import
org.mozilla.gecko.gfx.LayerController
;
import
org.mozilla.gecko.gfx.LayerController
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
...
@@ -11,6 +13,7 @@ import java.util.Iterator;
...
@@ -11,6 +13,7 @@ import java.util.Iterator;
import
org.libreoffice.kit.LibreOfficeKit
;
import
org.libreoffice.kit.LibreOfficeKit
;
import
org.libreoffice.kit.Office
;
import
org.libreoffice.kit.Office
;
import
org.libreoffice.kit.Document
;
import
org.libreoffice.kit.Document
;
import
org.mozilla.gecko.gfx.SubTile
;
public
class
LOKitTileProvider
implements
TileProvider
{
public
class
LOKitTileProvider
implements
TileProvider
{
private
final
LayerController
mLayerController
;
private
final
LayerController
mLayerController
;
...
@@ -20,8 +23,19 @@ public class LOKitTileProvider implements TileProvider {
...
@@ -20,8 +23,19 @@ public class LOKitTileProvider implements TileProvider {
public
final
Office
mOffice
;
public
final
Office
mOffice
;
public
final
Document
mDocument
;
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
)
{
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
.
putenv
(
"SAL_LOG=+WARN+INFO-INFO.legacy.osl-INFO.i18nlangtag"
);
LibreOfficeKit
.
init
(
LibreOfficeMainActivity
.
mAppContext
);
LibreOfficeKit
.
init
(
LibreOfficeMainActivity
.
mAppContext
);
...
@@ -32,62 +46,69 @@ public class LOKitTileProvider implements TileProvider {
...
@@ -32,62 +46,69 @@ public class LOKitTileProvider implements TileProvider {
@Override
@Override
public
int
getPageWidth
()
{
public
int
getPageWidth
()
{
return
(
int
)
(
mDocument
.
getDocumentWidth
()
/
1440.0
*
LOKitShell
.
getDpi
()
);
return
(
int
)
twipToPixel
(
mDocument
.
getDocumentWidth
(),
mDPI
);
}
}
@Override
@Override
public
int
getPageHeight
()
{
public
int
getPageHeight
()
{
return
(
int
)
(
mDocument
.
getDocumentHeight
()
/
1440.0
*
LOKitShell
.
getDpi
()
);
return
(
int
)
twipToPixel
(
mDocument
.
getDocumentHeight
(),
mDPI
);
}
}
public
TileIterator
getTileIterator
()
{
public
TileIterator
getTileIterator
()
{
return
new
LoKitTileIterator
();
return
new
LoKitTileIterator
();
}
}
public
class
LoKitTileIterator
implements
TileIterator
,
Iterator
<
Bitmap
>
{
public
class
LoKitTileIterator
implements
TileIterator
,
Iterator
<
SubTile
>
{
private
final
double
mTileWidth
;
private
final
double
mTileWidth
;
private
final
double
mTileHeight
;
private
final
double
mTileHeight
;
private
boolean
mShouldContinue
=
true
;
private
double
mPositionWidth
=
0
;
private
double
mPositionWidth
=
0
;
private
double
mPositionHeight
=
0
;
private
double
mPositionHeight
=
0
;
private
int
mX
=
0
;
private
int
mY
=
0
;
private
double
mPageWidth
;
private
double
mPageWidth
;
private
double
mPageHeight
;
private
double
mPageHeight
;
public
LoKitTileIterator
()
{
public
LoKitTileIterator
()
{
mTileWidth
=
(
TILE_SIZE
/
(
double
)
LOKitShell
.
getDpi
())
*
1440.0
;
mTileWidth
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
mTileHeight
=
(
TILE_SIZE
/
(
double
)
LOKitShell
.
getDpi
())
*
1440.0
;
mTileHeight
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
mPageWidth
=
mDocument
.
getDocumentWidth
();
mPageWidth
=
mDocument
.
getDocumentWidth
();
mPageHeight
=
mDocument
.
getDocumentHeight
();
mPageHeight
=
mDocument
.
getDocumentHeight
();
}
}
@Override
@Override
public
boolean
hasNext
()
{
public
boolean
hasNext
()
{
return
m
ShouldContinue
;
return
m
PositionHeight
<=
mPageHeight
;
}
}
@Override
@Override
public
Bitmap
next
()
{
public
SubTile
next
()
{
ByteBuffer
buffer
=
ByteBuffer
.
allocateDirect
(
TILE_SIZE
*
TILE_SIZE
*
4
);
ByteBuffer
buffer
=
ByteBuffer
.
allocateDirect
(
TILE_SIZE
*
TILE_SIZE
*
4
);
Bitmap
bitmap
=
Bitmap
.
createBitmap
(
TILE_SIZE
,
TILE_SIZE
,
Bitmap
.
Config
.
ARGB_8888
);
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
;
mPositionWidth
+=
mTileWidth
;
mX
+=
TILE_SIZE
;
if
(
mPositionWidth
>
mPageWidth
)
{
if
(
mPositionWidth
>
mPageWidth
)
{
mPositionHeight
+=
mTileHeight
;
mPositionHeight
+=
mTileHeight
;
mPositionWidth
=
0
;
mY
+=
TILE_SIZE
;
}
if
(
mPositionHeight
>
mPageHeight
||
mPositionHeight
>
20000
)
{
mPositionWidth
=
0
;
m
ShouldContinue
=
false
;
m
X
=
0
;
}
}
bitmap
.
copyPixelsFromBuffer
(
buffer
);
return
tile
;
return
bitmap
;
}
}
@Override
@Override
...
@@ -96,7 +117,7 @@ public class LOKitTileProvider implements TileProvider {
...
@@ -96,7 +117,7 @@ public class LOKitTileProvider implements TileProvider {
}
}
@Override
@Override
public
Iterator
<
Bitmap
>
iterator
()
{
public
Iterator
<
SubTile
>
iterator
()
{
return
this
;
return
this
;
}
}
}
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
Dosyayı görüntüle @
81df594b
...
@@ -3,13 +3,17 @@ package org.libreoffice;
...
@@ -3,13 +3,17 @@ package org.libreoffice;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
org.apache.http.MethodNotSupportedException
;
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.LayerController
;
import
org.mozilla.gecko.gfx.SubTile
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
public
class
MockTileProvider
implements
TileProvider
{
public
class
MockTileProvider
implements
TileProvider
{
private
final
LayerController
layerController
;
private
final
LayerController
layerController
;
private
static
final
int
TILE_SIZE
=
256
;
public
MockTileProvider
(
LayerController
layerController
)
{
public
MockTileProvider
(
LayerController
layerController
)
{
this
.
layerController
=
layerController
;
this
.
layerController
=
layerController
;
...
@@ -29,11 +33,14 @@ public class MockTileProvider implements TileProvider {
...
@@ -29,11 +33,14 @@ public class MockTileProvider implements TileProvider {
return
new
MockTileIterator
(
layerController
);
return
new
MockTileIterator
(
layerController
);
}
}
public
class
MockTileIterator
implements
TileIterator
,
Iterator
<
Bitmap
>
{
public
class
MockTileIterator
implements
TileIterator
,
Iterator
<
SubTile
>
{
private
final
LayerController
layerController
;
private
final
LayerController
layerController
;
private
int
tileNumber
=
1
;
private
int
tileNumber
=
1
;
private
int
x
=
0
;
private
int
y
=
0
;
public
MockTileIterator
(
LayerController
layerController
)
{
public
MockTileIterator
(
LayerController
layerController
)
{
this
.
layerController
=
layerController
;
this
.
layerController
=
layerController
;
}
}
...
@@ -44,11 +51,23 @@ public class MockTileProvider implements TileProvider {
...
@@ -44,11 +51,23 @@ public class MockTileProvider implements TileProvider {
}
}
@Override
@Override
public
Bitmap
next
()
{
public
SubTile
next
()
{
String
imageName
=
"d"
+
tileNumber
;
String
imageName
=
"d"
+
tileNumber
;
tileNumber
++;
tileNumber
++;
Bitmap
bitmap
=
layerController
.
getDrawable
(
imageName
);
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
@Override
...
@@ -57,7 +76,7 @@ public class MockTileProvider implements TileProvider {
...
@@ -57,7 +76,7 @@ public class MockTileProvider implements TileProvider {
}
}
@Override
@Override
public
Iterator
<
Bitmap
>
iterator
()
{
public
Iterator
<
SubTile
>
iterator
()
{
return
this
;
return
this
;
}
}
}
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileIterator.java
Dosyayı görüntüle @
81df594b
package
org
.
libreoffice
;
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
>
{
}
}
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
Dosyayı görüntüle @
81df594b
package
org
.
libreoffice
;
package
org
.
libreoffice
;
import
android.graphics.Bitmap
;
public
interface
TileProvider
{
import
java.util.List
;
public
interface
TileProvider
{
int
getPageWidth
();
int
getPageWidth
();
int
getPageHeight
();
int
getPageHeight
();
TileIterator
getTileIterator
();
TileIterator
getTileIterator
();
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java
Dosyayı görüntüle @
81df594b
...
@@ -139,9 +139,9 @@ public class GeckoSoftwareLayerClient extends GeckoLayerClient {
...
@@ -139,9 +139,9 @@ public class GeckoSoftwareLayerClient extends GeckoLayerClient {
return
TILE_SIZE
;
return
TILE_SIZE
;
}
}
public
void
addTile
(
Bitmap
bitmap
,
int
x
,
int
y
)
{
public
void
addTile
(
SubTile
tile
)
{
if
(
mTileLayer
instanceof
MultiTileLayer
)
{
if
(
mTileLayer
instanceof
MultiTileLayer
)
{
((
MultiTileLayer
)
mTileLayer
).
addTile
(
bitmap
,
x
,
y
);
((
MultiTileLayer
)
mTileLayer
).
addTile
(
tile
);
}
}
}
}
}
}
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/MultiTileLayer.java
Dosyayı görüntüle @
81df594b
...
@@ -241,9 +241,7 @@ public class MultiTileLayer extends Layer {
...
@@ -241,9 +241,7 @@ public class MultiTileLayer extends Layer {
return
validRegion
;
return
validRegion
;
}
}
public
void
addTile
(
Bitmap
bitmap
,
int
x
,
int
y
)
{
public
void
addTile
(
SubTile
tile
)
{
SubTile
tile
=
new
SubTile
(
new
BufferedCairoImage
(
bitmap
),
x
,
y
);
tile
.
beginTransaction
();
mTiles
.
add
(
tile
);
mTiles
.
add
(
tile
);
}
}
}
}
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
Dosyayı görüntüle @
81df594b
package
org
.
mozilla
.
gecko
.
gfx
;
package
org
.
mozilla
.
gecko
.
gfx
;
/**
* Created by quikee on 29.6.2014.
*/
public
class
SubTile
extends
SingleTileLayer
{
public
class
SubTile
extends
SingleTileLayer
{
public
int
x
;
public
int
x
;
public
int
y
;
public
int
y
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment