diff options
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | res/raw/allapps_bc.bc | bin | 11608 -> 0 bytes | |||
-rw-r--r-- | src/com/android/launcher2/AllApps3D.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/ScriptC_Allapps.java | 261 | ||||
-rw-r--r-- | src/com/android/launcher2/ScriptField_VpConsts.java | 88 | ||||
-rw-r--r-- | src/com/android/launcher2/allapps.rs (renamed from res/raw/allapps.rs) | 6 |
6 files changed, 5 insertions, 354 deletions
diff --git a/Android.mk b/Android.mk index dc72ec6db..fe502e265 100644 --- a/Android.mk +++ b/Android.mk @@ -21,7 +21,7 @@ LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := android-common -LOCAL_SRC_FILES := $(call all-subdir-java-files) +LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-renderscript-files-under, src) LOCAL_PACKAGE_NAME := Launcher2 LOCAL_CERTIFICATE := shared diff --git a/res/raw/allapps_bc.bc b/res/raw/allapps_bc.bc Binary files differdeleted file mode 100644 index e2341bd61..000000000 --- a/res/raw/allapps_bc.bc +++ /dev/null diff --git a/src/com/android/launcher2/AllApps3D.java b/src/com/android/launcher2/AllApps3D.java index c17ad3850..bb18870dc 100644 --- a/src/com/android/launcher2/AllApps3D.java +++ b/src/com/android/launcher2/AllApps3D.java @@ -1004,7 +1004,7 @@ public class AllApps3D extends RSSurfaceView mRes = res; mWidth = width; mHeight = height; - mScript = new ScriptC_Allapps(sRS, mRes, R.raw.allapps_bc, true); + mScript = new ScriptC_Allapps(sRS, mRes, R.raw.allapps, true); initProgramVertex(); initProgramFragment(); diff --git a/src/com/android/launcher2/ScriptC_Allapps.java b/src/com/android/launcher2/ScriptC_Allapps.java deleted file mode 100644 index cc1bb49fd..000000000 --- a/src/com/android/launcher2/ScriptC_Allapps.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher2; - -import android.renderscript.*; -import android.content.res.Resources; -import android.util.Log; - -public class ScriptC_Allapps extends ScriptC { - // Constructor - public ScriptC_Allapps(RenderScript rs, Resources resources, int id, boolean isRoot) { - super(rs, resources, id, isRoot); - } - - private final static int mExportVarIdx_COLUMNS_PER_PAGE_PORTRAIT = 0; - private int mExportVar_COLUMNS_PER_PAGE_PORTRAIT; - public void set_COLUMNS_PER_PAGE_PORTRAIT(int v) { - mExportVar_COLUMNS_PER_PAGE_PORTRAIT = v; - setVar(mExportVarIdx_COLUMNS_PER_PAGE_PORTRAIT, v); - } - - public int get_COLUMNS_PER_PAGE_PORTRAIT() { - return mExportVar_COLUMNS_PER_PAGE_PORTRAIT; - } - - private final static int mExportVarIdx_ROWS_PER_PAGE_PORTRAIT = 1; - private int mExportVar_ROWS_PER_PAGE_PORTRAIT; - public void set_ROWS_PER_PAGE_PORTRAIT(int v) { - mExportVar_ROWS_PER_PAGE_PORTRAIT = v; - setVar(mExportVarIdx_ROWS_PER_PAGE_PORTRAIT, v); - } - - public int get_ROWS_PER_PAGE_PORTRAIT() { - return mExportVar_ROWS_PER_PAGE_PORTRAIT; - } - - private final static int mExportVarIdx_COLUMNS_PER_PAGE_LANDSCAPE = 2; - private int mExportVar_COLUMNS_PER_PAGE_LANDSCAPE; - public void set_COLUMNS_PER_PAGE_LANDSCAPE(int v) { - mExportVar_COLUMNS_PER_PAGE_LANDSCAPE = v; - setVar(mExportVarIdx_COLUMNS_PER_PAGE_LANDSCAPE, v); - } - - public int get_COLUMNS_PER_PAGE_LANDSCAPE() { - return mExportVar_COLUMNS_PER_PAGE_LANDSCAPE; - } - - private final static int mExportVarIdx_ROWS_PER_PAGE_LANDSCAPE = 3; - private int mExportVar_ROWS_PER_PAGE_LANDSCAPE; - public void set_ROWS_PER_PAGE_LANDSCAPE(int v) { - mExportVar_ROWS_PER_PAGE_LANDSCAPE = v; - setVar(mExportVarIdx_ROWS_PER_PAGE_LANDSCAPE, v); - } - - public int get_ROWS_PER_PAGE_LANDSCAPE() { - return mExportVar_ROWS_PER_PAGE_LANDSCAPE; - } - - private final static int mExportVarIdx_gIconCount = 4; - private int mExportVar_gIconCount; - public void set_gIconCount(int v) { - mExportVar_gIconCount = v; - setVar(mExportVarIdx_gIconCount, v); - } - - public int get_gIconCount() { - return mExportVar_gIconCount; - } - - private final static int mExportVarIdx_gSelectedIconIndex = 5; - private int mExportVar_gSelectedIconIndex; - public void set_gSelectedIconIndex(int v) { - mExportVar_gSelectedIconIndex = v; - setVar(mExportVarIdx_gSelectedIconIndex, v); - } - - public int get_gSelectedIconIndex() { - return mExportVar_gSelectedIconIndex; - } - - private final static int mExportVarIdx_gSelectedIconTexture = 6; - private Allocation mExportVar_gSelectedIconTexture; - public void set_gSelectedIconTexture(Allocation v) { - mExportVar_gSelectedIconTexture = v; - setVar(mExportVarIdx_gSelectedIconTexture, (v == null) ? 0 : v.getID()); - } - - public Allocation get_gSelectedIconTexture() { - return mExportVar_gSelectedIconTexture; - } - - private final static int mExportVarIdx_gHomeButton = 7; - private Allocation mExportVar_gHomeButton; - public void set_gHomeButton(Allocation v) { - mExportVar_gHomeButton = v; - setVar(mExportVarIdx_gHomeButton, (v == null) ? 0 : v.getID()); - } - - public Allocation get_gHomeButton() { - return mExportVar_gHomeButton; - } - - private final static int mExportVarIdx_gPFTexNearest = 8; - private ProgramFragment mExportVar_gPFTexNearest; - public void set_gPFTexNearest(ProgramFragment v) { - mExportVar_gPFTexNearest = v; - setVar(mExportVarIdx_gPFTexNearest, (v == null) ? 0 : v.getID()); - } - - public ProgramFragment get_gPFTexNearest() { - return mExportVar_gPFTexNearest; - } - - private final static int mExportVarIdx_gPFTexMip = 9; - private ProgramFragment mExportVar_gPFTexMip; - public void set_gPFTexMip(ProgramFragment v) { - mExportVar_gPFTexMip = v; - setVar(mExportVarIdx_gPFTexMip, (v == null) ? 0 : v.getID()); - } - - public ProgramFragment get_gPFTexMip() { - return mExportVar_gPFTexMip; - } - - private final static int mExportVarIdx_gPFTexMipAlpha = 10; - private ProgramFragment mExportVar_gPFTexMipAlpha; - public void set_gPFTexMipAlpha(ProgramFragment v) { - mExportVar_gPFTexMipAlpha = v; - setVar(mExportVarIdx_gPFTexMipAlpha, (v == null) ? 0 : v.getID()); - } - - public ProgramFragment get_gPFTexMipAlpha() { - return mExportVar_gPFTexMipAlpha; - } - - private final static int mExportVarIdx_gPVCurve = 11; - private ProgramVertex mExportVar_gPVCurve; - public void set_gPVCurve(ProgramVertex v) { - mExportVar_gPVCurve = v; - setVar(mExportVarIdx_gPVCurve, (v == null) ? 0 : v.getID()); - } - - public ProgramVertex get_gPVCurve() { - return mExportVar_gPVCurve; - } - - private final static int mExportVarIdx_gPS = 12; - private ProgramStore mExportVar_gPS; - public void set_gPS(ProgramStore v) { - mExportVar_gPS = v; - setVar(mExportVarIdx_gPS, (v == null) ? 0 : v.getID()); - } - - public ProgramStore get_gPS() { - return mExportVar_gPS; - } - - private final static int mExportVarIdx_gSMCell = 13; - private Mesh mExportVar_gSMCell; - public void set_gSMCell(Mesh v) { - mExportVar_gSMCell = v; - setVar(mExportVarIdx_gSMCell, (v == null) ? 0 : v.getID()); - } - - public Mesh get_gSMCell() { - return mExportVar_gSMCell; - } - - private final static int mExportVarIdx_gIconIDs = 14; - private Allocation mExportVar_gIconIDs; - public void bind_gIconIDs(Allocation v) { - mExportVar_gIconIDs = v; - if(v == null) bindAllocation(null, mExportVarIdx_gIconIDs); - else bindAllocation(v, mExportVarIdx_gIconIDs); - } - - public Allocation get_gIconIDs() { - return mExportVar_gIconIDs; - } - - private final static int mExportVarIdx_gLabelIDs = 15; - private Allocation mExportVar_gLabelIDs; - public void bind_gLabelIDs(Allocation v) { - mExportVar_gLabelIDs = v; - if(v == null) bindAllocation(null, mExportVarIdx_gLabelIDs); - else bindAllocation(v, mExportVarIdx_gLabelIDs); - } - - public Allocation get_gLabelIDs() { - return mExportVar_gLabelIDs; - } - - private final static int mExportVarIdx_vpConstants = 16; - private ScriptField_VpConsts mExportVar_vpConstants; - public void bind_vpConstants(ScriptField_VpConsts v) { - mExportVar_vpConstants = v; - if(v == null) bindAllocation(null, mExportVarIdx_vpConstants); - else bindAllocation(v.getAllocation(), mExportVarIdx_vpConstants); - } - - public ScriptField_VpConsts get_vpConstants() { - return mExportVar_vpConstants; - } - - private final static int mExportVarIdx_gTargetPos = 17; - private float mExportVar_gTargetPos; - public void set_gTargetPos(float v) { - mExportVar_gTargetPos = v; - setVar(mExportVarIdx_gTargetPos, v); - } - - public float get_gTargetPos() { - return mExportVar_gTargetPos; - } - - private final static int mExportFuncIdx_move = 0; - public void invoke_move(float newPos) { - FieldPacker move_fp = new FieldPacker(4); - move_fp.addF32(newPos); - invoke(mExportFuncIdx_move, move_fp); - } - - private final static int mExportFuncIdx_moveTo = 1; - public void invoke_moveTo(float targetPos) { - FieldPacker moveTo_fp = new FieldPacker(4); - moveTo_fp.addF32(targetPos); - invoke(mExportFuncIdx_moveTo, moveTo_fp); - } - - private final static int mExportFuncIdx_setZoom = 2; - public void invoke_setZoom(float z, int animate) { - FieldPacker setZoom_fp = new FieldPacker(8); - setZoom_fp.addF32(z); - setZoom_fp.addI32(animate); - invoke(mExportFuncIdx_setZoom, setZoom_fp); - } - - private final static int mExportFuncIdx_fling = 3; - public void invoke_fling(float newPos, float vel) { - FieldPacker fling_fp = new FieldPacker(8); - fling_fp.addF32(newPos); - fling_fp.addF32(vel); - invoke(mExportFuncIdx_fling, fling_fp); - } - -} - diff --git a/src/com/android/launcher2/ScriptField_VpConsts.java b/src/com/android/launcher2/ScriptField_VpConsts.java deleted file mode 100644 index ff183f4aa..000000000 --- a/src/com/android/launcher2/ScriptField_VpConsts.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher2; - -import android.renderscript.*; -import android.content.res.Resources; -import android.util.Log; -import android.renderscript.Element; -import android.renderscript.FieldPacker; -import android.renderscript.Float2; -import android.renderscript.Float4; -import android.renderscript.RenderScript; - -public class ScriptField_VpConsts extends android.renderscript.Script.FieldBase { - static public class Item { - public static final int sizeof = 48; - - Float4 Position; - Float4 ScaleOffset; - Float2 BendPos; - Float2 ImgSize; - - Item() { - Position = new Float4(); - ScaleOffset = new Float4(); - BendPos = new Float2(); - ImgSize = new Float2(); - } - - } - - private Item mItemArray[]; - private FieldPacker mIOBuffer; - public ScriptField_VpConsts(RenderScript rs, int count) { - mItemArray = null; - mIOBuffer = null; - { - Element.Builder eb = new Element.Builder(rs); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Position"); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "ScaleOffset"); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "BendPos"); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "ImgSize"); - mElement = eb.create(); - } - - init(rs, count); - } - - private void copyToArray(Item i, int index) { - if (mIOBuffer == null) mIOBuffer = new FieldPacker(Item.sizeof * mType.getX() /* count */); - mIOBuffer.reset(index * Item.sizeof); - mIOBuffer.addF32(i.Position); - mIOBuffer.addF32(i.ScaleOffset); - mIOBuffer.addF32(i.BendPos); - mIOBuffer.addF32(i.ImgSize); - } - - public void set(Item i, int index, boolean copyNow) { - if (mItemArray == null) mItemArray = new Item[mType.getX() /* count */]; - mItemArray[index] = i; - if (copyNow) { - copyToArray(i, index); - mAllocation.subData1D(index /** Item.sizeof*/, 1/*Item.sizeof*/, mIOBuffer.getData()); - } - - } - - public void copyAll() { - for (int ct=0; ct < mItemArray.length; ct++) copyToArray(mItemArray[ct], ct); - mAllocation.data(mIOBuffer.getData()); - } - -} - diff --git a/res/raw/allapps.rs b/src/com/android/launcher2/allapps.rs index aaf7c10d7..c13608c8e 100644 --- a/res/raw/allapps.rs +++ b/src/com/android/launcher2/allapps.rs @@ -2,9 +2,9 @@ #pragma rs java_package_name(com.android.launcher2) -#include "../../../../../frameworks/base/libs/rs/scriptc/rs_types.rsh" -#include "../../../../../frameworks/base/libs/rs/scriptc/rs_math.rsh" -#include "../../../../../frameworks/base/libs/rs/scriptc/rs_graphics.rsh" +#include "rs_types.rsh" +#include "rs_math.rsh" +#include "rs_graphics.rsh" #define PI 3.14159f |