Fix the galaxy.

Change-Id: If7e28c8587c070a540feb66017f561a67415dc7c
diff --git a/res/raw/galaxy.rs b/res/raw/galaxy.rs
index a78133b..2b081e2 100644
--- a/res/raw/galaxy.rs
+++ b/res/raw/galaxy.rs
@@ -103,10 +103,10 @@
     drawParticles(x, width, height);
     drawLights(x, width, height);
 
-//    if (angle < 68.0f) {
-//        angle += 0.4f;
-//        distance = angle / 68.0f;
-//    }
+    if (angle < 68.0f) {
+        angle += 0.4f;
+        distance = angle / 68.0f;
+    }
 
     return 1;
 }
diff --git a/src/com/android/wallpaper/galaxy/GalaxyRS.java b/src/com/android/wallpaper/galaxy/GalaxyRS.java
index e38e004..6a964f4 100644
--- a/src/com/android/wallpaper/galaxy/GalaxyRS.java
+++ b/src/com/android/wallpaper/galaxy/GalaxyRS.java
@@ -35,6 +35,8 @@
 import static android.renderscript.ProgramFragment.EnvMode.*;
 import static android.renderscript.Element.*;
 import static android.util.MathUtils.*;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 
 import java.util.TimeZone;
 
@@ -55,6 +57,8 @@
     private static final int RSID_TEXTURE_LIGHT1 = 1;
     private static final int RSID_TEXTURE_FLARES = 2;
 
+    private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options();
+
     @SuppressWarnings({"FieldCanBeLocal"})
     private ProgramFragment mPfBackground;
     @SuppressWarnings({"FieldCanBeLocal"})
@@ -91,6 +95,9 @@
 
     GalaxyRS(int width, int height) {
         super(width, height);
+
+        mOptionsARGB.inScaled = false;
+        mOptionsARGB.inPreferredConfig = Bitmap.Config.ARGB_8888;
     }
 
     @Override
@@ -261,7 +268,7 @@
         final Allocation[] textures = mTextures;
         textures[RSID_TEXTURE_SPACE] = loadTexture(R.drawable.space, "TSpace");
         textures[RSID_TEXTURE_LIGHT1] = loadTexture(R.drawable.light1, "TLight1");
-        textures[RSID_TEXTURE_FLARES] = loadTexture(R.drawable.flares, "TFlares");
+        textures[RSID_TEXTURE_FLARES] = loadTextureARGB(R.drawable.flares, "TFlares");
 
         final int count = textures.length;
         for (int i = 0; i < count; i++) {
@@ -276,6 +283,14 @@
         return allocation;
     }
 
+    // TODO: Fix Allocation.createFromBitmapResource() to do this when RGBA_8888 is specified
+    private Allocation loadTextureARGB(int id, String name) {
+        Bitmap b = BitmapFactory.decodeResource(mResources, id, mOptionsARGB);
+        final Allocation allocation = Allocation.createFromBitmap(mRS, b, RGBA_8888, false);
+        allocation.setName(name);
+        return allocation;
+    }
+
     private void createProgramFragment() {
         Sampler.Builder samplerBuilder = new Sampler.Builder(mRS);
         samplerBuilder.setMin(NEAREST);