OSDN Git Service

Fix coords of NeuralNetwork LW tap effects.
authorDaniel Sandler <dsandler@google.com>
Fri, 19 Feb 2010 20:43:28 +0000 (15:43 -0500)
committerDaniel Sandler <dsandler@google.com>
Fri, 19 Feb 2010 20:45:22 +0000 (15:45 -0500)
(In landscape, nexus.rs ignores xOffset. This change makes
NexusRS.java behave the same way.)

Bug: 2456558
Change-Id: I541199fe57f3bb2a310f1920d207e2abdcdd2ac1

res/raw/nexus.rs
src/com/android/wallpaper/nexus/NexusRS.java

index 3b43411..b82a307 100644 (file)
@@ -284,6 +284,7 @@ int main(int index) {
     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);
     }
index 6d5cce7..88f3a0e 100644 (file)
@@ -105,7 +105,9 @@ class NexusRS extends RenderScriptScene {
 
     @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 @@ class NexusRS extends RenderScriptScene {
             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);