cleanup GrGLTexture / GrGLRenderTarget cons. Make GrRenderTarget aware of its msaa sample count.

Review URL: http://codereview.appspot.com/4833045/



git-svn-id: http://skia.googlecode.com/svn/trunk@1996 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGLTexture.cpp b/gpu/src/GrGLTexture.cpp
index e7db2ee..caf001a 100644
--- a/gpu/src/GrGLTexture.cpp
+++ b/gpu/src/GrGLTexture.cpp
@@ -33,14 +33,12 @@
     }
 };
 
-GrGLTexture::GrGLTexture(GrGpuGL* gpu,
-                         const GLTextureDesc& textureDesc,
-                         const GLRenderTargetIDs& rtIDs,
-                         const TexParams& initialTexParams)
-    : INHERITED(gpu,
-                textureDesc.fContentWidth,
-                textureDesc.fContentHeight,
-                textureDesc.fFormat) {
+void GrGLTexture::init(GrGpuGL* gpu,
+                       const Desc& textureDesc,
+                       const GrGLRenderTarget::Desc* rtDesc,
+                       const TexParams& initialTexParams) {
+
+    GrAssert(0 != textureDesc.fTextureID);
 
     fTexParams          = initialTexParams;
     fTexIDObj           = new GrGLTexID(textureDesc.fTextureID,
@@ -56,9 +54,7 @@
     fScaleY             = GrIntToScalar(textureDesc.fContentHeight) /
                             textureDesc.fAllocHeight;
 
-    GrAssert(0 != textureDesc.fTextureID);
-
-    if (rtIDs.fTexFBOID) {
+    if (NULL != rtDesc) {
         // we render to the top left
         GrGLIRect vp;
         vp.fLeft   = 0;
@@ -66,14 +62,31 @@
         vp.fHeight = textureDesc.fContentHeight;
         vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight;
 
-        fRenderTarget = new GrGLRenderTarget(gpu, rtIDs, fTexIDObj,
-                                             textureDesc.fFormat,
-                                             textureDesc.fStencilBits,
-                                             rtIDs.fRTFBOID != rtIDs.fTexFBOID,
-                                             vp, this);
+        fRenderTarget = new GrGLRenderTarget(gpu, *rtDesc, vp, fTexIDObj, this);
     }
 }
 
+GrGLTexture::GrGLTexture(GrGpuGL* gpu,
+                         const Desc& textureDesc,
+                         const TexParams& initialTexParams) 
+    : INHERITED(gpu,
+                textureDesc.fContentWidth,
+                textureDesc.fContentHeight,
+                textureDesc.fFormat) {
+    this->init(gpu, textureDesc, NULL, initialTexParams);
+}
+
+GrGLTexture::GrGLTexture(GrGpuGL* gpu,
+                         const Desc& textureDesc,
+                         const GrGLRenderTarget::Desc& rtDesc,
+                         const TexParams& initialTexParams)
+    : INHERITED(gpu,
+                textureDesc.fContentWidth,
+                textureDesc.fContentHeight,
+                textureDesc.fFormat) {
+    this->init(gpu, textureDesc, &rtDesc, initialTexParams);
+}
+
 void GrGLTexture::onRelease() {
     INHERITED::onRelease();
     GPUGL->notifyTextureDelete(this);