From 7c48bec8999d536e1b0f2316e28cb6f6a36a6bbb Mon Sep 17 00:00:00 2001 From: Rob Haarsma Date: Fri, 16 May 2003 14:31:31 +0000 Subject: Fixed nasty issue when aborting Quicktime rendering. --- source/blender/quicktime/apple/quicktime_export.c | 45 ++++++----------------- 1 file changed, 11 insertions(+), 34 deletions(-) (limited to 'source/blender') diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index b66b495d562..0bcc51db84a 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -139,7 +139,8 @@ typedef struct _QuicktimeExport { ImageDescription **anImageDescription; ImageSequence anImageSequence; - ImBuf *ibuf; + ImBuf *ibuf; //for Qtime's Gworld + ImBuf *ibuf2; //copy of renderdata, to be Y-flipped } QuicktimeExport; @@ -259,6 +260,7 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame) OSErr err = noErr; qte->ibuf = IMB_allocImBuf (R.rectx, R.recty, 32, IB_rect, 0); + qte->ibuf2 = IMB_allocImBuf (R.rectx, R.recty, 32, IB_rect, 0); err = NewGWorldFromPtr( &qte->theGWorld, k32ARGBPixelFormat, @@ -297,21 +299,10 @@ static void QT_DoAddVideoSamplesToMedia (int frame) long dataSize; Handle compressedData; -// flip rendered data for quicktime -// NOTE: we flip the original renderdata ! - short x,y,backx; - unsigned int *top,*bottom,temp; - - x = R.rectx; y = R.recty; backx = x<<1; - top = R.rectot; bottom = top + ((y-1) * x); y >>= 1; - - for(;y>0;y--){ - for(x = R.rectx; x > 0; x--){ - temp = *top; - *(top++) = *bottom; - *(bottom++) = temp; - } - bottom -= backx; +// copy and flip the renderdata + if(qte->ibuf2) { + memcpy(qte->ibuf2->rect, R.rectot, 4*R.rectx*R.recty); + IMB_flipy(qte->ibuf2); } //get pointers to parse bitmapdata @@ -319,7 +310,7 @@ static void QT_DoAddVideoSamplesToMedia (int frame) imageRect = (**qte->thePixMap).bounds; boxsize = R.rectx * R.recty; - readPos = (uint32_t *) R.rectot; + readPos = (uint32_t *) qte->ibuf2->rect; changePos = (uint32_t *) myPtr; #ifdef __APPLE__ @@ -366,6 +357,9 @@ static void QT_EndAddVideoSamplesToMedia (void) UnlockPixels(qte->thePixMap); if (qte->theGWorld) DisposeGWorld (qte->theGWorld); if (qte->ibuf) IMB_freeImBuf(qte->ibuf); + if (qte->ibuf2) { + IMB_freeImBuf(qte->ibuf2); + } } @@ -465,9 +459,6 @@ void append_qt(int frame) { void end_qt(void) { OSErr err = noErr; - short x,y,backx; - unsigned int *top,*bottom,temp; - if(qte->theMovie) { QT_EndCreateMyVideoTrack (); @@ -478,20 +469,6 @@ void end_qt(void) { if (qte->resRefNum) CloseMovieFile (qte->resRefNum); DisposeMovie (qte->theMovie); - - //flip back rendered data when done exporting quicktime - - x = R.rectx; y = R.recty; backx = x<<1; - top = R.rectot; bottom = top + ((y-1) * x); y >>= 1; - - for(;y>0;y--){ - for(x = R.rectx; x > 0; x--){ - temp = *top; - *(top++) = *bottom; - *(bottom++) = temp; - } - bottom -= backx; - } } if(qte) { -- cgit v1.2.3