summaryrefslogtreecommitdiffstats
path: root/core/java/android/gesture
diff options
context:
space:
mode:
authorYang Li <liyang@google.com>2009-05-25 23:32:30 -0700
committerYang Li <liyang@google.com>2009-05-26 14:30:34 -0700
commitb082ceefdc877bda2159a8d66d854576e0511d15 (patch)
treea4af3fa2fe738bd35bd7dd10ece21daf24334ea7 /core/java/android/gesture
parent9edc4e8930273d9bb3b5e9cb73c219e012de8ffb (diff)
downloadframeworks_base-b082ceefdc877bda2159a8d66d854576e0511d15.zip
frameworks_base-b082ceefdc877bda2159a8d66d854576e0511d15.tar.gz
frameworks_base-b082ceefdc877bda2159a8d66d854576e0511d15.tar.bz2
Removed Matrix from spatial sampling for GestureUtilities
- updated the letter training file
Diffstat (limited to 'core/java/android/gesture')
-rwxr-xr-xcore/java/android/gesture/GestureUtilities.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/core/java/android/gesture/GestureUtilities.java b/core/java/android/gesture/GestureUtilities.java
index 0f9253d..4a3144c 100755
--- a/core/java/android/gesture/GestureUtilities.java
+++ b/core/java/android/gesture/GestureUtilities.java
@@ -58,10 +58,10 @@ final class GestureUtilities {
float sy = targetPatchSize / rect.height();
float scale = sx < sy ? sx : sy;
- Matrix trans = new Matrix();
- trans.setScale(scale, scale);
- trans.preTranslate(-rect.centerX(), -rect.centerY());
- trans.postTranslate(targetPatchSize / 2, targetPatchSize / 2);
+ float preDx = -rect.centerX();
+ float preDy = -rect.centerY();
+ float postDx = targetPatchSize / 2;
+ float postDy = targetPatchSize / 2;
final ArrayList<GestureStroke> strokes = gesture.getStrokes();
final int count = strokes.size();
@@ -72,11 +72,16 @@ final class GestureUtilities {
for (int index = 0; index < count; index++) {
final GestureStroke stroke = strokes.get(index);
- size = stroke.points.length;
+ float[] strokepoints = stroke.points;
+ size = strokepoints.length;
final float[] pts = new float[size];
-
- trans.mapPoints(pts, 0, stroke.points, 0, size / 2);
+
+ for (int i = 0; i < size; i += 2) {
+ pts[i] = (strokepoints[i] + preDx) * scale + postDx;
+ pts[i + 1] = (strokepoints[i + 1] + preDy) * scale + postDy;
+ }
+
float segmentEndX = -1;
float segmentEndY = -1;