Revert of Factor GrTexture into public GrTexture and private GrTextureImpl. (https://codereview.chromium.org/275903002/)

Reason for revert:
Breaks chrome build.

Original issue's description:
> Factor GrTexture into public GrTexture and private GrTextureImpl.
>
> Committed: http://code.google.com/p/skia/source/detail?r=14680

R=jvanverth@google.com, robertphillips@google.com
TBR=jvanverth@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/278073002

git-svn-id: http://skia.googlecode.com/svn/trunk@14681 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 03ea058..ac31f51 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -15,98 +15,12 @@
 
 class GrResourceKey;
 class GrTextureParams;
-class GrTextureImpl;
 
 class GrTexture : public GrSurface {
+
 public:
-    /**
-     *  Approximate number of bytes used by the texture
-     */
-    virtual size_t gpuMemorySize() const SK_OVERRIDE;
-
-    // GrSurface overrides
-    virtual bool readPixels(int left, int top, int width, int height,
-                            GrPixelConfig config,
-                            void* buffer,
-                            size_t rowBytes = 0,
-                            uint32_t pixelOpsFlags = 0) SK_OVERRIDE;
-
-    virtual void writePixels(int left, int top, int width, int height,
-                             GrPixelConfig config,
-                             const void* buffer,
-                             size_t rowBytes = 0,
-                             uint32_t pixelOpsFlags = 0) SK_OVERRIDE;
-
-    virtual GrTexture* asTexture() SK_OVERRIDE { return this; }
-    virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; }
-    virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return fRenderTarget.get(); }
-    virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return fRenderTarget.get(); }
-
-    /**
-     * Convert from texels to normalized texture coords for POT textures only. Please don't add
-     * new callsites for these functions. They are slated for removal.
-     */
-    SkFixed normalizeFixedX(SkFixed x) const {
-        SkASSERT(GrIsPow2(fDesc.fWidth));
-        return x >> fShiftFixedX;
-    }
-    SkFixed normalizeFixedY(SkFixed y) const {
-        SkASSERT(GrIsPow2(fDesc.fHeight));
-        return y >> fShiftFixedY;
-    }
-
-    /**
-     *  Return the native ID or handle to the texture, depending on the
-     *  platform. e.g. on OpenGL, return the texture ID.
-     */
-    virtual GrBackendObject getTextureHandle() const = 0;
-
-#ifdef SK_DEBUG
-    void validate() const {
-        this->INHERITED::validate();
-
-        this->validateDesc();
-    }
-#endif
-
-    GrTextureImpl* impl() { return reinterpret_cast<GrTextureImpl*>(this); }
-    const GrTextureImpl* impl() const { return reinterpret_cast<const GrTextureImpl*>(this); }
-
-protected:
-    // A texture refs its rt representation but not vice-versa. It is up to
-    // the subclass constructor to initialize this pointer.
-    SkAutoTUnref<GrRenderTarget> fRenderTarget;
-
-    GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
-    : INHERITED(gpu, isWrapped, desc)
-    , fRenderTarget(NULL) {
-        // only make sense if alloc size is pow2
-        fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
-        fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
-    }
-
-    virtual ~GrTexture();
-
-    // GrResource overrides
-    virtual void onRelease() SK_OVERRIDE;
-    virtual void onAbandon() SK_OVERRIDE;
-
-    void validateDesc() const;
-
-private:
-    virtual void internal_dispose() const SK_OVERRIDE;
-
-    // these two shift a fixed-point value into normalized coordinates
-    // for this texture if the texture is power of two sized.
-    int                 fShiftFixedX;
-    int                 fShiftFixedY;
-
-    typedef GrSurface INHERITED;
-};
-
-class GrTextureImpl : public GrTexture {
-public:
-    SK_DECLARE_INST_COUNT(GrTextureImpl)
+    SK_DECLARE_INST_COUNT(GrTexture)
+    // from GrResource
     /**
      * Informational texture flags
      */
@@ -136,9 +50,63 @@
         return kValid_MipMapsStatus != fMipMapsStatus;
     }
 
-    bool hasMipMaps() const {
-        return kNotAllocated_MipMapsStatus != fMipMapsStatus;
+    /**
+     *  Approximate number of bytes used by the texture
+     */
+    virtual size_t gpuMemorySize() const SK_OVERRIDE;
+
+    // GrSurface overrides
+    virtual bool readPixels(int left, int top, int width, int height,
+                            GrPixelConfig config,
+                            void* buffer,
+                            size_t rowBytes = 0,
+                            uint32_t pixelOpsFlags = 0) SK_OVERRIDE;
+
+    virtual void writePixels(int left, int top, int width, int height,
+                             GrPixelConfig config,
+                             const void* buffer,
+                             size_t rowBytes = 0,
+                             uint32_t pixelOpsFlags = 0) SK_OVERRIDE;
+
+    /**
+     * @return this texture
+     */
+    virtual GrTexture* asTexture() SK_OVERRIDE { return this; }
+    virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; }
+
+    /**
+     * Retrieves the render target underlying this texture that can be passed to
+     * GrGpu::setRenderTarget().
+     *
+     * @return    handle to render target or NULL if the texture is not a
+     *            render target
+     */
+    virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE {
+        return fRenderTarget.get();
     }
+    virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE {
+        return fRenderTarget.get();
+    }
+
+    // GrTexture
+    /**
+     * Convert from texels to normalized texture coords for POT textures
+     * only.
+     */
+    SkFixed normalizeFixedX(SkFixed x) const {
+        SkASSERT(GrIsPow2(fDesc.fWidth));
+        return x >> fShiftFixedX;
+    }
+    SkFixed normalizeFixedY(SkFixed y) const {
+        SkASSERT(GrIsPow2(fDesc.fHeight));
+        return y >> fShiftFixedY;
+    }
+
+    /**
+     *  Return the native ID or handle to the texture, depending on the
+     *  platform. e.g. on OpenGL, return the texture ID.
+     */
+    virtual GrBackendObject getTextureHandle() const = 0;
 
     /**
      *  Call this when the state of the native API texture object is
@@ -146,6 +114,14 @@
      */
     virtual void invalidateCachedState() = 0;
 
+#ifdef SK_DEBUG
+    void validate() const {
+        this->INHERITED::validate();
+
+        this->validateDesc();
+    }
+#endif
+
     static GrResourceKey ComputeKey(const GrGpu* gpu,
                                     const GrTextureParams* params,
                                     const GrTextureDesc& desc,
@@ -155,10 +131,26 @@
     static bool NeedsBilerp(const GrResourceKey& key);
 
 protected:
-    GrTextureImpl(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
+    // A texture refs its rt representation but not vice-versa. It is up to
+    // the subclass constructor to initialize this pointer.
+    SkAutoTUnref<GrRenderTarget> fRenderTarget;
+
+    GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
     : INHERITED(gpu, isWrapped, desc)
+    , fRenderTarget(NULL)
     , fMipMapsStatus(kNotAllocated_MipMapsStatus) {
+
+        // only make sense if alloc size is pow2
+        fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
+        fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
     }
+    virtual ~GrTexture();
+
+    // GrResource overrides
+    virtual void onRelease() SK_OVERRIDE;
+    virtual void onAbandon() SK_OVERRIDE;
+
+    void validateDesc() const;
 
 private:
     enum MipMapsStatus {
@@ -167,9 +159,16 @@
         kValid_MipMapsStatus
     };
 
+    // these two shift a fixed-point value into normalized coordinates
+    // for this texture if the texture is power of two sized.
+    int                 fShiftFixedX;
+    int                 fShiftFixedY;
+
     MipMapsStatus       fMipMapsStatus;
 
-    typedef GrTexture INHERITED;
+    virtual void internal_dispose() const SK_OVERRIDE;
+
+    typedef GrSurface INHERITED;
 };
 
 /**
@@ -205,7 +204,6 @@
         fTexture.reset(SkSafeRef(texture));
         return texture;
     }
-
 private:
     SkAutoTUnref<GrTexture> fTexture;
     SkIPoint                fOffset;