Kaydet (Commit) 07bafbef authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS cl06 (1.10.116); FILE MERGED

2003/07/10 09:41:06 thb 1.10.116.3: #110595# Had to change swapping again, Sparc doesn't like unaligned access at all
2003/07/09 18:42:28 thb 1.10.116.2: #110595# Corrected offset in JPEG data stream when calculating the length
2003/07/08 15:21:27 thb 1.10.116.1: #110595# Incorporated Augustus' fix, using unix line ends now and defined out the writePageField stuff again. Furthermore, now using OSL_NETWORD for byte swapping in JPEG
üst 1b1c639f
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: swfwriter1.cxx,v $ * $RCSfile: swfwriter1.cxx,v $
* *
* $Revision: 1.12 $ * $Revision: 1.13 $
* *
* last change: $Author: thb $ $Date: 2003-07-10 09:32:38 $ * last change: $Author: vg $ $Date: 2003-07-11 10:22:41 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -961,7 +961,9 @@ void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Si ...@@ -961,7 +961,9 @@ void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Si
if (!rClipRect.IsEmpty()) if (!rClipRect.IsEmpty())
{ {
// AS: Christian, I also don't understand why bNeedToMapClipRect is necessary, but it // AS: Christian, I also don't understand why bNeedToMapClipRect is necessary, but it
// works like a charm. Sometimes the map event is missing from the metafile, but why? // works like a charm. Usually, the map event in the meta file does not cause the
// clipping rectangle to get mapped. However, sometimes there are multiple layers
// of mapping which eventually do cause the clipping rect to be mapped.
Size clipSize( bNeedToMapClipRect ? map(rClipRect.GetSize()) : rClipRect.GetSize() ); Size clipSize( bNeedToMapClipRect ? map(rClipRect.GetSize()) : rClipRect.GetSize() );
Rectangle clipRect = Rectangle(Point(), clipSize); Rectangle clipRect = Rectangle(Point(), clipSize);
destRect.Intersection( clipRect ); destRect.Intersection( clipRect );
...@@ -1061,57 +1063,84 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal ...@@ -1061,57 +1063,84 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal
// good SWF files. // good SWF files.
sal_uInt8 cType = 0x01; sal_uInt8 cType = 0x01;
const sal_uInt8* pJpgSearch = pJpgData; const sal_uInt8* pJpgSearch = pJpgData;
const sal_uInt8* pLastMark = pJpgData;
int nLength = 0;
SvMemoryStream EncodingTableStream; SvMemoryStream EncodingTableStream;
SvMemoryStream ImageBitsStream; SvMemoryStream ImageBitsStream;
for (;pJpgSearch < pJpgData + nJpgDataLength; pJpgSearch++) for (;pJpgSearch < pJpgData + nJpgDataLength; pJpgSearch += nLength)
{ {
if (0xFF == *pJpgSearch) if (0xFF != *pJpgSearch)
DBG_ERROR( "Expected JPEG marker." );
cType = *(pJpgSearch + 1);
if (0xD8 == cType || 0xD9 == cType)
{
nLength = 2;
}
else if (0xDA == cType)
{
//AS: This is the actual image data, and runs to the
// end of the file (as best I know), minus 2 bytes
// for the closing 0xFFD9.
nLength = nJpgDataLength - (pJpgSearch - pJpgData) - 2;
}
else
{ {
sal_uInt32 nLength = pJpgSearch - pLastMark; // AS: Lengths are big endian.
if (nLength > 0) // Beware. pJpgSearch is not necessarily word-aligned,
{ // so we access it byte-wise.
switch(cType)
{
case 0xD8:
EncodingTableStream.Write( pLastMark, nLength );
ImageBitsStream.Write( pLastMark, nLength );
break;
case 0x01: // AS: Add 2 to the length to include the 0xFFXX itself.
case 0x02: nLength = 2 + (pJpgSearch[2]<<8) + pJpgSearch[3];
case 0xDB: }
case 0xC4:
EncodingTableStream.Write( pLastMark, nLength );
break;
case 0xC1: // AS: I'm refering to libjpeg for a list of what these
case 0xE0: // markers are. See jdmarker.c for a list.
case 0xC0: // AS: I'm ignoring application specific markers 0xE1...0xEF
case 0xDA: // and comments 0xFE. I don't know what
case 0x03: // 0xF0 or 0xFD are for, and they don't come up.
case 0x00: // Additionally, 0xDE and 0xDF aren't clear to me.
ImageBitsStream.Write( pLastMark, nLength ); switch(cType)
break; {
case 0xD8:
case 0xD9:
EncodingTableStream.Write( pJpgSearch, nLength );
ImageBitsStream.Write( pJpgSearch, nLength );
break;
default: case 0x01:
DBG_ERROR( "JPEG marker I didn't handle!" ); case 0xDB:
case 0xDC:
case 0xDD:
case 0xC4:
EncodingTableStream.Write( pJpgSearch, nLength );
break;
} case 0xC0:
} case 0xC1:
case 0xC2:
case 0xC3:
case 0xC5:
case 0xC6:
case 0xC7:
// case 0xC8: Apparently reserved for JPEG extensions?
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCD:
case 0xCE:
case 0xCF:
case 0xDA:
case 0xE0:
ImageBitsStream.Write( pJpgSearch, nLength );
break;
cType = *(pJpgSearch + 1); default:
pLastMark = pJpgSearch; DBG_ERROR( "JPEG marker I didn't handle!" );
// AS: The way that I'm checking for markers, we'll miss the
// one at the end, so I special case it :(
if (0xD9 == cType)
{
EncodingTableStream.Write( pLastMark, 2 );
ImageBitsStream.Write( pLastMark, 2 );
}
} }
} }
...@@ -1338,6 +1367,8 @@ bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling ) ...@@ -1338,6 +1367,8 @@ bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling )
work out since the formating is always wrong when text follows the work out since the formating is always wrong when text follows the
page number field since pages greater one may require more space than page number field since pages greater one may require more space than
page 1 page 1
*/
#if 0
bool Writer::Impl_writePageField( Rectangle& rTextBounds ) bool Writer::Impl_writePageField( Rectangle& rTextBounds )
{ {
startTag( TAG_DEFINEEDITTEXT ); startTag( TAG_DEFINEEDITTEXT );
...@@ -1376,14 +1407,14 @@ bool Writer::Impl_writePageField( Rectangle& rTextBounds ) ...@@ -1376,14 +1407,14 @@ bool Writer::Impl_writePageField( Rectangle& rTextBounds )
return true; return true;
} }
*/ #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
{ {
Rectangle clipRect; Rectangle clipRect;
bool bMap = false; int bMap = 0;
for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ ) for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
{ {
const MetaAction* pAction = rMtf.GetAction( i ); const MetaAction* pAction = rMtf.GetAction( i );
...@@ -1594,7 +1625,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1594,7 +1625,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct; const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
Impl_writeImage( pBmpScaleAction->GetBitmap(), Impl_writeImage( pBmpScaleAction->GetBitmap(),
pA->GetPoint(), pA->GetSize(), pA->GetPoint(), pA->GetSize(),
Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), clipRect, !bMap ); Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), clipRect, 1 == bMap );
} }
} }
} }
...@@ -1689,10 +1720,9 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1689,10 +1720,9 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
} }
} }
} }
/* #if 0
else if( pA->GetComment().CompareIgnoreCaseToAscii( "FIELD_SEQ_BEGIN;PageField" ) == COMPARE_EQUAL ) else if( pA->GetComment().CompareIgnoreCaseToAscii( "FIELD_SEQ_BEGIN;PageField" ) == COMPARE_EQUAL )
{ {
bool bDone = sal_False; bool bDone = sal_False;
while( !bDone && ( ++i < nCount ) ) while( !bDone && ( ++i < nCount ) )
...@@ -1713,7 +1743,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1713,7 +1743,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
} }
} }
} }
*/ #endif
} }
break; break;
...@@ -1723,7 +1753,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1723,7 +1753,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
Impl_writeImage( pA->GetBitmap(), Impl_writeImage( pA->GetBitmap(),
pA->GetPoint(), pA->GetSize(), pA->GetPoint(), pA->GetSize(),
Point(), pA->GetBitmap().GetSizePixel(), clipRect, !bMap ); Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 == bMap );
} }
break; break;
...@@ -1732,7 +1762,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1732,7 +1762,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpAction* pA = (const MetaBmpAction*) pAction; const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
Impl_writeImage( pA->GetBitmap(), Impl_writeImage( pA->GetBitmap(),
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel()), pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel()),
Point(), pA->GetBitmap().GetSizePixel(), clipRect, !bMap ); Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 ==bMap );
} }
break; break;
...@@ -1741,7 +1771,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1741,7 +1771,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction; const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
Impl_writeImage( pA->GetBitmap(), Impl_writeImage( pA->GetBitmap(),
pA->GetDestPoint(), pA->GetDestSize(), pA->GetDestPoint(), pA->GetDestSize(),
pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, !bMap ); pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, 1 == bMap );
} }
break; break;
...@@ -1750,7 +1780,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1750,7 +1780,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction; const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
Impl_writeImage( pA->GetBitmapEx(), Impl_writeImage( pA->GetBitmapEx(),
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ), pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, !bMap ); Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, 1 == bMap );
} }
break; break;
...@@ -1759,7 +1789,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1759,7 +1789,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction; const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
Impl_writeImage( pA->GetBitmapEx(), Impl_writeImage( pA->GetBitmapEx(),
pA->GetPoint(), pA->GetSize(), pA->GetPoint(), pA->GetSize(),
Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, !bMap ); Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, 1 == bMap );
} }
break; break;
...@@ -1768,7 +1798,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1768,7 +1798,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction; const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
Impl_writeImage( pA->GetBitmapEx(), Impl_writeImage( pA->GetBitmapEx(),
pA->GetDestPoint(), pA->GetDestSize(), pA->GetDestPoint(), pA->GetDestSize(),
pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, !bMap ); pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, 1 == bMap );
} }
break; break;
...@@ -1814,7 +1844,18 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1814,7 +1844,18 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
} }
break; break;
case( META_MAPMODE_ACTION ): bMap = true; case( META_MAPMODE_ACTION ):
{
const MetaMapModeAction *pA = (const MetaMapModeAction*) pAction;
// MapMode mm = pA->GetMapMode();
// MapUnit mu = mm.GetMapUnit();
//
// Point pt = mm.GetOrigin();
// Fraction fx = mm.GetScaleX();
// Fraction fy = mm.GetScaleY();
bMap++;
}
case( META_REFPOINT_ACTION ): case( META_REFPOINT_ACTION ):
case( META_LINECOLOR_ACTION ): case( META_LINECOLOR_ACTION ):
case( META_FILLCOLOR_ACTION ): case( META_FILLCOLOR_ACTION ):
......
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