summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests
diff options
context:
space:
mode:
authorXia Wang <xiaw@google.com>2011-06-14 19:12:12 -0700
committerXia Wang <xiaw@google.com>2011-06-15 17:16:42 -0700
commit7c7d135790ccc66bbee793c42c7ed65cf5bb76cd (patch)
tree2a636ef02377f3536a8e92a8d34fa36bdbf078a1 /tests/RenderScriptTests
parentcb040a063fd527afc37f6f703fab882ac3ab63cd (diff)
downloadframeworks_base-7c7d135790ccc66bbee793c42c7ed65cf5bb76cd.zip
frameworks_base-7c7d135790ccc66bbee793c42c7ed65cf5bb76cd.tar.gz
frameworks_base-7c7d135790ccc66bbee793c42c7ed65cf5bb76cd.tar.bz2
Fill in opengl benchmark test:
- display a list view Change-Id: I72ac8e4c84ae497f2297ed3c803a62db2600ef08
Diffstat (limited to 'tests/RenderScriptTests')
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java12
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs48
2 files changed, 51 insertions, 9 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
index b568781..5ca49ad 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
@@ -45,6 +45,8 @@ public class RsBenchRS {
private static final String TAG = "RsBenchRS";
private static final String SAMPLE_TEXT = "Bench Test";
+ private static final String LIST_TEXT =
+ "This is a sample list of text to show in the list view";
int mWidth;
int mHeight;
@@ -128,6 +130,7 @@ public class RsBenchRS {
private ScriptField_ListAllocs_s mTextureAllocs;
private ScriptField_ListAllocs_s mSampleTextAllocs;
+ private ScriptField_ListAllocs_s mSampleListViewAllocs;
private ScriptC_rsbench mScript;
@@ -567,6 +570,15 @@ public class RsBenchRS {
mSampleTextAllocs.copyAll();
mScript.bind_gSampleTextList100(mSampleTextAllocs);
+ mSampleListViewAllocs = new ScriptField_ListAllocs_s(mRS, 1000);
+ for (int i = 0; i < 1000; i++) {
+ ScriptField_ListAllocs_s.Item textElem = new ScriptField_ListAllocs_s.Item();
+ textElem.item = Allocation.createFromString(mRS, LIST_TEXT, Allocation.USAGE_SCRIPT);
+ mSampleListViewAllocs.set(textElem, i, false);
+ }
+ mSampleListViewAllocs.copyAll();
+ mScript.bind_gListViewText(mSampleListViewAllocs);
+
mRS.bindRootScript(mScript);
}
}
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
index 0294b31..89c5e5a 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
@@ -23,7 +23,7 @@
const int RS_MSG_TEST_DONE = 100;
const int RS_MSG_RESULTS_READY = 101;
-const int gMaxModes = 29;
+const int gMaxModes = 30;
int gMaxLoops;
// Allocation to send test names back to java
@@ -52,6 +52,7 @@ typedef struct ListAllocs_s {
ListAllocs *gTexList100;
ListAllocs *gSampleTextList100;
+ListAllocs *gListViewText;
rs_mesh g10by10Mesh;
rs_mesh g100by100Mesh;
@@ -303,6 +304,35 @@ static void displayImageWithText(int wResolution, int hResolution, int meshMode)
}
}
+// Display a list of text as the list view
+static void displayListView() {
+ // set text color
+ rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
+ rsgBindFont(gFontSans);
+
+ // get the size of the list
+ rs_allocation textAlloc;
+ textAlloc = rsGetAllocation(gListViewText);
+ int allocSize = rsAllocationGetDimX(textAlloc);
+
+ int listItemHeight = 80;
+ int yOffset = listItemHeight;
+
+ // set the color for the list divider
+ rsgBindProgramFragment(gProgFragmentColor);
+ rsgProgramFragmentConstantColor(gProgFragmentColor, 1.0, 1.0, 1.0, 1);
+
+ // draw the list with divider
+ for (int i = 0; i < allocSize; i++) {
+ if (yOffset - listItemHeight > gRenderSurfaceH) {
+ break;
+ }
+ rsgDrawRect(0, yOffset - 1, gRenderSurfaceW, yOffset, 0);
+ rsgDrawText(gListViewText[i].item, 20, yOffset - 10);
+ yOffset += listItemHeight;
+ }
+}
+
static float gTorusRotation = 0;
static void updateModelMatrix(rs_matrix4x4 *matrix, void *buffer) {
if (buffer == 0) {
@@ -602,14 +632,11 @@ static const char *testNames[] = {
"Geo test 25.6k heavy fragment heavy vertex",
"Geo test 51.2k heavy fragment heavy vertex",
"Geo test 204.8k small tries heavy fragment heavy vertex",
- "UI test with icon display 10 by 10", // 25
- "UI test with icon display 100 by 100", // 26
- "UI test with image and text display 3 pages", // 27
- "UI test with image and text display 5 pages", // 28
- "UI test with list view", // 29
-// "UI test with live wallpaper", // 30
-// "Mesh with 10 by 10 texture",
-// "Mesh with 100 by 100 texture",
+ "UI test with icon display 10 by 10",
+ "UI test with icon display 100 by 100",
+ "UI test with image and text display 3 pages",
+ "UI test with image and text display 5 pages",
+ "UI test with list view",
};
void getTestName(int testIndex) {
@@ -714,6 +741,9 @@ static void runTest(int index) {
case 28:
displayImageWithText(7, 5, 1);
break;
+ case 29:
+ displayListView();
+ break;
}
}