summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-03-03 01:12:10 +0200
committerTor Lillqvist <tml@iki.fi>2013-03-03 01:14:16 +0200
commit06b58a702f7751bbe997f33603af18767b9773f0 (patch)
tree071871f29a8ac858daaf10056fdad95905705d69 /android
parent5930a963aeb8947f9d23326c98da7cbc4cd35a08 (diff)
Do "real" zooming also while the scale gesture is in progress
Would work nicely if only it wasn't so compute intensive. Or is it the (temporary hack) constant redrawing that is killing performance? Change-Id: I0b152411a413a818fba7a0f41a3462e423c6ab54
Diffstat (limited to 'android')
-rw-r--r--android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java26
1 files changed, 7 insertions, 19 deletions
diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
index 786bcad12d9d..6e5627be6e72 100644
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
@@ -171,16 +171,12 @@ public class Desktop
super(Desktop.this);
setFocusableInTouchMode(true);
- // While a scale gesture (two-finger pinch / spread to
- // zoom out / in) is in progress we just scale the bitmap
- // view (UI elements too, which of course is a bit silly).
- // When the scale gesture has finished, we ask LO to zoom
- // the document (and reset the view scale, it will be
- // replaced by one where the document (not UI elements) is
- // displayed at a different zoom level).
+ // Is this sane? It is rather slow to ask LO to zoom
+ // continuously while the scaling gesture is in progress.
- // Is that sane? Would it be too slow to ask LO to zoom
- // continuously while the gesture is in progress?
+ // What we used to do was while a scale gesture was in
+ // progress to just scale the bitmap view (UI elements
+ // too, which of course was a bit silly).
gestureDetector =
new ScaleGestureDetector(Desktop.this,
@@ -188,8 +184,6 @@ public class Desktop
@Override public boolean onScaleBegin(ScaleGestureDetector detector)
{
Log.i(TAG, "onScaleBegin: pivot=(" + detector.getFocusX() + ", " + detector.getFocusY() + ")");
- setPivotX(detector.getFocusX());
- setPivotY(detector.getFocusY());
scalingInProgress = true;
return true;
}
@@ -201,8 +195,7 @@ public class Desktop
return false;
scale *= s;
Log.i(TAG, "onScale: " + s + " => " + scale);
- setScaleX(scale);
- setScaleY(scale);
+ Desktop.zoom(scale, (int) detector.getFocusX(), (int) detector.getFocusY());
return true;
}
@@ -211,8 +204,6 @@ public class Desktop
Log.i(TAG, "onScaleEnd: " + scale);
Desktop.zoom(scale, (int) detector.getFocusX(), (int) detector.getFocusY());
scale = 1;
- setScaleX(scale);
- setScaleY(scale);
scalingInProgress = false;
}
});
@@ -220,8 +211,6 @@ public class Desktop
@Override protected void onDraw(Canvas canvas)
{
-// canvas.drawColor(0xFF1ABCDD);
-
if (mBitmap == null) {
Log.i(TAG, "calling Bitmap.createBitmap(" + getWidth() + ", " + getHeight() + ", Bitmap.Config.ARGB_8888)");
mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
@@ -232,8 +221,7 @@ public class Desktop
renderedOnce = true;
// re-call ourselves a bit later ...
- if (!scalingInProgress)
- invalidate();
+ invalidate();
}
@Override public boolean onKeyDown(int keyCode, KeyEvent event)