summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-05-18 18:33:05 -0700
committerDianne Hackborn <hackbod@google.com>2010-05-18 18:33:05 -0700
commit689868ac47edceec08ed181d949e02c34276ffeb (patch)
treef4a0bd8d0522e01f23703f05f51d4ba131ec6a76 /samples
parent5ee6d7a18c88f422e818234e0e89ba0d5d2389b7 (diff)
downloadandroid_development-689868ac47edceec08ed181d949e02c34276ffeb.tar.gz
android_development-689868ac47edceec08ed181d949e02c34276ffeb.tar.bz2
android_development-689868ac47edceec08ed181d949e02c34276ffeb.zip
Small fix to surface window sample.
Change-Id: Iaae90aaf8cfdb71c6201eba8a436450a75b2b732
Diffstat (limited to 'samples')
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/graphics/WindowSurface.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/WindowSurface.java b/samples/ApiDemos/src/com/example/android/apis/graphics/WindowSurface.java
index c7b03c1df..7829ec953 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/WindowSurface.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/WindowSurface.java
@@ -115,10 +115,14 @@ public class WindowSurface extends Activity implements SurfaceHolder.Callback {
void step(int width, int height, float minStep, float maxStep) {
x += dx;
if (x <= 0 || x >= (width-1)) {
+ if (x <= 0) x = 0;
+ else if (x >= (width-1)) x = width-1;
dx = adjDelta(-dx, minStep, maxStep);
}
y += dy;
if (y <= 0 || y >= (height-1)) {
+ if (y <= 0) y = 0;
+ else if (y >= (height-1)) y = height-1;
dy = adjDelta(-dy, minStep, maxStep);
}
}