Moves Image class to its own file in the Renderer's directory.

TRAC #21909

Author: Shannon Woods
Signed-off-by: Daniel Koch

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1362 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/utilities.cpp b/src/libGLESv2/utilities.cpp
index cade2a7..850fbdf 100644
--- a/src/libGLESv2/utilities.cpp
+++ b/src/libGLESv2/utilities.cpp
@@ -297,6 +297,27 @@
     return false;
 }
 
+void MakeValidSize(bool isImage, bool isCompressed, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
+{
+    int upsampleCount = 0;
+
+    if (isCompressed)
+    {
+        // Don't expand the size of full textures that are at least 4x4
+        // already.
+        if (isImage || *requestWidth < 4 || *requestHeight < 4)
+        {
+            while (*requestWidth % 4 != 0 || *requestHeight % 4 != 0)
+            {
+                *requestWidth <<= 1;
+                *requestHeight <<= 1;
+                upsampleCount++;
+            }
+        }
+    }
+    *levelOffset = upsampleCount;
+}
+
 // Returns the size, in bytes, of a single texel in an Image
 int ComputePixelSize(GLint internalformat)
 {