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
a9c434a2
Kaydet (Commit)
a9c434a2
authored
Kas 30, 2014
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#85845 android: draw tiles immediately when they are ready
Change-Id: I924a212210703b0f6136ddefacd77d98dc89f42d
üst
b861c1cc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
68 deletions
+92
-68
LOEvent.java
...rimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
+13
-16
LOEventFactory.java
...l/LOAndroid3/src/java/org/libreoffice/LOEventFactory.java
+4
-0
LOKitThread.java
...ntal/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+14
-10
TileIdentifier.java
...l/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
+36
-0
DynamicTileLayer.java
...oid3/src/java/org/mozilla/gecko/gfx/DynamicTileLayer.java
+14
-6
GeckoLayerClient.java
...oid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+7
-0
SubTile.java
...al/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
+4
-36
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -15,12 +15,14 @@ public class LOEvent {
public
static
final
int
LOAD
=
6
;
public
static
final
int
CLOSE
=
7
;
public
static
final
int
REDRAW
=
8
;
public
static
final
int
TILE_REQUEST
=
9
;
public
int
mType
;
private
ImmutableViewportMetrics
mViewportMetrics
;
private
String
mTypeString
;
private
int
mPartIndex
;
private
String
mFilename
;
public
ImmutableViewportMetrics
mViewportMetrics
;
public
String
mTypeString
;
public
int
mPartIndex
;
public
String
mFilename
;
public
TileIdentifier
mTileId
;
public
LOEvent
(
int
type
)
{
mType
=
type
;
...
...
@@ -31,8 +33,15 @@ public class LOEvent {
mTypeString
=
"Size Changed: "
+
widthPixels
+
" "
+
heightPixels
;
}
public
LOEvent
(
int
type
,
TileIdentifier
tileId
)
{
mType
=
type
;
mTypeString
=
"Tile Request"
;
mTileId
=
tileId
;
}
public
LOEvent
(
int
type
,
String
filename
)
{
mType
=
type
;
mTypeString
=
"Filename"
;
mFilename
=
filename
;
}
...
...
@@ -64,16 +73,4 @@ public class LOEvent {
}
return
mTypeString
;
}
public
ImmutableViewportMetrics
getViewport
()
{
return
mViewportMetrics
;
}
public
int
getPartIndex
()
{
return
mPartIndex
;
}
public
String
getFilename
()
{
return
mFilename
;
}
}
android/experimental/LOAndroid3/src/java/org/libreoffice/LOEventFactory.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -38,4 +38,8 @@ public class LOEventFactory {
public
static
LOEvent
redraw
()
{
return
new
LOEvent
(
LOEvent
.
REDRAW
);
}
public
static
LOEvent
tileRequest
(
TileIdentifier
tileRequest
)
{
return
new
LOEvent
(
LOEvent
.
TILE_REQUEST
,
tileRequest
);
}
}
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -6,7 +6,7 @@ import android.util.DisplayMetrics;
import
android.util.Log
;
import
org.mozilla.gecko.gfx.GeckoLayerClient
;
import
org.mozilla.gecko.gfx.ImmutableViewportMetrics
;
;
import
org.mozilla.gecko.gfx.ImmutableViewportMetrics
;
import
java.util.concurrent.LinkedBlockingQueue
;
...
...
@@ -33,16 +33,17 @@ public class LOKitThread extends Thread {
DisplayMetrics
displayMetrics
=
LibreOfficeMainActivity
.
mAppContext
.
getResources
().
getDisplayMetrics
();
mViewportMetrics
=
new
ImmutableViewportMetrics
(
displayMetrics
);
mViewportMetrics
=
mViewportMetrics
.
setPageRect
(
rect
,
rect
);
GeckoLayerClient
layerClient
=
mApplication
.
getLayerClient
();
layerClient
.
beginDrawing
();
layerClient
.
reevaluateTiles
();
layerClient
.
endDrawing
(
mViewportMetrics
);
mLayerClient
.
reevaluateTiles
();
return
true
;
}
private
void
tileRequest
(
TileIdentifier
tileId
)
{
mLayerClient
.
beginDrawing
();
mLayerClient
.
addTile
(
tileId
);
mLayerClient
.
endDrawing
(
mViewportMetrics
);
}
/** Handle the geometry change + draw. */
private
void
redraw
()
{
if
(
mLayerClient
==
null
||
mTileProvider
==
null
)
{
...
...
@@ -114,13 +115,13 @@ public class LOKitThread extends Thread {
Log
.
i
(
LOGTAG
,
"processEvent: "
+
event
.
getTypeString
());
switch
(
event
.
mType
)
{
case
LOEvent
.
LOAD
:
loadDocument
(
event
.
getFilename
()
);
loadDocument
(
event
.
mFilename
);
break
;
case
LOEvent
.
CLOSE
:
closeDocument
();
break
;
case
LOEvent
.
VIEWPORT
:
mViewportMetrics
=
event
.
getViewport
()
;
mViewportMetrics
=
event
.
mViewportMetrics
;
draw
();
break
;
case
LOEvent
.
DRAW
:
...
...
@@ -130,7 +131,10 @@ public class LOKitThread extends Thread {
redraw
();
break
;
case
LOEvent
.
CHANGE_PART
:
changePart
(
event
.
getPartIndex
());
changePart
(
event
.
mPartIndex
);
break
;
case
LOEvent
.
TILE_REQUEST
:
tileRequest
(
event
.
mTileId
);
break
;
}
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
0 → 100644
Dosyayı görüntüle @
a9c434a2
package
org
.
libreoffice
;
public
class
TileIdentifier
{
public
final
int
x
;
public
final
int
y
;
public
final
float
zoom
;
public
TileIdentifier
(
int
x
,
int
y
,
float
zoom
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
zoom
=
zoom
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
TileIdentifier
that
=
(
TileIdentifier
)
o
;
if
(
x
!=
that
.
x
)
return
false
;
if
(
y
!=
that
.
y
)
return
false
;
if
(
Float
.
compare
(
that
.
zoom
,
zoom
)
!=
0
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
x
;
result
=
31
*
result
+
y
;
result
=
31
*
result
+
(
zoom
!=
+
0.0f
?
Float
.
floatToIntBits
(
zoom
)
:
0
);
return
result
;
}
}
\ No newline at end of file
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/DynamicTileLayer.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -5,6 +5,9 @@ import android.graphics.RectF;
import
android.graphics.Region
;
import
android.util.Log
;
import
org.libreoffice.LOEventFactory
;
import
org.libreoffice.LOKitShell
;
import
org.libreoffice.TileIdentifier
;
import
org.libreoffice.TileProvider
;
import
org.mozilla.gecko.util.FloatUtils
;
...
...
@@ -16,6 +19,7 @@ public class DynamicTileLayer extends Layer {
private
static
final
String
LOGTAG
=
DynamicTileLayer
.
class
.
getSimpleName
();
private
final
List
<
SubTile
>
tiles
=
new
CopyOnWriteArrayList
<
SubTile
>();
private
TileProvider
tileProvider
;
private
final
IntSize
tileSize
;
private
RectF
currentViewport
=
new
RectF
();
...
...
@@ -33,8 +37,8 @@ public class DynamicTileLayer extends Layer {
}
public
void
invalidate
()
{
for
(
SubTile
layer
:
tiles
)
{
layer
.
invalidate
();
for
(
SubTile
tile
:
tiles
)
{
tile
.
invalidate
();
}
}
...
...
@@ -162,10 +166,7 @@ public class DynamicTileLayer extends Layer {
}
}
if
(!
contains
)
{
CairoImage
image
=
tileProvider
.
createTile
(
x
,
y
,
tileSize
,
viewportMetrics
.
zoomFactor
);
SubTile
tile
=
new
SubTile
(
image
,
(
int
)
x
,
(
int
)
y
,
viewportMetrics
.
zoomFactor
);
tile
.
beginTransaction
();
tiles
.
add
(
tile
);
LOKitShell
.
sendEvent
(
LOEventFactory
.
tileRequest
(
new
TileIdentifier
((
int
)
x
,
(
int
)
y
,
viewportMetrics
.
zoomFactor
)));
}
}
}
...
...
@@ -199,4 +200,11 @@ public class DynamicTileLayer extends Layer {
tiles
.
clear
();
currentViewport
=
new
RectF
();
}
public
void
addTile
(
TileIdentifier
tileId
)
{
CairoImage
image
=
tileProvider
.
createTile
(
tileId
.
x
,
tileId
.
y
,
tileSize
,
tileId
.
zoom
);
SubTile
tile
=
new
SubTile
(
image
,
tileId
);
tile
.
beginTransaction
();
tiles
.
add
(
tile
);
}
}
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -16,6 +16,7 @@ import android.view.GestureDetector;
import
org.libreoffice.LOEvent
;
import
org.libreoffice.LOEventFactory
;
import
org.libreoffice.LOKitShell
;
import
org.libreoffice.TileIdentifier
;
import
org.libreoffice.TileProvider
;
import
org.mozilla.gecko.ZoomConstraints
;
import
org.mozilla.gecko.ui.PanZoomController
;
...
...
@@ -478,6 +479,7 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
public
GestureDetector
.
OnDoubleTapListener
getDoubleTapListener
()
{
return
mPanZoomController
;
}
private
class
AdjustRunnable
implements
Runnable
{
public
void
run
()
{
mPendingViewportAdjust
=
false
;
...
...
@@ -498,4 +500,8 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
mRootLayer
.
clearAndReset
();
}
public
void
addTile
(
TileIdentifier
tileId
)
{
mRootLayer
.
addTile
(
tileId
);
}
}
\ No newline at end of file
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java
Dosyayı görüntüle @
a9c434a2
...
...
@@ -5,50 +5,18 @@
package
org
.
mozilla
.
gecko
.
gfx
;
import
org.libreoffice.TileIdentifier
;
public
class
SubTile
extends
SingleTileLayer
{
public
boolean
markedForRemoval
=
false
;
public
final
TileIdentifier
id
;
public
SubTile
(
CairoImage
mImage
,
int
x
,
int
y
,
float
zoom
)
{
public
SubTile
(
CairoImage
mImage
,
TileIdentifier
id
)
{
super
(
mImage
);
id
=
new
TileIdentifier
(
x
,
y
,
zoom
)
;
this
.
id
=
id
;
}
public
void
markForRemoval
()
{
markedForRemoval
=
true
;
}
public
static
class
TileIdentifier
{
public
int
x
;
public
int
y
;
public
float
zoom
;
public
TileIdentifier
(
int
x
,
int
y
,
float
zoom
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
zoom
=
zoom
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
TileIdentifier
that
=
(
TileIdentifier
)
o
;
if
(
x
!=
that
.
x
)
return
false
;
if
(
y
!=
that
.
y
)
return
false
;
if
(
Float
.
compare
(
that
.
zoom
,
zoom
)
!=
0
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
x
;
result
=
31
*
result
+
y
;
result
=
31
*
result
+
(
zoom
!=
+
0.0f
?
Float
.
floatToIntBits
(
zoom
)
:
0
);
return
result
;
}
}
}
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