Kaydet (Commit) 1b1c639f authored tarafından Thorsten Behrens's avatar Thorsten Behrens

#100000# Changes have to happen on branches, restoring original master version

üst aad1b7f8
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: swfwriter1.cxx,v $ * $RCSfile: swfwriter1.cxx,v $
* *
* $Revision: 1.11 $ * $Revision: 1.12 $
* *
* last change: $Author: asaunders $ $Date: 2003-07-07 22:30:43 $ * last change: $Author: thb $ $Date: 2003-07-10 09:32:38 $
* *
* 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,10 +961,8 @@ void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Si ...@@ -961,10 +961,8 @@ 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. Usually, the map event in the meta file does not cause the // works like a charm. Sometimes the map event is missing from the metafile, but why?
// clipping rectangle to get mapped. However, sometimes there are multiple layers Size clipSize( bNeedToMapClipRect ? map(rClipRect.GetSize()) : rClipRect.GetSize() );
// of mapping which eventually do cause the clipping rect to be mapped.
Size clipSize( bNeedToMapClipRect ? map(rClipRect.GetSize()) : rClipRect.GetSize() );
Rectangle clipRect = Rectangle(Point(), clipSize); Rectangle clipRect = Rectangle(Point(), clipSize);
destRect.Intersection( clipRect ); destRect.Intersection( clipRect );
...@@ -1063,85 +1061,57 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal ...@@ -1063,85 +1061,57 @@ 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 += nLength) for (;pJpgSearch < pJpgData + nJpgDataLength; pJpgSearch++)
{ {
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
{
// AS: Lengths are big endian, so swap the bytes.
// AS: CHRISTIAN: You guys probably have a "correct"
// way of doing this that works on all architectures.
char charswap[2] = {*(pJpgSearch + 3), *(pJpgSearch + 2)};
unsigned short *pTagLength = (unsigned short*)charswap;
// AS: Add 2 to the length to include the 0xFFXX itself.
nLength = 2 + *pTagLength;
}
// AS: I'm refering to libjpeg for a list of what these
// markers are. See jdmarker.c for a list.
// AS: I'm ignoring application specific markers 0xE1...0xEF
// and comments 0xFE. I don't know what
// 0xF0 or 0xFD are for, and they don't come up.
// Additionally, 0xDE and 0xDF aren't clear to me.
switch(cType)
{ {
case 0xD8: sal_uInt32 nLength = pJpgSearch - pLastMark;
case 0xD9:
EncodingTableStream.Write( pJpgSearch, nLength );
ImageBitsStream.Write( pJpgSearch, nLength );
break;
case 0x01: if (nLength > 0)
case 0xDB: {
case 0xDC: switch(cType)
case 0xDD: {
case 0xC4: case 0xD8:
EncodingTableStream.Write( pJpgSearch, nLength ); EncodingTableStream.Write( pLastMark, nLength );
break; ImageBitsStream.Write( pLastMark, nLength );
break;
case 0xC0: case 0x01:
case 0xC1: case 0x02:
case 0xC2: case 0xDB:
case 0xC3: case 0xC4:
case 0xC5: EncodingTableStream.Write( pLastMark, nLength );
case 0xC6: break;
case 0xC7:
// case 0xC8: Apparently reserved for JPEG extensions? case 0xC1:
case 0xC9: case 0xE0:
case 0xCA: case 0xC0:
case 0xCB: case 0xDA:
case 0xCD: case 0x03:
case 0xCE: case 0x00:
case 0xCF: ImageBitsStream.Write( pLastMark, nLength );
case 0xDA: break;
case 0xE0:
ImageBitsStream.Write( pJpgSearch, nLength ); default:
break; DBG_ERROR( "JPEG marker I didn't handle!" );
}
}
default: cType = *(pJpgSearch + 1);
DBG_ERROR( "JPEG marker I didn't handle!" ); pLastMark = pJpgSearch;
// 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 );
}
} }
} }
...@@ -1367,9 +1337,7 @@ bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling ) ...@@ -1367,9 +1337,7 @@ bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling )
string from a variable set with actionscript by each page. This didn't string from a variable set with actionscript by each page. This didn't
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 );
...@@ -1408,14 +1376,14 @@ bool Writer::Impl_writePageField( Rectangle& rTextBounds ) ...@@ -1408,14 +1376,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;
int bMap = 0; bool bMap = false;
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 );
...@@ -1626,7 +1594,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1626,7 +1594,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, 1 == bMap ); Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), clipRect, !bMap );
} }
} }
} }
...@@ -1721,9 +1689,10 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1721,9 +1689,10 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
} }
} }
} }
/*
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 ) )
...@@ -1743,7 +1712,8 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1743,7 +1712,8 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
bDone = sal_True; bDone = sal_True;
} }
} }
} }
*/
} }
break; break;
...@@ -1753,7 +1723,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1753,7 +1723,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, 1 == bMap ); Point(), pA->GetBitmap().GetSizePixel(), clipRect, !bMap );
} }
break; break;
...@@ -1762,7 +1732,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1762,7 +1732,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, 1 ==bMap ); Point(), pA->GetBitmap().GetSizePixel(), clipRect, !bMap );
} }
break; break;
...@@ -1771,7 +1741,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1771,7 +1741,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, 1 == bMap ); pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, !bMap );
} }
break; break;
...@@ -1780,7 +1750,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1780,7 +1750,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, 1 == bMap ); Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, !bMap );
} }
break; break;
...@@ -1789,7 +1759,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1789,7 +1759,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, 1 == bMap ); Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, !bMap );
} }
break; break;
...@@ -1798,7 +1768,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1798,7 +1768,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, 1 == bMap ); pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, !bMap );
} }
break; break;
...@@ -1844,18 +1814,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) ...@@ -1844,18 +1814,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
} }
break; break;
case( META_MAPMODE_ACTION ): case( META_MAPMODE_ACTION ): bMap = true;
{
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