Enforce maximum texture size.

When an app tries to render a bitmap or path larger than the GPU's maximum
texture size, the drawing command is ignored and a warning is logged. This
change also makes texture drawing more robust by catching potential errors
during texture creation.

This change also fixes a crash in the FontRenderer. The destructor would
sometimes try to free an uninitialized array.

Change-Id: I95ae0939c52192d97b340aa02417bf6d0c962c57
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index dbea114..8d00e85 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -292,6 +292,9 @@
     mCurrentQuadIndex = 0;
     mTextureId = 0;
 
+    mTextMeshPtr = NULL;
+    mTextTexture = NULL;
+
     mIndexBufferID = 0;
 
     mCacheWidth = DEFAULT_TEXT_CACHE_WIDTH;
@@ -319,10 +322,12 @@
     }
     mCacheLines.clear();
 
-    delete[] mTextMeshPtr;
-    delete[] mTextTexture;
+    if (mInitialized) {
+        delete[] mTextMeshPtr;
+        delete[] mTextTexture;
+    }
 
-    if(mTextureId) {
+    if (mTextureId) {
         glDeleteTextures(1, &mTextureId);
     }