Fix regression with hardware layers.

The renderer was checking whether the layer's region is a rect to
draw it with a simple quad. This test was done against the layer's
region structure, which was cleared after generating the mesh.
Unfortunately Region::isRect() returns true when the region is
empty, which was causing the renderer to always use a quad to
draw a mesh on screen.

Change-Id: If4b874579ee0cedcb67367c9efa5c0c98ca55231
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index a167429..1c89577 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -29,6 +29,10 @@
 void LayerRenderer::prepare(bool opaque) {
     LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->fbo);
 
+#if RENDER_LAYERS_AS_REGIONS
+    mLayer->region.clear();
+#endif
+
     glBindFramebuffer(GL_FRAMEBUFFER, mLayer->fbo);
 
     OpenGLRenderer::prepare(opaque);
@@ -79,7 +83,6 @@
             mLayer->meshIndices = NULL;
             mLayer->meshElementCount = 0;
         }
-        mLayer->region.clear();
         return;
     }
 
@@ -131,8 +134,6 @@
         indices[index + 4] = quad + 1;   // top-right
         indices[index + 5] = quad + 3;   // bottom-right
     }
-
-    mLayer->region.clear();
 #endif
 }