Merge the Image class into ImageD3D.

BUG=angle:681

Change-Id: I0c0d41fb3ff9592b08ede58a8c2ec2bd2d94a0b2
Reviewed-on: https://chromium-review.googlesource.com/238470
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
index a59cf68..359e1ef 100644
--- a/src/libANGLE/Texture.cpp
+++ b/src/libANGLE/Texture.cpp
@@ -7,12 +7,8 @@
 // Texture.cpp: Implements the gl::Texture class. [OpenGL ES 2.0.24] section 3.7 page 63.
 
 #include "libANGLE/Texture.h"
-#include "libANGLE/Context.h"
+#include "libANGLE/Data.h"
 #include "libANGLE/formatutils.h"
-#include "libANGLE/ImageIndex.h"
-#include "libANGLE/Renderbuffer.h"
-#include "libANGLE/renderer/Image.h"
-#include "libANGLE/renderer/d3d/TextureStorage.h"
 
 #include "libANGLE/Surface.h"
 
diff --git a/src/libANGLE/renderer/Image.cpp b/src/libANGLE/renderer/Image.cpp
deleted file mode 100644
index 901d070..0000000
--- a/src/libANGLE/renderer/Image.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Image.h: Implements the rx::Image class, an abstract base class for the
-// renderer-specific classes which will define the interface to the underlying
-// surfaces or resources.
-
-#include "libANGLE/renderer/Image.h"
-
-namespace rx
-{
-
-Image::Image()
-{
-    mWidth = 0;
-    mHeight = 0;
-    mDepth = 0;
-    mInternalFormat = GL_NONE;
-    mTarget = GL_NONE;
-    mRenderable = false;
-    mDirty = false;
-}
-
-}
diff --git a/src/libANGLE/renderer/d3d/ImageD3D.cpp b/src/libANGLE/renderer/d3d/ImageD3D.cpp
index 8868d8a..45367ce 100644
--- a/src/libANGLE/renderer/d3d/ImageD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ImageD3D.cpp
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -18,15 +18,16 @@
 {
 
 ImageD3D::ImageD3D()
+    : mWidth(0),
+      mHeight(0),
+      mDepth(0),
+      mInternalFormat(GL_NONE),
+      mTarget(GL_NONE),
+      mRenderable(false),
+      mDirty(false)
 {
 }
 
-ImageD3D *ImageD3D::makeImageD3D(Image *img)
-{
-    ASSERT(HAS_DYNAMIC_TYPE(ImageD3D*, img));
-    return static_cast<ImageD3D*>(img);
-}
-
 gl::Error ImageD3D::copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source)
 {
     gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
diff --git a/src/libANGLE/renderer/d3d/ImageD3D.h b/src/libANGLE/renderer/d3d/ImageD3D.h
index 8fbaa9d..9606787 100644
--- a/src/libANGLE/renderer/d3d/ImageD3D.h
+++ b/src/libANGLE/renderer/d3d/ImageD3D.h
@@ -1,10 +1,10 @@
 //
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
-// Image.h: Defines the rx::Image class, an abstract base class for the
+// ImageD3D.h: Defines the rx::ImageD3D class, an abstract base class for the
 // renderer-specific classes which will define the interface to the underlying
 // surfaces or resources.
 
@@ -12,36 +12,67 @@
 #define LIBANGLE_RENDERER_D3D_IMAGED3D_H_
 
 #include "common/debug.h"
-#include "libANGLE/renderer/Image.h"
+
+#include "libANGLE/Error.h"
 
 namespace gl
 {
 class Framebuffer;
 struct ImageIndex;
 struct Box;
+struct Extents;
+struct Offset;
+struct Rectangle;
 }
 
 namespace rx
 {
 class TextureStorage;
+class RendererD3D;
+class RenderTarget;
 
-class ImageD3D : public Image
+class ImageD3D
 {
   public:
     ImageD3D();
     virtual ~ImageD3D() {};
 
-    static ImageD3D *makeImageD3D(Image *img);
+    GLsizei getWidth() const { return mWidth; }
+    GLsizei getHeight() const { return mHeight; }
+    GLsizei getDepth() const { return mDepth; }
+    GLenum getInternalFormat() const { return mInternalFormat; }
+    GLenum getTarget() const { return mTarget; }
+    bool isRenderableFormat() const { return mRenderable; }
 
+    void markDirty() { mDirty = true; }
+    void markClean() { mDirty = false; }
     virtual bool isDirty() const = 0;
 
+    virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0;
+
+    virtual gl::Error loadData(const gl::Box &area, GLint unpackAlignment, GLenum type, const void *input) = 0;
+    virtual gl::Error loadCompressedData(const gl::Box &area, const void *input) = 0;
+
     virtual gl::Error setManagedSurface2D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); };
     virtual gl::Error setManagedSurfaceCube(TextureStorage *storage, int face, int level) { return gl::Error(GL_NO_ERROR); };
     virtual gl::Error setManagedSurface3D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); };
     virtual gl::Error setManagedSurface2DArray(TextureStorage *storage, int layer, int level) { return gl::Error(GL_NO_ERROR); };
     virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region) = 0;
 
-    gl::Error copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source) override;
+    virtual gl::Error copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
+                           const gl::ImageIndex &sourceIndex, TextureStorage *source) = 0;
+
+    gl::Error copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source);
+
+  protected:
+    GLsizei mWidth;
+    GLsizei mHeight;
+    GLsizei mDepth;
+    GLenum mInternalFormat;
+    bool mRenderable;
+    GLenum mTarget;
+
+    bool mDirty;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(ImageD3D);
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.h b/src/libANGLE/renderer/d3d/RendererD3D.h
index d3d1d9d..acb72a3 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.h
+++ b/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -26,7 +26,7 @@
 
 namespace rx
 {
-class Image;
+class ImageD3D;
 class IndexBuffer;
 class RenderTarget;
 class ShaderExecutable;
@@ -130,8 +130,8 @@
     virtual UniformStorage *createUniformStorage(size_t storageSize) = 0;
 
     // Image operations
-    virtual Image *createImage() = 0;
-    virtual gl::Error generateMipmap(Image *dest, Image *source) = 0;
+    virtual ImageD3D *createImage() = 0;
+    virtual gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) = 0;
     virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain) = 0;
     virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly) = 0;
     virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels) = 0;
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp
index 09d4c84..1920140 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -99,19 +99,19 @@
 
 GLint TextureD3D::getBaseLevelWidth() const
 {
-    const Image *baseImage = getBaseLevelImage();
+    const ImageD3D *baseImage = getBaseLevelImage();
     return (baseImage ? baseImage->getWidth() : 0);
 }
 
 GLint TextureD3D::getBaseLevelHeight() const
 {
-    const Image *baseImage = getBaseLevelImage();
+    const ImageD3D *baseImage = getBaseLevelImage();
     return (baseImage ? baseImage->getHeight() : 0);
 }
 
 GLint TextureD3D::getBaseLevelDepth() const
 {
-    const Image *baseImage = getBaseLevelImage();
+    const ImageD3D *baseImage = getBaseLevelImage();
     return (baseImage ? baseImage->getDepth() : 0);
 }
 
@@ -120,11 +120,11 @@
 // the base level image for anything except querying texture format and size.
 GLenum TextureD3D::getBaseLevelInternalFormat() const
 {
-    const Image *baseImage = getBaseLevelImage();
+    const ImageD3D *baseImage = getBaseLevelImage();
     return (baseImage ? baseImage->getInternalFormat() : GL_NONE);
 }
 
-bool TextureD3D::shouldUseSetData(const Image *image) const
+bool TextureD3D::shouldUseSetData(const ImageD3D *image) const
 {
     if (!mRenderer->getWorkarounds().setDataFasterThanImageUpload)
     {
@@ -146,7 +146,7 @@
 
 gl::Error TextureD3D::setImage(const gl::ImageIndex &index, GLenum type, const gl::PixelUnpackState &unpack, const uint8_t *pixels)
 {
-    Image *image = getImage(index);
+    ImageD3D *image = getImage(index);
     ASSERT(image);
 
     // No-op
@@ -202,7 +202,7 @@
 
     if (pixelData != NULL)
     {
-        Image *image = getImage(index);
+        ImageD3D *image = getImage(index);
         ASSERT(image);
 
         if (shouldUseSetData(image))
@@ -241,7 +241,7 @@
 
     if (pixelData != NULL)
     {
-        Image *image = getImage(index);
+        ImageD3D *image = getImage(index);
         ASSERT(image);
 
         gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
@@ -269,7 +269,7 @@
 
     if (pixelData != NULL)
     {
-        Image *image = getImage(index);
+        ImageD3D *image = getImage(index);
         ASSERT(image);
 
         gl::Error error = image->loadCompressedData(area, pixelData);
@@ -338,7 +338,7 @@
     return mTexStorage;
 }
 
-Image *TextureD3D::getBaseLevelImage() const
+ImageD3D *TextureD3D::getBaseLevelImage() const
 {
     return getImage(getImageIndex(0, 0));
 }
@@ -380,7 +380,7 @@
             {
                 gl::ImageIndex srcIndex = getImageIndex(0, layer);
 
-                Image *image = getImage(srcIndex);
+                ImageD3D *image = getImage(srcIndex);
                 gl::Rectangle area(0, 0, image->getWidth(), image->getHeight());
                 gl::Offset offset(0, 0, 0);
                 gl::Error error = image->copy(offset, area, srcIndex, mTexStorage);
@@ -442,7 +442,7 @@
 
 bool TextureD3D::isBaseImageZeroSize() const
 {
-    Image *baseImage = getBaseLevelImage();
+    ImageD3D *baseImage = getBaseLevelImage();
 
     if (!baseImage || baseImage->getWidth() <= 0)
     {
@@ -508,7 +508,7 @@
 
 bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const
 {
-    Image *image = getImage(index);
+    ImageD3D *image = getImage(index);
     bool levelsComplete = (isImageComplete(index) && isImageComplete(getImageIndex(0, 0)));
     return (image->isRenderableFormat() && levelsComplete);
 }
@@ -518,9 +518,8 @@
     if (mTexStorage)
     {
         ASSERT(isValidIndex(index));
-        Image *image = getImage(index);
-        ImageD3D *imageD3D = ImageD3D::makeImageD3D(image);
-        gl::Error error = imageD3D->copyToStorage(mTexStorage, index, region);
+        ImageD3D *image = getImage(index);
+        gl::Error error = image->copyToStorage(mTexStorage, index, region);
         if (error.isError())
         {
             return error;
@@ -537,7 +536,7 @@
 {
     for (int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
     {
-        mImageArray[i] = ImageD3D::makeImageD3D(renderer->createImage());
+        mImageArray[i] = renderer->createImage();
     }
 }
 
@@ -554,14 +553,14 @@
     SafeDelete(mTexStorage);
 }
 
-Image *TextureD3D_2D::getImage(int level, int layer) const
+ImageD3D *TextureD3D_2D::getImage(int level, int layer) const
 {
     ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(layer == 0);
     return mImageArray[level];
 }
 
-Image *TextureD3D_2D::getImage(const gl::ImageIndex &index) const
+ImageD3D *TextureD3D_2D::getImage(const gl::ImageIndex &index) const
 {
     ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(!index.hasLayer());
@@ -929,7 +928,7 @@
         return true;
     }
 
-    const Image *baseImage = getBaseLevelImage();
+    const ImageD3D *baseImage = getBaseLevelImage();
 
     GLsizei width = baseImage->getWidth();
     GLsizei height = baseImage->getHeight();
@@ -1160,7 +1159,7 @@
     {
         for (int j = 0; j < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
         {
-            mImageArray[i][j] = ImageD3D::makeImageD3D(renderer->createImage());
+            mImageArray[i][j] = renderer->createImage();
         }
     }
 }
@@ -1181,14 +1180,14 @@
     SafeDelete(mTexStorage);
 }
 
-Image *TextureD3D_Cube::getImage(int level, int layer) const
+ImageD3D *TextureD3D_Cube::getImage(int level, int layer) const
 {
     ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(layer >= 0 && layer < 6);
     return mImageArray[layer][level];
 }
 
-Image *TextureD3D_Cube::getImage(const gl::ImageIndex &index) const
+ImageD3D *TextureD3D_Cube::getImage(const gl::ImageIndex &index) const
 {
     ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(index.layerIndex >= 0 && index.layerIndex < 6);
@@ -1702,7 +1701,7 @@
 {
     for (int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
     {
-        mImageArray[i] = ImageD3D::makeImageD3D(renderer->createImage());
+        mImageArray[i] = renderer->createImage();
     }
 }
 
@@ -1719,14 +1718,14 @@
     SafeDelete(mTexStorage);
 }
 
-Image *TextureD3D_3D::getImage(int level, int layer) const
+ImageD3D *TextureD3D_3D::getImage(int level, int layer) const
 {
     ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(layer == 0);
     return mImageArray[level];
 }
 
-Image *TextureD3D_3D::getImage(const gl::ImageIndex &index) const
+ImageD3D *TextureD3D_3D::getImage(const gl::ImageIndex &index) const
 {
     ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT(!index.hasLayer());
@@ -2272,7 +2271,7 @@
     SafeDelete(mTexStorage);
 }
 
-Image *TextureD3D_2DArray::getImage(int level, int layer) const
+ImageD3D *TextureD3D_2DArray::getImage(int level, int layer) const
 {
     ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT((layer == 0 && mLayerCounts[level] == 0) ||
@@ -2280,7 +2279,7 @@
     return (mImageArray[level] ? mImageArray[level][layer] : NULL);
 }
 
-Image *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const
+ImageD3D *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const
 {
     ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
     ASSERT((index.layerIndex == 0 && mLayerCounts[index.mipIndex] == 0) ||
@@ -2498,7 +2497,7 @@
 
             for (int layer = 0; layer < mLayerCounts[level]; layer++)
             {
-                mImageArray[level][layer] = ImageD3D::makeImageD3D(mRenderer->createImage());
+                mImageArray[level][layer] = mRenderer->createImage();
                 mImageArray[level][layer]->redefine(GL_TEXTURE_2D_ARRAY, internalFormat, levelLayerSize, true);
             }
         }
@@ -2778,7 +2777,7 @@
 
         for (int layer = 0; layer < mLayerCounts[level]; layer++)
         {
-            mImageArray[level][layer] = ImageD3D::makeImageD3D(mRenderer->createImage());
+            mImageArray[level][layer] = mRenderer->createImage();
             mImageArray[level][layer]->redefine(GL_TEXTURE_2D_ARRAY, internalformat,
                                                 gl::Extents(size.width, size.height, 1), false);
         }
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.h b/src/libANGLE/renderer/d3d/TextureD3D.h
index be99422..5923a3b 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.h
+++ b/src/libANGLE/renderer/d3d/TextureD3D.h
@@ -21,7 +21,7 @@
 namespace rx
 {
 
-class Image;
+class ImageD3D;
 class ImageD3D;
 class RendererD3D;
 class RenderTarget;
@@ -41,7 +41,7 @@
     bool hasDirtyImages() const { return mDirtyImages; }
     void resetDirty() { mDirtyImages = false; }
 
-    virtual Image *getImage(const gl::ImageIndex &index) const = 0;
+    virtual ImageD3D *getImage(const gl::ImageIndex &index) const = 0;
     virtual GLsizei getLayerCount(int level) const = 0;
 
     GLint getBaseLevelWidth() const;
@@ -64,7 +64,7 @@
 
     virtual gl::Error generateMipmaps();
     TextureStorage *getStorage();
-    Image *getBaseLevelImage() const;
+    ImageD3D *getBaseLevelImage() const;
 
   protected:
     gl::Error setImage(const gl::ImageIndex &index, GLenum type, const gl::PixelUnpackState &unpack, const uint8_t *pixels);
@@ -106,7 +106,7 @@
 
     virtual gl::Error updateStorage() = 0;
 
-    bool shouldUseSetData(const Image *image) const;
+    bool shouldUseSetData(const ImageD3D *image) const;
 };
 
 class TextureD3D_2D : public TextureD3D
@@ -115,8 +115,8 @@
     TextureD3D_2D(RendererD3D *renderer);
     virtual ~TextureD3D_2D();
 
-    virtual Image *getImage(int level, int layer) const;
-    virtual Image *getImage(const gl::ImageIndex &index) const;
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &index) const;
     virtual GLsizei getLayerCount(int level) const;
 
     GLsizei getWidth(GLint level) const;
@@ -178,8 +178,8 @@
     TextureD3D_Cube(RendererD3D *renderer);
     virtual ~TextureD3D_Cube();
 
-    virtual Image *getImage(int level, int layer) const;
-    virtual Image *getImage(const gl::ImageIndex &index) const;
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &index) const;
     virtual GLsizei getLayerCount(int level) const;
 
     virtual bool hasDirtyImages() const { return mDirtyImages; }
@@ -243,8 +243,8 @@
     TextureD3D_3D(RendererD3D *renderer);
     virtual ~TextureD3D_3D();
 
-    virtual Image *getImage(int level, int layer) const;
-    virtual Image *getImage(const gl::ImageIndex &index) const;
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &index) const;
     virtual GLsizei getLayerCount(int level) const;
 
     GLsizei getWidth(GLint level) const;
@@ -306,8 +306,8 @@
     TextureD3D_2DArray(RendererD3D *renderer);
     virtual ~TextureD3D_2DArray();
 
-    virtual Image *getImage(int level, int layer) const;
-    virtual Image *getImage(const gl::ImageIndex &index) const;
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &index) const;
     virtual GLsizei getLayerCount(int level) const;
 
     GLsizei getWidth(GLint level) const;
diff --git a/src/libANGLE/renderer/d3d/TextureStorage.h b/src/libANGLE/renderer/d3d/TextureStorage.h
index a4006e2..ea3c2ec 100644
--- a/src/libANGLE/renderer/d3d/TextureStorage.h
+++ b/src/libANGLE/renderer/d3d/TextureStorage.h
@@ -28,7 +28,7 @@
 {
 class SwapChain;
 class RenderTarget;
-class Image;
+class ImageD3D;
 
 class TextureStorage
 {
@@ -45,7 +45,7 @@
     virtual gl::Error generateMipmap(const gl::ImageIndex &sourceIndex, const gl::ImageIndex &destIndex) = 0;
 
     virtual gl::Error copyToStorage(TextureStorage *destStorage) = 0;
-    virtual gl::Error setData(const gl::ImageIndex &index, Image *image, const gl::Box *destBox, GLenum type,
+    virtual gl::Error setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
                               const gl::PixelUnpackState &unpack, const uint8_t *pixelData) = 0;
 
     unsigned int getRenderTargetSerial(const gl::ImageIndex &index) const;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
index ccbd2ef..5f7acb7 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
@@ -42,7 +42,7 @@
     releaseStagingTexture();
 }
 
-Image11 *Image11::makeImage11(Image *img)
+Image11 *Image11::makeImage11(ImageD3D *img)
 {
     ASSERT(HAS_DYNAMIC_TYPE(Image11*, img));
     return static_cast<Image11*>(img);
diff --git a/src/libANGLE/renderer/d3d/d3d11/Image11.h b/src/libANGLE/renderer/d3d/d3d11/Image11.h
index cc8a5c2..2347b51 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Image11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Image11.h
@@ -31,7 +31,7 @@
     Image11(Renderer11 *renderer);
     virtual ~Image11();
 
-    static Image11 *makeImage11(Image *img);
+    static Image11 *makeImage11(ImageD3D *img);
 
     static gl::Error generateMipmap(Image11 *dest, Image11 *src);
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 6f216b0..94817af 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2767,12 +2767,12 @@
     return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
 }
 
-Image *Renderer11::createImage()
+ImageD3D *Renderer11::createImage()
 {
     return new Image11(this);
 }
 
-gl::Error Renderer11::generateMipmap(Image *dest, Image *src)
+gl::Error Renderer11::generateMipmap(ImageD3D *dest, ImageD3D *src)
 {
     Image11 *dest11 = Image11::makeImage11(dest);
     Image11 *src11 = Image11::makeImage11(src);
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
index 81c95b5..71d91f5 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
@@ -151,8 +151,8 @@
     virtual UniformStorage *createUniformStorage(size_t storageSize);
 
     // Image operations
-    virtual Image *createImage();
-    gl::Error generateMipmap(Image *dest, Image *source) override;
+    virtual ImageD3D *createImage();
+    gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) override;
     virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
     virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly);
     virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 58174e7..763dbf1 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -501,7 +501,7 @@
     return gl::Error(GL_NO_ERROR);
 }
 
-gl::Error TextureStorage11::setData(const gl::ImageIndex &index, Image *image, const gl::Box *destBox, GLenum type,
+gl::Error TextureStorage11::setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
                                     const gl::PixelUnpackState &unpack, const uint8_t *pixelData)
 {
     ID3D11Resource *resource = NULL;
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
index 395d082..69409e5 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
@@ -68,7 +68,7 @@
     virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage) = 0;
 
     virtual gl::Error copyToStorage(TextureStorage *destStorage);
-    virtual gl::Error setData(const gl::ImageIndex &index, Image *image, const gl::Box *destBox, GLenum type,
+    virtual gl::Error setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
                               const gl::PixelUnpackState &unpack, const uint8_t *pixelData);
 
   protected:
diff --git a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
index b7f755f..de7562c 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
@@ -93,7 +93,7 @@
     return gl::Error(GL_NO_ERROR);
 }
 
-Image9 *Image9::makeImage9(Image *img)
+Image9 *Image9::makeImage9(ImageD3D *img)
 {
     ASSERT(HAS_DYNAMIC_TYPE(Image9*, img));
     return static_cast<Image9*>(img);
diff --git a/src/libANGLE/renderer/d3d/d3d9/Image9.h b/src/libANGLE/renderer/d3d/d3d9/Image9.h
index 97801f8..ea3be32 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Image9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Image9.h
@@ -28,7 +28,7 @@
     Image9(Renderer9 *renderer);
     ~Image9();
 
-    static Image9 *makeImage9(Image *img);
+    static Image9 *makeImage9(ImageD3D *img);
 
     static gl::Error generateMipmap(Image9 *dest, Image9 *source);
     static gl::Error generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index bd7fead..4a6924c 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -2808,12 +2808,12 @@
     return gl::Error(GL_NO_ERROR);
 }
 
-Image *Renderer9::createImage()
+ImageD3D *Renderer9::createImage()
 {
     return new Image9(this);
 }
 
-gl::Error Renderer9::generateMipmap(Image *dest, Image *src)
+gl::Error Renderer9::generateMipmap(ImageD3D *dest, ImageD3D *src)
 {
     Image9 *src9 = Image9::makeImage9(src);
     Image9 *dst9 = Image9::makeImage9(dest);
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
index 88d8e38..4fb6118 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
@@ -160,8 +160,8 @@
     virtual UniformStorage *createUniformStorage(size_t storageSize);
 
     // Image operations
-    virtual Image *createImage();
-    gl::Error generateMipmap(Image *dest, Image *source) override;
+    virtual ImageD3D *createImage();
+    gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) override;
     virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
     virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly);
     virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
diff --git a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
index c84c288..b5c35e7 100644
--- a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
@@ -91,7 +91,7 @@
     return mMipLevels - mTopLevel;
 }
 
-gl::Error TextureStorage9::setData(const gl::ImageIndex &index, Image *image, const gl::Box *destBox, GLenum type,
+gl::Error TextureStorage9::setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
                                    const gl::PixelUnpackState &unpack, const uint8_t *pixelData)
 {
     UNREACHABLE();
diff --git a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
index c7259a7..1f2b06a 100644
--- a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
@@ -41,7 +41,7 @@
     virtual bool isManaged() const;
     virtual int getLevelCount() const;
 
-    virtual gl::Error setData(const gl::ImageIndex &index, Image *image, const gl::Box *destBox, GLenum type,
+    virtual gl::Error setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
                               const gl::PixelUnpackState &unpack, const uint8_t *pixelData);
 
   protected:
diff --git a/src/libGLESv2.gypi b/src/libGLESv2.gypi
index a80ed70..be4a378 100644
--- a/src/libGLESv2.gypi
+++ b/src/libGLESv2.gypi
@@ -113,8 +113,6 @@
             'libANGLE/renderer/DisplayImpl.h',
             'libANGLE/renderer/FenceImpl.h',
             'libANGLE/renderer/FramebufferImpl.h',
-            'libANGLE/renderer/Image.cpp',
-            'libANGLE/renderer/Image.h',
             'libANGLE/renderer/IndexRangeCache.cpp',
             'libANGLE/renderer/IndexRangeCache.h',
             'libANGLE/renderer/ProgramImpl.cpp',