Implements missing Image::loadData cases.
TRAC #22347
Author: Shannon Woods
Signed-off-by: Geoff Lang
Signed-off-by: Daniel Koch
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1675 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Image.cpp b/src/libGLESv2/renderer/Image.cpp
index e84eff5..473c1e1 100644
--- a/src/libGLESv2/renderer/Image.cpp
+++ b/src/libGLESv2/renderer/Image.cpp
@@ -45,6 +45,20 @@
}
}
+void Image::loadAlphaDataToNative(GLsizei width, GLsizei height,
+ int inputPitch, const void *input, size_t outputPitch, void *output)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + y * outputPitch;
+ memcpy(dest, source, width);
+ }
+}
+
void Image::loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output)
{
@@ -133,6 +147,25 @@
}
}
+void Image::loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height,
+ int inputPitch, const void *input, size_t outputPitch, void *output)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[3 * x + 0] = source[x];
+ dest[3 * x + 1] = source[x];
+ dest[3 * x + 2] = source[x];
+ }
+ }
+}
+
void Image::loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output)
{