Fix coords of NeuralNetwork LW tap effects.

(In landscape, nexus.rs ignores xOffset. This change makes
NexusRS.java behave the same way.)

Bug: 2456558
Change-Id: I541199fe57f3bb2a310f1920d207e2abdcdd2ac1
diff --git a/res/raw/nexus.rs b/res/raw/nexus.rs
index 3b43411..b82a307 100644
--- a/res/raw/nexus.rs
+++ b/res/raw/nexus.rs
@@ -284,6 +284,7 @@
     if (State->rotate) {
         //matrixLoadRotate(matrix, 90.0f, 0.0f, 0.0f, 1.0f);
         //matrixTranslate(matrix, 0.0f, -height, 1.0f);
+        // XXX: HAX: do not slide display in landscape
     } else {
          matrixTranslate(matrix, -(State->xOffset * width), 0, 0);
     }
diff --git a/src/com/android/wallpaper/nexus/NexusRS.java b/src/com/android/wallpaper/nexus/NexusRS.java
index 6d5cce7..88f3a0e 100644
--- a/src/com/android/wallpaper/nexus/NexusRS.java
+++ b/src/com/android/wallpaper/nexus/NexusRS.java
@@ -105,7 +105,9 @@
 
     @Override
     public void resize(int width, int height) {
-        super.resize(width, height);
+        super.resize(width, height); // updates mWidth, mHeight
+
+        // android.util.Log.d("NexusRS", String.format("resize(%d, %d)", width, height));
 
         mWorldState.width = width;
         mWorldState.height = height;
@@ -281,8 +283,15 @@
             boolean resultRequested) {
 
         final int dw = mWorldState.width;
-        final int bw = 960;
-        x = (int) (x + mWorldState.xOffset * (bw-dw));
+        final int bw = 960; // XXX: hardcoded width of background texture
+        if (mWorldState.rotate == 0) {
+            // nexus.rs ignores the xOffset when rotated; we shall endeavor to do so as well
+            x = (int) (x + mWorldState.xOffset * (bw-dw));
+        }
+
+        // android.util.Log.d("NexusRS", String.format(
+        //     "dw=%d, bw=%d, xOffset=%g, x=%d",
+        //     dw, bw, mWorldState.xOffset, x));
 
         if ("android.wallpaper.tap".equals(action)) {
             sendCommand(1, x, y);