• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/wallpapers/Basic


Commit MetaInfo

Revisionfd1b3b35498508878dc41f22a270df95db316e4b (tree)
Time2009-09-10 10:31:58
AuthorRomain Guy <romainguy@andr...>
CommiterRomain Guy

Log Message

Fix the galaxy.

Change-Id: If7e28c8587c070a540feb66017f561a67415dc7c

Change Summary

Incremental Difference

--- a/res/raw/galaxy.rs
+++ b/res/raw/galaxy.rs
@@ -103,10 +103,10 @@ int main(int index) {
103103 drawParticles(x, width, height);
104104 drawLights(x, width, height);
105105
106-// if (angle < 68.0f) {
107-// angle += 0.4f;
108-// distance = angle / 68.0f;
109-// }
106+ if (angle < 68.0f) {
107+ angle += 0.4f;
108+ distance = angle / 68.0f;
109+ }
110110
111111 return 1;
112112 }
--- a/src/com/android/wallpaper/galaxy/GalaxyRS.java
+++ b/src/com/android/wallpaper/galaxy/GalaxyRS.java
@@ -35,6 +35,8 @@ import static android.renderscript.ProgramStore.BlendSrcFunc;
3535 import static android.renderscript.ProgramFragment.EnvMode.*;
3636 import static android.renderscript.Element.*;
3737 import static android.util.MathUtils.*;
38+import android.graphics.Bitmap;
39+import android.graphics.BitmapFactory;
3840
3941 import java.util.TimeZone;
4042
@@ -55,6 +57,8 @@ class GalaxyRS extends RenderScriptScene {
5557 private static final int RSID_TEXTURE_LIGHT1 = 1;
5658 private static final int RSID_TEXTURE_FLARES = 2;
5759
60+ private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options();
61+
5862 @SuppressWarnings({"FieldCanBeLocal"})
5963 private ProgramFragment mPfBackground;
6064 @SuppressWarnings({"FieldCanBeLocal"})
@@ -91,6 +95,9 @@ class GalaxyRS extends RenderScriptScene {
9195
9296 GalaxyRS(int width, int height) {
9397 super(width, height);
98+
99+ mOptionsARGB.inScaled = false;
100+ mOptionsARGB.inPreferredConfig = Bitmap.Config.ARGB_8888;
94101 }
95102
96103 @Override
@@ -261,7 +268,7 @@ class GalaxyRS extends RenderScriptScene {
261268 final Allocation[] textures = mTextures;
262269 textures[RSID_TEXTURE_SPACE] = loadTexture(R.drawable.space, "TSpace");
263270 textures[RSID_TEXTURE_LIGHT1] = loadTexture(R.drawable.light1, "TLight1");
264- textures[RSID_TEXTURE_FLARES] = loadTexture(R.drawable.flares, "TFlares");
271+ textures[RSID_TEXTURE_FLARES] = loadTextureARGB(R.drawable.flares, "TFlares");
265272
266273 final int count = textures.length;
267274 for (int i = 0; i < count; i++) {
@@ -276,6 +283,14 @@ class GalaxyRS extends RenderScriptScene {
276283 return allocation;
277284 }
278285
286+ // TODO: Fix Allocation.createFromBitmapResource() to do this when RGBA_8888 is specified
287+ private Allocation loadTextureARGB(int id, String name) {
288+ Bitmap b = BitmapFactory.decodeResource(mResources, id, mOptionsARGB);
289+ final Allocation allocation = Allocation.createFromBitmap(mRS, b, RGBA_8888, false);
290+ allocation.setName(name);
291+ return allocation;
292+ }
293+
279294 private void createProgramFragment() {
280295 Sampler.Builder samplerBuilder = new Sampler.Builder(mRS);
281296 samplerBuilder.setMin(NEAREST);