summaryrefslogtreecommitdiffstats
path: root/res/raw
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-10-15 15:40:54 -0700
committerJason Sams <rjsams@android.com>2009-10-15 15:40:54 -0700
commit41b61c824c60996fe31d1331aadeea3a3a485ef6 (patch)
tree1957681dfe15f340d72d58f7850e18ae81735edd /res/raw
parentb52dfa066d602c2a7304180690c47010dc4fce76 (diff)
downloadandroid_packages_apps_Trebuchet-41b61c824c60996fe31d1331aadeea3a3a485ef6.tar.gz
android_packages_apps_Trebuchet-41b61c824c60996fe31d1331aadeea3a3a485ef6.tar.bz2
android_packages_apps_Trebuchet-41b61c824c60996fe31d1331aadeea3a3a485ef6.zip
Implement workaround for GL driver which is slow to render the first frame with new state. This change will render a transparent frame when receiving new state to warm the driver.
Diffstat (limited to 'res/raw')
-rw-r--r--res/raw/rollo.c3
-rw-r--r--res/raw/rollo2.c3
-rw-r--r--res/raw/rollo3.c37
-rw-r--r--res/raw/rollo4.c3
4 files changed, 36 insertions, 10 deletions
diff --git a/res/raw/rollo.c b/res/raw/rollo.c
index 87fdd2207..2dd17aa42 100644
--- a/res/raw/rollo.c
+++ b/res/raw/rollo.c
@@ -82,6 +82,9 @@ void init() {
g_Zoom = 0;
}
+void resetHWWar() {
+}
+
void move() {
if (g_LastTouchDown) {
float dx = -(state->newPositionX - g_LastPositionX);
diff --git a/res/raw/rollo2.c b/res/raw/rollo2.c
index cc273b1ab..ad7b18f9d 100644
--- a/res/raw/rollo2.c
+++ b/res/raw/rollo2.c
@@ -81,6 +81,9 @@ void init() {
g_Zoom = 0;
}
+void resetHWWar() {
+}
+
void move() {
if (g_LastTouchDown) {
float dx = -(state->newPositionX - g_LastPositionX);
diff --git a/res/raw/rollo3.c b/res/raw/rollo3.c
index 5eec22a91..2aefa291a 100644
--- a/res/raw/rollo3.c
+++ b/res/raw/rollo3.c
@@ -5,6 +5,7 @@
#define PI 3.14159f
+int g_SpecialHWWar;
// Attraction to center values from page edge to page center.
float g_AttractionTable[9];
@@ -52,6 +53,13 @@ void updateReadback() {
}
}
+void setColor(float r, float g, float b, float a) {
+ if (g_SpecialHWWar) {
+ color(0, 0, 0, 0.001f);
+ } else {
+ color(r, g, b, a);
+ }
+}
void init() {
g_AttractionTable[0] = 6.5f;
@@ -70,6 +78,11 @@ void init() {
g_LastTouchDown = 0;
g_LastPositionX = 0;
g_Zoom = 0;
+ g_SpecialHWWar = 1;
+}
+
+void resetHWWar() {
+ g_SpecialHWWar = 1;
}
void move() {
@@ -219,7 +232,7 @@ int positionStrip(float row, float column, int isTop)
void
draw_home_button()
{
- color(1.0f, 1.0f, 1.0f, 1.0f);
+ setColor(1.0f, 1.0f, 1.0f, 1.0f);
bindTexture(NAMED_PFTexLinear, 0, params->homeButtonId);
float scale = 2.0f / SCREEN_WIDTH_PX;
@@ -263,7 +276,7 @@ void drawFrontGrid(float rowOffset)
float x = colWidth * col - ((128 - colWidth) / 2);
if ((y >= ymin) && (y <= ymax)) {
- color(1.f, 1.f, 1.f, 1.f);
+ setColor(1.f, 1.f, 1.f, 1.f);
bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, iconNum));
drawSpriteScreenspace(x, y, 0, 128, 128);
}
@@ -278,7 +291,7 @@ void drawFrontGrid(float rowOffset)
}
a = clampf(a, 0, 1);
- color(1, 1, 1, a);
+ setColor(1, 1, 1, a);
bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_LABEL_IDS, iconNum));
drawSpriteScreenspace(x, y - 44, 0,
params->bubbleBitmapWidth, params->bubbleBitmapHeight);
@@ -369,15 +382,13 @@ main(int launchID)
}
// Set clear value to dim the background based on the zoom position.
- if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
+ if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f) && !g_SpecialHWWar) {
pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// When we're zoomed out and not tracking motion events, reset the pos to 0.
if (!g_LastTouchDown) {
g_PosPage = 0;
}
return lastFrame(0);
- } else if (g_Zoom < 0.85f) {
- pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
} else {
pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
}
@@ -414,6 +425,16 @@ main(int launchID)
}
draw_home_button();
+
+ // This is a WAR to do a rendering pass without drawing during init to
+ // force the driver to preload and compile its shaders.
+ // Without this the first animation does not appear due to the time it
+ // takes to init the driver state.
+ if (g_SpecialHWWar) {
+ g_SpecialHWWar = 0;
+ return 1;
+ }
+
if (0) {
float h = getHeight();
@@ -434,10 +455,6 @@ main(int launchID)
drawLine(0, y, 0, 480, y, 0);
}
-
- // Draw the home button ========================================
- //draw_home_button();
-
// Bug workaround where the last frame is not always displayed
// So we keep rendering until the bug is fixed.
return lastFrame((g_PosVelocity != 0) || fracf(g_PosPage) || g_Zoom != state->zoomTarget);
diff --git a/res/raw/rollo4.c b/res/raw/rollo4.c
index ac158de4e..b0ea5b016 100644
--- a/res/raw/rollo4.c
+++ b/res/raw/rollo4.c
@@ -82,6 +82,9 @@ void init() {
g_Zoom = 0;
}
+void resetHWWar() {
+}
+
void move() {
if (g_LastTouchDown) {
float dx = -(state->newPositionX - g_LastPositionX);