Moved Image outside of Texture.

TRAC #18714 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@825 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0da803be
...@@ -29,12 +29,12 @@ namespace gl ...@@ -29,12 +29,12 @@ namespace gl
{ {
unsigned int Texture::mCurrentSerial = 1; unsigned int Texture::mCurrentSerial = 1;
Texture::Image::Image() Image::Image()
: width(0), height(0), dirty(false), surface(NULL), format(GL_NONE), type(GL_UNSIGNED_BYTE) : width(0), height(0), dirty(false), surface(NULL), format(GL_NONE), type(GL_UNSIGNED_BYTE)
{ {
} }
Texture::Image::~Image() Image::~Image()
{ {
if (surface) if (surface)
{ {
...@@ -42,7 +42,7 @@ Texture::Image::~Image() ...@@ -42,7 +42,7 @@ Texture::Image::~Image()
} }
} }
bool Texture::Image::isRenderable() const bool Image::isRenderable() const
{ {
switch(getD3DFormat()) switch(getD3DFormat())
{ {
...@@ -64,7 +64,7 @@ bool Texture::Image::isRenderable() const ...@@ -64,7 +64,7 @@ bool Texture::Image::isRenderable() const
return false; return false;
} }
D3DFORMAT Texture::Image::getD3DFormat() const D3DFORMAT Image::getD3DFormat() const
{ {
if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT || if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
...@@ -1050,7 +1050,7 @@ void Texture::loadDXT5ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLs ...@@ -1050,7 +1050,7 @@ void Texture::loadDXT5ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLs
} }
} }
void Texture::Image::createSurface() void Image::createSurface()
{ {
if(surface) if(surface)
{ {
...@@ -1535,7 +1535,7 @@ D3DFORMAT Texture2D::getD3DFormat() const ...@@ -1535,7 +1535,7 @@ D3DFORMAT Texture2D::getD3DFormat() const
return mImageArray[0].getD3DFormat(); return mImageArray[0].getD3DFormat();
} }
void Texture::Image::redefine(GLenum format, GLsizei width, GLsizei height, GLenum type) void Image::redefine(GLenum format, GLsizei width, GLsizei height, GLenum type)
{ {
this->width = width; this->width = width;
this->height = height; this->height = height;
......
...@@ -43,6 +43,27 @@ enum ...@@ -43,6 +43,27 @@ enum
IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE
}; };
struct Image
{
Image();
~Image();
void redefine(GLenum format, GLsizei width, GLsizei height, GLenum type);
void createSurface();
bool isRenderable() const;
D3DFORMAT getD3DFormat() const;
GLsizei width;
GLsizei height;
GLenum format;
GLenum type;
bool dirty;
IDirect3DSurface9 *surface;
};
class Texture : public RefCountObject class Texture : public RefCountObject
{ {
public: public:
...@@ -87,28 +108,6 @@ class Texture : public RefCountObject ...@@ -87,28 +108,6 @@ class Texture : public RefCountObject
protected: protected:
friend class Colorbuffer; friend class Colorbuffer;
// Helper structure representing a single image layer
struct Image
{
Image();
~Image();
void redefine(GLenum format, GLsizei width, GLsizei height, GLenum type);
void createSurface();
bool isRenderable() const;
D3DFORMAT getD3DFormat() const;
GLsizei width;
GLsizei height;
GLenum format;
GLenum type;
bool dirty;
IDirect3DSurface9 *surface;
};
void setImage(GLint unpackAlignment, const void *pixels, Image *image); void setImage(GLint unpackAlignment, const void *pixels, Image *image);
bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image); bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image); void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment