Implemented copying from A1R5G5B5 to L8 and A8L8.

Fixed the copying range. TRAC #14885 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@515 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a628c9ff
...@@ -987,7 +987,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs ...@@ -987,7 +987,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs
case D3DFMT_L8: case D3DFMT_L8:
for(int y = 0; y < height; y++) for(int y = 0; y < height; y++)
{ {
for(int x = 0; x < height; x++) for(int x = 0; x < width; x++)
{ {
dest[x] = source[x * 4 + 2]; dest[x] = source[x * 4 + 2];
} }
...@@ -999,7 +999,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs ...@@ -999,7 +999,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs
case D3DFMT_A8L8: case D3DFMT_A8L8:
for(int y = 0; y < height; y++) for(int y = 0; y < height; y++)
{ {
for(int x = 0; x < height; x++) for(int x = 0; x < width; x++)
{ {
dest[x * 2 + 0] = source[x * 4 + 2]; dest[x * 2 + 0] = source[x * 4 + 2];
dest[x * 2 + 1] = source[x * 4 + 3]; dest[x * 2 + 1] = source[x * 4 + 3];
...@@ -1019,7 +1019,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs ...@@ -1019,7 +1019,7 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs
case D3DFMT_L8: case D3DFMT_L8:
for(int y = 0; y < height; y++) for(int y = 0; y < height; y++)
{ {
for(int x = 0; x < height; x++) for(int x = 0; x < width; x++)
{ {
unsigned char red = source[x * 2 + 1] & 0xF8; unsigned char red = source[x * 2 + 1] & 0xF8;
dest[x] = red | (red >> 5); dest[x] = red | (red >> 5);
...@@ -1033,6 +1033,40 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs ...@@ -1033,6 +1033,40 @@ void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffs
UNREACHABLE(); UNREACHABLE();
} }
break; break;
case D3DFMT_A1R5G5B5:
switch(getD3DFormat())
{
case D3DFMT_L8:
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
unsigned char red = source[x * 2 + 1] & 0x7C;
dest[x] = (red << 1) | (red >> 4);
}
source += sourceLock.Pitch;
dest += destLock.Pitch;
}
break;
case D3DFMT_A8L8:
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
unsigned char red = source[x * 2 + 1] & 0x7C;
dest[x * 2 + 0] = (red << 1) | (red >> 4);
dest[x * 2 + 1] = (signed char)source[x * 2 + 1] >> 7;
}
source += sourceLock.Pitch;
dest += destLock.Pitch;
}
break;
default:
UNREACHABLE();
}
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
......
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