clean-up surfaceflinger a bit

get rid of the glDrawTexi path and use floating points instead of fixed point maths

Change-Id: I3aa9ce2dc082f702160e605a16ba5fe987cdf087
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index efbc77a..6dc8f10 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -374,7 +374,7 @@
     Region::const_iterator it = clip.begin();
     Region::const_iterator const end = clip.end();
     glEnable(GL_SCISSOR_TEST);
-    glVertexPointer(2, GL_FIXED, 0, mVertices);
+    glVertexPointer(2, GL_FLOAT, 0, mVertices);
     while (it != end) {
         const Rect& r = *it++;
         const GLint sy = fbHeight - (r.top + r.height());
@@ -418,14 +418,14 @@
             env = GL_REPLACE;
             src = GL_SRC_ALPHA;
         }
-        const GGLfixed alpha = (s.alpha << 16)/255;
-        glColor4x(alpha, alpha, alpha, alpha);
+        const GLfloat alpha = s.alpha * (1.0f/255.0f);
+        glColor4f(alpha, alpha, alpha, alpha);
         glEnable(GL_BLEND);
         glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA);
         glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env);
     } else {
         glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-        glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
+        glColor4f(1, 1, 1, 1);
         if (needsBlending()) {
             GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA;
             glEnable(GL_BLEND);
@@ -437,64 +437,47 @@
 
     Region::const_iterator it = clip.begin();
     Region::const_iterator const end = clip.end();
-    if (UNLIKELY(transformed()
-            || !(mFlags & DisplayHardware::DRAW_TEXTURE_EXTENSION) )) 
-    {
-        //StopWatch watch("GL transformed");
-        const GLfixed texCoords[4][2] = {
-                { 0,        0 },
-                { 0,        0x10000 },
-                { 0x10000,  0x10000 },
-                { 0x10000,  0 }
-        };
+    const GLfloat texCoords[4][2] = {
+            { 0,  0 },
+            { 0,  1 },
+            { 1,  1 },
+            { 1,  0 }
+    };
 
-        glMatrixMode(GL_TEXTURE);
-        glLoadIdentity();
+    glMatrixMode(GL_TEXTURE);
+    glLoadIdentity();
 
-        // the texture's source is rotated
-        switch (texture.transform) {
-            case HAL_TRANSFORM_ROT_90:
-                glTranslatef(0, 1, 0);
-                glRotatef(-90, 0, 0, 1);
-                break;
-            case HAL_TRANSFORM_ROT_180:
-                glTranslatef(1, 1, 0);
-                glRotatef(-180, 0, 0, 1);
-                break;
-            case HAL_TRANSFORM_ROT_270:
-                glTranslatef(1, 0, 0);
-                glRotatef(-270, 0, 0, 1);
-                break;
-        }
-
-        if (texture.NPOTAdjust) {
-            glScalef(texture.wScale, texture.hScale, 1.0f);
-        }
-
-        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-        glVertexPointer(2, GL_FIXED, 0, mVertices);
-        glTexCoordPointer(2, GL_FIXED, 0, texCoords);
-
-        while (it != end) {
-            const Rect& r = *it++;
-            const GLint sy = fbHeight - (r.top + r.height());
-            glScissor(r.left, sy, r.width(), r.height());
-            glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 
-        }
-        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-    } else {
-        GLint crop[4] = { 0, height, width, -height };
-        glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
-        int x = tx();
-        int y = ty();
-        y = fbHeight - (y + height);
-        while (it != end) {
-            const Rect& r = *it++;
-            const GLint sy = fbHeight - (r.top + r.height());
-            glScissor(r.left, sy, r.width(), r.height());
-            glDrawTexiOES(x, y, 0, width, height);
-        }
+    // the texture's source is rotated
+    switch (texture.transform) {
+        case HAL_TRANSFORM_ROT_90:
+            glTranslatef(0, 1, 0);
+            glRotatef(-90, 0, 0, 1);
+            break;
+        case HAL_TRANSFORM_ROT_180:
+            glTranslatef(1, 1, 0);
+            glRotatef(-180, 0, 0, 1);
+            break;
+        case HAL_TRANSFORM_ROT_270:
+            glTranslatef(1, 0, 0);
+            glRotatef(-270, 0, 0, 1);
+            break;
     }
+
+    if (texture.NPOTAdjust) {
+        glScalef(texture.wScale, texture.hScale, 1.0f);
+    }
+
+    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+    glVertexPointer(2, GL_FLOAT, 0, mVertices);
+    glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+
+    while (it != end) {
+        const Rect& r = *it++;
+        const GLint sy = fbHeight - (r.top + r.height());
+        glScissor(r.left, sy, r.width(), r.height());
+        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+    }
+    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 }
 
 void LayerBase::validateTexture(GLint textureName) const