Don't allow ganesh to allocate mip maps for wrapped textures.

We will not allocate new mips on a wrapped texture but we will use mips
if the wrapped texture already has one. If we need mips for a draw this
will trigger a copy to occur.

Also some cleanup up of our InternalSurfaceFlags in general.

Bug: skia:7806
Change-Id: I7aa666478cc91bba6e0644b323825fcc9b49793a
Reviewed-on: https://skia-review.googlesource.com/121348
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 89a6870..3835bfa 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -18,6 +18,7 @@
 #include "GrSemaphore.h"
 #include "GrTexture.h"
 #include "GrTexturePriv.h"
+#include "GrTextureProxyPriv.h"
 
 #include "SkGr.h"
 #include "SkMessageBus.h"
@@ -175,6 +176,16 @@
             },
             desc, fSurfaceOrigin, mipMapped, SkBackingFit::kExact, SkBudgeted::kNo);
 
+    if (!proxy) {
+        return nullptr;
+    }
+
+    // We can't pass the fact that this creates a wrapped texture into createLazyProxy so we need
+    // to manually call setDoesNotSupportMipMaps.
+    if (GrMipMapped::kNo == mipMapped) {
+        proxy->texPriv().setDoesNotSupportMipMaps();
+    }
+
     if (0 == origin.fX && 0 == origin.fY &&
         info.width() == fBackendTexture.width() && info.height() == fBackendTexture.height() &&
         (!willNeedMipMaps || GrMipMapped::kYes == proxy->mipMapped())) {