From dba3ba5b5bf6026abceced921b1b0d231b0faefd Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 30 Jul 2009 14:56:12 -0700 Subject: [PATCH] Implement bitmap resource loaders for utility. cleanup rolloRS and checkin maps.png which was missing. --- .../android/renderscript/RenderScript.java | 22 +- .../Film/src/com/android/film/FilmRS.java | 56 +---- libs/rs/java/Rollo/res/raw/maps.png | Bin 0 -> 5374 bytes .../Rollo/src/com/android/rollo/RolloRS.java | 234 +++++------------- 4 files changed, 96 insertions(+), 216 deletions(-) create mode 100644 libs/rs/java/Rollo/res/raw/maps.png diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 2b9e448706e13..1770a7aa4ccca 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -23,6 +23,12 @@ package android.renderscript; import java.io.InputStream; import java.io.IOException; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.Color; + import android.os.Bundle; import android.content.res.Resources; import android.util.Log; @@ -32,8 +38,6 @@ import android.view.MenuItem; import android.view.Window; import android.view.View; import android.view.Surface; -import android.graphics.Bitmap; -import android.graphics.Color; /** * @hide @@ -53,6 +57,8 @@ public class RenderScript { private static boolean sInitialized; native private static void _nInit(); + private static BitmapFactory.Options mBitmapOptions = new BitmapFactory.Options(); + static { sInitialized = false; try { @@ -62,6 +68,7 @@ public class RenderScript { } catch (UnsatisfiedLinkError e) { Log.d(LOG_TAG, "RenderScript JNI library not found!"); } + mBitmapOptions.inScaled = false; } native private int nDeviceCreate(); @@ -539,6 +546,17 @@ public class RenderScript { return new Allocation(id); } + public Allocation allocationCreateFromBitmapResource(Resources res, int id, ElementPredefined internalElement, boolean genMips) { + Bitmap b = BitmapFactory.decodeResource(res, id, mBitmapOptions); + return allocationCreateFromBitmap(b, internalElement, genMips); + } + + public Allocation allocationCreateFromBitmapResourceBoxed(Resources res, int id, ElementPredefined internalElement, boolean genMips) { + Bitmap b = BitmapFactory.decodeResource(res, id, mBitmapOptions); + return allocationCreateFromBitmapBoxed(b, internalElement, genMips); + } + + ////////////////////////////////////////////////////////////////////////////////// // Adapter1D diff --git a/libs/rs/java/Film/src/com/android/film/FilmRS.java b/libs/rs/java/Film/src/com/android/film/FilmRS.java index a639c5536bad7..12a14e3dbef14 100644 --- a/libs/rs/java/Film/src/com/android/film/FilmRS.java +++ b/libs/rs/java/Film/src/com/android/film/FilmRS.java @@ -163,7 +163,6 @@ public class FilmRS { mPVImages.setName("PVImages"); } - private void loadImages() { mBufferIDs = new int[13]; mImages = new RenderScript.Allocation[13]; @@ -171,51 +170,22 @@ public class FilmRS { RenderScript.ElementPredefined.USER_FLOAT, mBufferIDs.length); - Bitmap b; - BitmapFactory.Options opts = new BitmapFactory.Options(); - opts.inScaled = false; - RenderScript.ElementPredefined ie = RenderScript.ElementPredefined.RGB_565; - b = BitmapFactory.decodeResource(mRes, R.drawable.p01, opts); - mImages[0] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p02, opts); - mImages[1] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p03, opts); - mImages[2] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p04, opts); - mImages[3] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p05, opts); - mImages[4] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p06, opts); - mImages[5] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p07, opts); - mImages[6] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p08, opts); - mImages[7] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p09, opts); - mImages[8] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p10, opts); - mImages[9] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p11, opts); - mImages[10] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p12, opts); - mImages[11] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); - - b = BitmapFactory.decodeResource(mRes, R.drawable.p13, opts); - mImages[12] = mRS.allocationCreateFromBitmapBoxed(b, ie, true); + mImages[0] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p01, ie, true); + mImages[1] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p02, ie, true); + mImages[2] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p03, ie, true); + mImages[3] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p04, ie, true); + mImages[4] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p05, ie, true); + mImages[5] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p06, ie, true); + mImages[6] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p07, ie, true); + mImages[7] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p08, ie, true); + mImages[8] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p09, ie, true); + mImages[9] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p10, ie, true); + mImages[10] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p11, ie, true); + mImages[11] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p12, ie, true); + mImages[12] = mRS.allocationCreateFromBitmapResourceBoxed(mRes, R.drawable.p13, ie, true); for(int ct=0; ct < mImages.length; ct++) { mImages[ct].uploadToTexture(1); diff --git a/libs/rs/java/Rollo/res/raw/maps.png b/libs/rs/java/Rollo/res/raw/maps.png new file mode 100644 index 0000000000000000000000000000000000000000..fd5fc39037c6b76b48384af1157c84b9079f90aa GIT binary patch literal 5374 zcmVt-CIIR$^Yk~9Bu**cljFthns-I zUH%5Z;U?g4m%jmUxCuDiMLXOCl*-nHqFopKohz9u1b!)T600DRb|YQ8&`Gjg2>!FPiMv@Qo%izlhZTUGXNfcYohLmJ zT5x4VpZ76jV+1J#(z0OZPV5bT#$59fi9IWEtQ5dsT$gLQUY6_MD;f?P0KJPEztwok zb+`H!U4fiC8`pJ_QdZnu*G1;@=r8;)$;WOZHL?-Fl5q9(74qTtf{w!iz~HCn9uq#} z+I7aoR|wf0tz@_s2vVZ->_oZ$2gEl066xksio*Pkm*lp0OUq#aAo0&vt*!sY-N(vs zXp~XMA-DQP?0tK1)B91T%s`vJ5Gj;02r`q!^RHiJsONu>l9dk)amKedVgpkCm5hAg z)8L-P9cKg={(S}Wxwlp@eDeipzkZhbw}*)gdZ~Y_2YKhso_MuiW?H@SS<~U0 zx16ACEqAufh*Xrql!kzu#3qfR2$T||lYk&p6_HHg`hCc0?dW+Q8O^dFJC-B`&?#uc z0n57vU`JB?BpFQ(jkpc<0#rpxvyYd0Q z?X#}ll2)dP0^bNxycdB$!p@{<-!!7!W_uaF{J5|E%IfV;N-2>-A@9}6W^3Qlw=jw@^uN*tt(YHh2# z=x4g(xryl({aiLdGsfiuLCMbJ5;hgX_9@Kl>H( z{#2C~m^HMZ@GL!ZT6q>=-3H8hFG*)K9FR_qMzQ+Ck3MkguUD;Fb;iLgi2f=7wr4Vd zcXHZ|qK2f)^$FTui5yMljdcYnY6ku#OUPLnvbieBS6w;bkpA+G1qUi6a_uViwYMYl z0~NHHvW|g7U7N1!zZ)4DxzDn!@Ouux`ndM+h@qPReRG!o^&kglMf@0 zKfW9l^5oN4je-H+zH#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vPnj}B zOjTY4S=({ve5X~I*M9RfOlLZ6f$w4z*Ay@RDgO!wG5wWFc_mmpRW%hjk-~X9FQCqw zH?QgP%P&7W8ja4ZtEk zx@FsOTR#o^Z?Sf?OY;}=-<3~^Tx*>du;8<$jF4A*)R;{C->a-+194;tT}<@ zG#eYsZHfA83D5pAfk1%a;bHpw`^SC5!49 z$any#D}oUM>cio1tjBjFBl94#s2;Kky1LAWo6>=_@33PSFc^Ze0jHR z+lPFHck$xIT~~kp)1PTDb{lj3k79@ny$wIbR-$EpV_6oxy}e{IneuzfmoI^C$OW*0H|mvfKl4jQYiR~YEVK87cM+z!GZ;6z4_*wTb_C5nZ9BljlwCd>RrNv zF1oHOOMi6trR`H2=S&a0fzxzVxy|eK($Ud@*Xw29zI_Z14&u75yzP7EQnU3t#xOKM?RnqtS9&T?j#Q zb2BY1E#z`J-g@h;y{DXV%H_bHnIr)+j;BKbpymMMK^bd4K?-1$t`aCdDnXfae?nDN zv2^LuOFKF`<}@@kh*EkT3R&i9)26X)+qSL89COSkfo>^le@ArEnkx0cR%L5NQ@cn!4x#!2g-h)+tc%J~M`Jvk8 zV=!J*Le$n26%eYbDod9x{ZwaX=iE>zB>a9qsZ?tC^wUrOEU*$t912e#*x%+#VJf31 zIV~YXmO{un$f)@k6#Pa>Q%Zg%2m~C*@!fF44G(?%;~$@O)m2wr;`Ms#H*DCj0_foo cY`;|g4`BSAOOqT*_W%F@07*qoM6N<$f(S85Qvd(} literal 0 HcmV?d00001 diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java index c080176cf69a7..039d4e91af9ef 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java @@ -18,7 +18,6 @@ package com.android.rollo; import java.io.Writer; -import android.renderscript.RSSurfaceView; import android.renderscript.RenderScript; import android.renderscript.ProgramVertexAlloc; @@ -33,13 +32,7 @@ import android.graphics.drawable.Drawable; import android.graphics.Typeface; import android.os.Handler; import android.os.Message; -import android.util.AttributeSet; import android.util.Log; -import android.view.Surface; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.KeyEvent; -import android.view.MotionEvent; public class RolloRS { //public static final int STATE_SELECTED_ID = 0; @@ -101,7 +94,6 @@ public class RolloRS { private RenderScript.Sampler mSamplerText; private RenderScript.ProgramFragmentStore mPFSBackground; private RenderScript.ProgramFragmentStore mPFSText; - private RenderScript.ProgramFragment mPFBackground; private RenderScript.ProgramFragment mPFImages; private RenderScript.ProgramFragment mPFText; private RenderScript.ProgramVertex mPV; @@ -110,8 +102,6 @@ public class RolloRS { private ProgramVertexAlloc mPVOrthoAlloc; private RenderScript.Allocation[] mIcons; private RenderScript.Allocation[] mLabels; - private RenderScript.Allocation mIconPlate; - private RenderScript.Allocation mBackground; private int[] mAllocStateBuf; private RenderScript.Allocation mAllocState; @@ -219,155 +209,85 @@ public class RolloRS { mAllocLabelID = mRS.allocationCreatePredefSized( RenderScript.ElementPredefined.USER_I32, mLabels.length); + RenderScript.ElementPredefined ie565 = + RenderScript.ElementPredefined.RGB_565; + RenderScript.ElementPredefined ie8888 = + RenderScript.ElementPredefined.RGBA_8888; - Bitmap b; - BitmapFactory.Options opts = new BitmapFactory.Options(); - opts.inScaled = false; + mIcons[0] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.browser, ie8888, true); + mIcons[1] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.market, ie8888, true); + mIcons[2] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.photos, ie8888, true); + mIcons[3] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.settings, ie8888, true); + mIcons[4] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.calendar, ie8888, true); + mIcons[5] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.g1155, ie8888, true); + mIcons[6] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.g2140, ie8888, true); + mIcons[7] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.maps, ie8888, true); + mIcons[8] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path431, ie8888, true); + mIcons[9] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path676, ie8888, true); + mIcons[10] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path754, ie8888, true); + mIcons[11] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path815, ie8888, true); + mIcons[12] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path1920, ie8888, true); + mIcons[13] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path1927, ie8888, true); + mIcons[14] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path3099, ie8888, true); + mIcons[15] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path3950, ie8888, true); + mIcons[16] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path4481, ie8888, true); + mIcons[17] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.path5168, ie8888, true); + mIcons[18] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.polygon2408, ie8888, true); - b = BitmapFactory.decodeResource(mRes, R.raw.cf_background, opts); - mBackground = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mBackground.setName("TexBk"); - - - b = BitmapFactory.decodeResource(mRes, R.raw.browser, opts); - mIcons[0] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); mLabels[0] = makeTextBitmap("browser"); - - b = BitmapFactory.decodeResource(mRes, R.raw.market, opts); - mIcons[1] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); mLabels[1] = makeTextBitmap("market"); - - b = BitmapFactory.decodeResource(mRes, R.raw.photos, opts); - mIcons[2] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); mLabels[2] = makeTextBitmap("photos"); - - b = BitmapFactory.decodeResource(mRes, R.raw.settings, opts); - mIcons[3] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); mLabels[3] = makeTextBitmap("settings"); - - b = BitmapFactory.decodeResource(mRes, R.raw.calendar, opts); - mIcons[4] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[4] = makeTextBitmap("creed"); - - b = BitmapFactory.decodeResource(mRes, R.raw.g1155, opts); - mIcons[5] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[5] = makeTextBitmap("BOA"); - - b = BitmapFactory.decodeResource(mRes, R.raw.g2140, opts); - mIcons[6] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[6] = makeTextBitmap("chess"); - - b = BitmapFactory.decodeResource(mRes, R.raw.maps, opts); - mIcons[7] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[7] = makeTextBitmap("Dictionary"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path431, opts); - mIcons[8] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[8] = makeTextBitmap("facebook"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path676, opts); - mIcons[9] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[9] = makeTextBitmap("Flash Light"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path754, opts); - mIcons[10] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[10] = makeTextBitmap("Flight Control"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path815, opts); - mIcons[11] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[11] = makeTextBitmap("google earth"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path1920, opts); - mIcons[12] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[12] = makeTextBitmap("Harry Potter"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path1927, opts); - mIcons[13] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[13] = makeTextBitmap("Movies"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path3099, opts); - mIcons[14] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[14] = makeTextBitmap("NY Times"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path3950, opts); - mIcons[15] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[15] = makeTextBitmap("Pandora"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path4481, opts); - mIcons[16] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[16] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.path5168, opts); - mIcons[17] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[17] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.polygon2408, opts); - mIcons[18] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true); - mLabels[18] = makeTextBitmap("Public Radio"); - - /* - b = BitmapFactory.decodeResource(mRes, R.raw.solitaire, opts); - mIcons[19] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[19] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.sudoku, opts); - mIcons[20] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[20] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.taptaprevenge, opts); - mIcons[21] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[21] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.tetris, opts); - mIcons[22] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[22] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.tictactoe, opts); - mIcons[23] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[23] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.tweetie, opts); - mIcons[24] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[24] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.urbanspoon, opts); - mIcons[25] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[25] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.waterslide_extreme, opts); - mIcons[26] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[26] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.weather_channel, opts); - mIcons[27] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[27] = makeTextBitmap("Public Radio"); - - b = BitmapFactory.decodeResource(mRes, R.raw.zippo, opts); - mIcons[28] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - mLabels[28] = makeTextBitmap("Public Radio"); -*/ + mLabels[4] = makeTextBitmap("calendar"); + mLabels[5] = makeTextBitmap("g1155"); + mLabels[6] = makeTextBitmap("g2140"); + mLabels[7] = makeTextBitmap("maps"); + mLabels[8] = makeTextBitmap("path431"); + mLabels[9] = makeTextBitmap("path676"); + mLabels[10] = makeTextBitmap("path754"); + mLabels[11] = makeTextBitmap("path815"); + mLabels[12] = makeTextBitmap("path1920"); + mLabels[13] = makeTextBitmap("path1927"); + mLabels[14] = makeTextBitmap("path3099"); + mLabels[15] = makeTextBitmap("path3950"); + mLabels[16] = makeTextBitmap("path4481"); + mLabels[17] = makeTextBitmap("path5168"); + mLabels[18] = makeTextBitmap("polygon2408"); mIcons[19] = mIcons[0]; mIcons[20] = mIcons[1]; mIcons[21] = mIcons[2]; mIcons[22] = mIcons[3]; - mIcons[23] = mIcons[2]; - mIcons[24] = mIcons[1]; - mIcons[25] = mIcons[0]; - mIcons[26] = mIcons[1]; - mIcons[27] = mIcons[2]; - mIcons[28] = mIcons[3]; + mIcons[23] = mIcons[4]; + mIcons[24] = mIcons[5]; + mIcons[25] = mIcons[6]; + mIcons[26] = mIcons[7]; + mIcons[27] = mIcons[8]; + mIcons[28] = mIcons[9]; mLabels[19] = mLabels[0]; mLabels[20] = mLabels[1]; mLabels[21] = mLabels[2]; mLabels[22] = mLabels[3]; - mLabels[23] = mLabels[2]; - mLabels[24] = mLabels[1]; - mLabels[25] = mLabels[0]; - mLabels[26] = mLabels[1]; - mLabels[27] = mLabels[2]; - mLabels[28] = mLabels[3]; + mLabels[23] = mLabels[4]; + mLabels[24] = mLabels[5]; + mLabels[25] = mLabels[6]; + mLabels[26] = mLabels[7]; + mLabels[27] = mLabels[8]; + mLabels[28] = mLabels[9]; + +/* + mIcons[19] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.solitaire, ie8888, true); + mIcons[20] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.sudoku, ie8888, true); + mIcons[21] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.taptaprevenge, ie8888, true); + mIcons[22] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.tetris, ie8888, true); + mIcons[23] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.tictactoe, ie8888, true); + mIcons[24] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.tweetie, ie8888, true); + mIcons[25] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.urbanspoon, ie8888, true); + mIcons[26] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.waterslide_extreme, ie8888, true); + mIcons[27] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.weather_channel, ie8888, true); + mIcons[28] = mRS.allocationCreateFromBitmapResource(mRes, R.raw.zippo, ie8888, true); +*/ for(int ct=0; ct < mIcons.length; ct++) { @@ -378,33 +298,6 @@ public class RolloRS { } mAllocIconID.data(mAllocIconIDBuf); mAllocLabelID.data(mAllocLabelIDBuf); - - RenderScript.Element e = mRS.elementGetPredefined(RenderScript.ElementPredefined.RGB_565); - mRS.typeBegin(e); - mRS.typeAdd(RenderScript.Dimension.X, 64); - mRS.typeAdd(RenderScript.Dimension.Y, 64); - RenderScript.Type t = mRS.typeCreate(); - mIconPlate = mRS.allocationCreateTyped(t); - //t.destroy(); - //e.destroy(); - - int tmp[] = new int[64 * 32]; - for(int ct = 0; ct < (64*32); ct++) { - tmp[ct] = 7 | (13 << 5) | (7 << 11); - tmp[ct] = tmp[ct] | (tmp[ct] << 16); - } - for(int ct = 0; ct < 32; ct++) { - tmp[ct] = 0; - tmp[ct + (63*32)] = 0; - } - for(int ct = 0; ct < 64; ct++) { - tmp[ct * 32] = 0; - tmp[ct * 32 + 31] = 0; - } - mIconPlate.data(tmp); - mIconPlate.uploadToTexture(0); - mIconPlate.setName("Plate"); - mPFImages.bindTexture(mIconPlate, 0); } } @@ -427,7 +320,6 @@ public class RolloRS { mRS.scriptCSetScript(mRes, R.raw.rollo); //mRS.scriptCSetScript(mRes, R.raw.rollo2); mRS.scriptCSetRoot(true); - //mRS.scriptCSetClearDepth(0); mScript = mRS.scriptCCreate(); mAllocStateBuf = new int[] {0, 0, 0, 8, 0, 0, -1, 0, mAllocIconIDBuf.length, 0, 0};