Small fix to surface window sample.

Change-Id: Iaae90aaf8cfdb71c6201eba8a436450a75b2b732
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 c7b03c1..7829ec9 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 @@
         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);
             }
         }