Eliminated GetDesc calls.

TRAC #18714 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@830 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 73de05a5
...@@ -342,7 +342,7 @@ GLenum Texture::getWrapT() const ...@@ -342,7 +342,7 @@ GLenum Texture::getWrapT() const
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input // Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle at output with outputPitch bytes in between each line. // into the target pixel rectangle at output with outputPitch bytes in between each line.
void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLint unpackAlignment, const void *input, size_t outputPitch, void *output, D3DSURFACE_DESC *description) const GLint unpackAlignment, const void *input, size_t outputPitch, void *output, D3DFORMAT targetFormat) const
{ {
GLsizei inputPitch = -ComputePitch(width, format, type, unpackAlignment); GLsizei inputPitch = -ComputePitch(width, format, type, unpackAlignment);
input = ((char*)input) - inputPitch * (height - 1); input = ((char*)input) - inputPitch * (height - 1);
...@@ -356,10 +356,10 @@ void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei ...@@ -356,10 +356,10 @@ void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei
loadAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output); loadAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
loadLuminanceImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_L8); loadLuminanceImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, targetFormat == D3DFMT_L8);
break; break;
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
loadLuminanceAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_A8L8); loadLuminanceAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, targetFormat == D3DFMT_A8L8);
break; break;
case GL_RGB: case GL_RGB:
loadRGBUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output); loadRGBUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
...@@ -1161,10 +1161,7 @@ void Texture::setImage(GLint unpackAlignment, const void *pixels, Image *image) ...@@ -1161,10 +1161,7 @@ void Texture::setImage(GLint unpackAlignment, const void *pixels, Image *image)
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
D3DSURFACE_DESC description; loadImageData(0, 0, image->getWidth(), image->getHeight(), image->getFormat(), image->getType(), unpackAlignment, pixels, locked.Pitch, locked.pBits, image->getD3DFormat());
image->getSurface()->GetDesc(&description);
loadImageData(0, 0, image->getWidth(), image->getHeight(), image->getFormat(), image->getType(), unpackAlignment, pixels, locked.Pitch, locked.pBits, &description);
image->unlock(); image->unlock();
} }
...@@ -1220,10 +1217,7 @@ bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig ...@@ -1220,10 +1217,7 @@ bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
D3DSURFACE_DESC description; loadImageData(xoffset, transformPixelYOffset(yoffset, height, image->getHeight()), width, height, format, type, unpackAlignment, pixels, locked.Pitch, locked.pBits, image->getD3DFormat());
image->getSurface()->GetDesc(&description);
loadImageData(xoffset, transformPixelYOffset(yoffset, height, image->getHeight()), width, height, format, type, unpackAlignment, pixels, locked.Pitch, locked.pBits, &description);
image->unlock(); image->unlock();
} }
......
...@@ -158,7 +158,7 @@ class Texture : public RefCountObject ...@@ -158,7 +158,7 @@ class Texture : public RefCountObject
DISALLOW_COPY_AND_ASSIGN(Texture); DISALLOW_COPY_AND_ASSIGN(Texture);
void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLint unpackAlignment, const void *input, std::size_t outputPitch, void *output, D3DSURFACE_DESC *description) const; GLint unpackAlignment, const void *input, std::size_t outputPitch, void *output, D3DFORMAT targetFormat) const;
void loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, void loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const; int inputPitch, const void *input, size_t outputPitch, void *output) const;
......
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