Skia: Track the fIsWrapped separately so that we delete correctly

GrGlTextureRenderTarget inherits virtually from both GrGlRenderTarget and
GrGLTexture, which both have a 'wrap' flag.  The passed in wrap setting could
be different for the two base classes, but since it's virtually inherited,
they share the same flag, so they're either both on, or both off.

As a result, we fail to delete the frambuffer.

To fix this, we now keep a separate isWrapped flag for GrGlRenderTarget.

BUG=437998

Review URL: https://codereview.chromium.org/791493003
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 8482ecd..2d6c19c 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -31,6 +31,7 @@
     fRTFBOID                = idDesc.fRTFBOID;
     fTexFBOID               = idDesc.fTexFBOID;
     fMSColorRenderbufferID  = idDesc.fMSColorRenderbufferID;
+    fIsWrapped              = idDesc.fIsWrapped;
 
     fViewport.fLeft   = 0;
     fViewport.fBottom = 0;
@@ -54,7 +55,7 @@
 }
 
 void GrGLRenderTarget::onRelease() {
-    if (!this->isWrapped()) {
+    if (!fIsWrapped) {
         if (fTexFBOID) {
             GL_CALL(DeleteFramebuffers(1, &fTexFBOID));
         }
@@ -68,6 +69,7 @@
     fRTFBOID                = 0;
     fTexFBOID               = 0;
     fMSColorRenderbufferID  = 0;
+    fIsWrapped              = false;
     INHERITED::onRelease();
 }
 
@@ -75,5 +77,6 @@
     fRTFBOID                = 0;
     fTexFBOID               = 0;
     fMSColorRenderbufferID  = 0;
+    fIsWrapped              = false;
     INHERITED::onAbandon();
 }
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index 0f04160..50e3b5a 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -77,6 +77,10 @@
     GrGLuint      fTexFBOID;
     GrGLuint      fMSColorRenderbufferID;
 
+    // We track this separately from GrGpuResource because this may be both a texture and a render
+    // target, and the texture may be wrapped while the render target is not.
+    bool fIsWrapped;
+
     // when we switch to this render target we want to set the viewport to
     // only render to content area (as opposed to the whole allocation) and
     // we want the rendering to be at top left (GL has origin in bottom left)
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 8777d1b..ce892dd 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -30,20 +30,23 @@
     fTexParams.invalidate();
     fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
     fTextureID = idDesc.fTextureID;
+    fIsWrapped = idDesc.fIsWrapped;
 }
 
 void GrGLTexture::onRelease() {
     if (fTextureID) {
-        if (!this->isWrapped()) {
+        if (!fIsWrapped) {
             GL_CALL(DeleteTextures(1, &fTextureID));
         }
         fTextureID = 0;
+        fIsWrapped = false;
     }
     INHERITED::onRelease();
 }
 
 void GrGLTexture::onAbandon() {
     fTextureID = 0;
+    fIsWrapped = false;
     INHERITED::onAbandon();
 }
 
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index f23adae..c3c396e 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -70,6 +70,10 @@
     GrGpu::ResetTimestamp           fTexParamsTimestamp;
     GrGLuint                        fTextureID;
 
+    // We track this separately from GrGpuResource because this may be both a texture and a render
+    // target, and the texture may be wrapped while the render target is not.
+    bool fIsWrapped;
+
     typedef GrTexture INHERITED;
 };