Kaydet (Commit) 064adfcd authored tarafından Armin Le Grand's avatar Armin Le Grand

#119176# corrected file type detection for SVG for svg files without xml header

üst 8d6ef652
...@@ -717,6 +717,44 @@ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtensio ...@@ -717,6 +717,44 @@ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtensio
delete[] pBuf; delete[] pBuf;
} }
if(bIsSvg)
{
rFormatExtension = UniString::CreateFromAscii( "SVG", 3 );
return sal_True;
}
}
else
{
// #119176# Svg files which have no xml header at all have shown up,
// detect those, too
bool bIsSvg(false);
// check for svg element in 1st 256 bytes
if(ImplSearchEntry( sFirstBytes, (sal_uInt8*)"<svg", 256, 4 )) // '<svg'
{
bIsSvg = true;
}
if(!bIsSvg)
{
// look for '<svg' in full file. Should not happen too
// often since the tests above will handle most cases, but can happen
// with Svg files containing big comment headers or Svg as the host
// language
const sal_uLong nSize((nStreamLen > 2048) ? 2048 : nStreamLen);
sal_uInt8* pBuf = new sal_uInt8[nSize];
rStream.Seek(nStreamPos);
rStream.Read(pBuf, nSize);
if(ImplSearchEntry(pBuf, (sal_uInt8*)"<svg", nSize, 4)) // '<svg'
{
bIsSvg = true;
}
delete[] pBuf;
}
if(bIsSvg) if(bIsSvg)
{ {
rFormatExtension = UniString::CreateFromAscii( "SVG", 3 ); rFormatExtension = UniString::CreateFromAscii( "SVG", 3 );
......
...@@ -407,6 +407,9 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj* ...@@ -407,6 +407,9 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*
delete mpBmpEx, mpBmpEx = NULL; delete mpBmpEx, mpBmpEx = NULL;
delete mpMtf, mpMtf = NULL; delete mpMtf, mpMtf = NULL;
delete mpAnimation, mpAnimation = NULL; delete mpAnimation, mpAnimation = NULL;
// #119176# also reset SvgData
maSvgData.reset();
} }
} }
......
...@@ -869,7 +869,7 @@ bool paintUsingPrimitivesHelper( ...@@ -869,7 +869,7 @@ bool paintUsingPrimitivesHelper(
if(bMirrorX || bMirrorY) if(bMirrorX || bMirrorY)
{ {
aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY()); aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY());
aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorX ? -1.0 : 1.0); aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // #119176# small typo with X/Y
aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY()); aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY());
} }
......
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