Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-08-28 13:30:33 +0400
committerTon Roosendaal <ton@blender.org>2006-08-28 13:30:33 +0400
commitdba6769b2eea62f1952a1c85e3b1aa398dcb2b1f (patch)
treed973743d7ef8435f70671d123d10a3418d560892 /source/blender/quicktime
parent9123507c2e237912e8890a0734bd46fab723caaa (diff)
bugfix #4812
Quicktime reading for Macs: code that converted ARGB to RGBA was endian sensitive. Didn't work for Mac intel systems.
Diffstat (limited to 'source/blender/quicktime')
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index 99618bc3583..c701d4d41d0 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -291,6 +291,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
ImBuf *ibuf = NULL;
unsigned int *rect;
+ unsigned char *from, *to;
#ifdef _WIN32
unsigned char *crect;
#endif
@@ -321,11 +322,16 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
changePos = (uint32_t *) rect; //textureIMBuf *THE* data pointerrr
#ifdef __APPLE__
- // Swap alpha byte to the end, so ARGB become RGBA; note this is
- // big endian-centric.
- for( index = 0; index < boxsize; index++, changePos++, readPos++ )
- *( changePos ) = ( ( *readPos & 0xFFFFFF ) << 8 ) |
- ( ( *readPos >> 24 ) & 0xFF );
+ // Swap alpha byte to the end, so ARGB become RGBA;
+ from= (unsigned char *)readPos;
+ to= (unsigned char *)changePos;
+
+ for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+ to[3] = from[0];
+ to[0] = from[1];
+ to[1] = from[2];
+ to[2] = from[3];
+ }
#endif
#ifdef _WIN32
@@ -581,6 +587,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
ImBuf *wbuf = NULL;
unsigned int *rect;
+ unsigned char *from, *to;
#endif
if (mem == NULL)
@@ -678,9 +685,16 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
readPos = (uint32_t *) myPtr;
changePos = (uint32_t *) rect;
- for( index = 0; index < boxsize; index++, changePos++, readPos++ )
- *( changePos ) = ( ( *readPos & 0xFFFFFF ) << 8 ) |
- ( ( *readPos >> 24 ) & 0xFF );
+ // Swap alpha byte to the end, so ARGB become RGBA;
+ from= (unsigned char *)readPos;
+ to= (unsigned char *)changePos;
+
+ for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+ to[3] = from[0];
+ to[0] = from[1];
+ to[1] = from[2];
+ to[2] = from[3];
+ }
#endif
bail: