Commit ad5df071 by baustin@google.com

Fix for loading L/LA images into a native (8/16-bit) D3D surface.

Review URL: http://codereview.appspot.com/3805044 git-svn-id: https://angleproject.googlecode.com/svn/trunk@523 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 17767ceb
...@@ -412,13 +412,14 @@ void Texture::loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei ...@@ -412,13 +412,14 @@ void Texture::loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei
void Texture::loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, void Texture::loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
{ {
const int destBytesPerPixel = native? 1: 4;
const unsigned char *source = NULL; const unsigned char *source = NULL;
unsigned char *dest = NULL; unsigned char *dest = NULL;
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {
source = static_cast<const unsigned char*>(input) + y * inputPitch; source = static_cast<const unsigned char*>(input) + y * inputPitch;
dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4; dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * destBytesPerPixel;
if (!native) // BGRA8 destination format if (!native) // BGRA8 destination format
{ {
...@@ -480,13 +481,14 @@ void Texture::loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsi ...@@ -480,13 +481,14 @@ void Texture::loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsi
void Texture::loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, void Texture::loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
{ {
const int destBytesPerPixel = native? 2: 4;
const unsigned char *source = NULL; const unsigned char *source = NULL;
unsigned char *dest = NULL; unsigned char *dest = NULL;
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {
source = static_cast<const unsigned char*>(input) + y * inputPitch; source = static_cast<const unsigned char*>(input) + y * inputPitch;
dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4; dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * destBytesPerPixel;
if (!native) // BGRA8 destination format if (!native) // BGRA8 destination format
{ {
......
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