summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKusanagi Kouichi <slash@ma.neweb.ne.jp>2007-12-02 17:18:46 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-12-02 17:18:46 +0100
commit6ed55b70b23dfdc7b41103ea59c1df2bda5e41e6 (patch)
tree1e28b98939a43948267a5de11a60ef7fcd1cdcb6
parenta697b590899bb7704ec4d7ae9a9c3cbbfcaef382 (diff)
radeon: Fix crash with XVideo 24bit RGB images.
See https://bugs.freedesktop.org/show_bug.cgi?id=13274 .
-rw-r--r--src/radeon_video.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 26857a5..332f2cd 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -2199,7 +2199,7 @@ RADEONCopyRGB24Data(
unsigned int w
){
CARD32 *dptr;
- CARD8 *sptr = 0;
+ CARD8 *sptr;
int i,j;
RADEONInfoPtr info = RADEONPTR(pScrn);
#ifdef XF86DRI
@@ -2214,7 +2214,7 @@ RADEONCopyRGB24Data(
RADEONHostDataParams( pScrn, dst, dstPitch, 4, &dstPitchOff, &x, &y );
- while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitch,
+ while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitchOff,
&bufPitch, x, &y, &h,
&hpass )) )
{
@@ -2224,11 +2224,14 @@ RADEONCopyRGB24Data(
for ( i = 0 ; i < w; i++, sptr += 3 )
{
- *dptr++ = (sptr[0] << 24) | (sptr[1] << 16) | sptr[2];
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ *dptr++ = (sptr[0] << 16) | (sptr[1] << 8) | sptr[2];
+#else
+ *dptr++ = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0];
+#endif
}
- src += hpass * srcPitch;
- dptr += hpass * bufPitch;
+ src += srcPitch;
}
}
@@ -2251,8 +2254,11 @@ RADEONCopyRGB24Data(
sptr=src+j*srcPitch;
for(i=w;i>0;i--){
- dptr[0]=((sptr[0])<<24)|((sptr[1])<<16)|(sptr[2]);
- dptr++;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ *dptr++=((sptr[0])<<16)|((sptr[1])<<8)|(sptr[2]);
+#else
+ *dptr++=((sptr[2])<<16)|((sptr[1])<<8)|(sptr[0]);
+#endif
sptr+=3;
}
}