minor SurfaceFlinger code cleanup and remove unnecessary tests
diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index 7bdf885..8a7abec 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -160,7 +160,7 @@
     
 
     if (mNativeWindow->isUpdateOnDemand()) {
-        mFlags |= UPDATE_ON_DEMAND;
+        mFlags |= PARTIAL_UPDATES;
     }
     
     if (eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT, &dummy) == EGL_TRUE) {
@@ -174,9 +174,9 @@
 
     surface = eglCreateWindowSurface(display, config, mNativeWindow.get(), NULL);
 
-    if (mFlags & UPDATE_ON_DEMAND) {
-        // if we have update on demand, we definitely don't need to
-        // preserve the backbuffer, which is usually costly.
+    if (mFlags & PARTIAL_UPDATES) {
+        // if we have partial updates, we definitely don't need to
+        // preserve the backbuffer, which may be costly.
         eglSurfaceAttrib(display, surface,
                 EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
     }
@@ -199,9 +199,9 @@
             mFlags |= SWAP_RECTANGLE;
         }
     }
-    // when we have the choice between UPDATE_ON_DEMAND and SWAP_RECTANGLE
-    // choose UPDATE_ON_DEMAND, which is more efficient
-    if (mFlags & UPDATE_ON_DEMAND)
+    // when we have the choice between PARTIAL_UPDATES and SWAP_RECTANGLE
+    // choose PARTIAL_UPDATES, which should be more efficient
+    if (mFlags & PARTIAL_UPDATES)
         mFlags &= ~SWAP_RECTANGLE;
 #endif
     
@@ -317,7 +317,7 @@
     } 
 #endif
     
-    if (mFlags & UPDATE_ON_DEMAND) {
+    if (mFlags & PARTIAL_UPDATES) {
         mNativeWindow->setUpdateRectangle(dirty.getBounds());
     }
     
diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h
index b7f1cdb..cb688b7 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h
@@ -48,7 +48,7 @@
         NPOT_EXTENSION          = 0x00000100,
         DRAW_TEXTURE_EXTENSION  = 0x00000200,
         BUFFER_PRESERVED        = 0x00010000,
-        UPDATE_ON_DEMAND        = 0x00020000,   // video driver feature
+        PARTIAL_UPDATES         = 0x00020000,   // video driver feature
         SLOW_CONFIG             = 0x00040000,   // software
         SWAP_RECTANGLE          = 0x00080000,
     };
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 67ddcf9..2894bf0 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -223,14 +223,12 @@
             mFrontBufferIndex : 0;
     GLuint textureName = mTextures[index].name;
     if (UNLIKELY(textureName == -1LU)) {
-        //LOGW("Layer %p doesn't have a texture", this);
         // the texture has not been created yet, this Layer has
         // in fact never been drawn into. this happens frequently with
         // SurfaceView.
         clearWithOpenGL(clip);
         return;
     }
-
     drawWithOpenGL(clip, mTextures[index]);
 }
 
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 5a93b2d..a351253 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -363,15 +363,13 @@
 
     Region::const_iterator it = clip.begin();
     Region::const_iterator const end = clip.end();
-    if (it != end) {
-        glEnable(GL_SCISSOR_TEST);
-        glVertexPointer(2, GL_FIXED, 0, mVertices);
-        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); 
-        }
+    glEnable(GL_SCISSOR_TEST);
+    glVertexPointer(2, GL_FIXED, 0, mVertices);
+    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); 
     }
 }
 
@@ -427,71 +425,63 @@
         }
     }
 
+    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");
-        Region::const_iterator it = clip.begin();
-        Region::const_iterator const end = clip.end();
-        if (it != end) {
-            const GLfixed texCoords[4][2] = {
-                    { 0,        0 },
-                    { 0,        0x10000 },
-                    { 0x10000,  0x10000 },
-                    { 0x10000,  0 }
-            };
+        const GLfixed texCoords[4][2] = {
+                { 0,        0 },
+                { 0,        0x10000 },
+                { 0x10000,  0x10000 },
+                { 0x10000,  0 }
+        };
 
-            glMatrixMode(GL_TEXTURE);
-            glLoadIdentity();
-            
-            // the texture's source is rotated
-            if (texture.transform == HAL_TRANSFORM_ROT_90) {
-                // TODO: handle the other orientations
-                glTranslatef(0, 1, 0);
-                glRotatef(-90, 0, 0, 1);
-            }
+        glMatrixMode(GL_TEXTURE);
+        glLoadIdentity();
 
-            if (!(mFlags & (DisplayHardware::NPOT_EXTENSION |
-                            DisplayHardware::DIRECT_TEXTURE))) {
-                // find the smallest power-of-two that will accommodate our surface
-                GLuint tw = 1 << (31 - clz(width));
-                GLuint th = 1 << (31 - clz(height));
-                if (tw < width)  tw <<= 1;
-                if (th < height) th <<= 1;
-                // this divide should be relatively fast because it's
-                // a power-of-two (optimized path in libgcc)
-                GLfloat ws = GLfloat(width) /tw;
-                GLfloat hs = GLfloat(height)/th;
-                glScalef(ws, hs, 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);
+        // the texture's source is rotated
+        if (texture.transform == HAL_TRANSFORM_ROT_90) {
+            // TODO: handle the other orientations
+            glTranslatef(0, 1, 0);
+            glRotatef(-90, 0, 0, 1);
         }
+
+        if (!(mFlags & (DisplayHardware::NPOT_EXTENSION |
+                DisplayHardware::DIRECT_TEXTURE))) {
+            // find the smallest power-of-two that will accommodate our surface
+            GLuint tw = 1 << (31 - clz(width));
+            GLuint th = 1 << (31 - clz(height));
+            if (tw < width)  tw <<= 1;
+            if (th < height) th <<= 1;
+            GLfloat ws = GLfloat(width) /tw;
+            GLfloat hs = GLfloat(height)/th;
+            glScalef(ws, hs, 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 {
-        Region::const_iterator it = clip.begin();
-        Region::const_iterator const end = clip.end();
-        if (it != end) {
-            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);
-            }
+        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);
         }
     }
 }
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index a0b48d4..065425d 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -859,10 +859,10 @@
             // is costly and usually involves copying the whole update back.
         }
     } else {
-        if (flags & DisplayHardware::UPDATE_ON_DEMAND) {
+        if (flags & DisplayHardware::PARTIAL_UPDATES) {
             // We need to redraw the rectangle that will be updated
             // (pushed to the framebuffer).
-            // This is needed because UPDATE_ON_DEMAND only takes one
+            // This is needed because PARTIAL_UPDATES only takes one
             // rectangle instead of a region (see DisplayHardware::flip())
             mDirtyRegion.set(mInvalidRegion.bounds());
         } else {
@@ -920,7 +920,7 @@
 
      if (!((flags & DisplayHardware::SWAP_RECTANGLE) ||
              (flags & DisplayHardware::BUFFER_PRESERVED))) {
-         const Region repaint((flags & DisplayHardware::UPDATE_ON_DEMAND) ?
+         const Region repaint((flags & DisplayHardware::PARTIAL_UPDATES) ?
                  mDirtyRegion.bounds() : hw.bounds());
          composeSurfaces(repaint);
      }